The provisioner's BitwardenHelper.login() was missing the critical `bw sync` step that the host wrapper includes. Without syncing after login, the container's local vault cache was empty/stale, causing items to vanish between container runs. Added sync() call at end of login() and before list_items(). Also fixed container UID/GID to match host user (1002:1002) for proper bind-mount access, and added source-code volume mounts for fast iteration. Verified with 5-phase cross-container persistence test (create in container A, verify in fresh container B, update in C, confirm in D).
38 lines
1.2 KiB
Docker
38 lines
1.2 KiB
Docker
FROM mcr.microsoft.com/playwright:v1.52.0-noble
|
|
|
|
RUN apt-get update && \
|
|
apt-get install -y --no-install-recommends \
|
|
jq \
|
|
unzip \
|
|
wget \
|
|
python3-pip \
|
|
libzbar0 \
|
|
libzbar-dev \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Install Bitwarden CLI — native Rust binary (no Node.js/npm)
|
|
# Same CLI interface as the npm package but zero runtime dependencies.
|
|
ARG BW_CLI_VERSION=2026.7.0
|
|
RUN wget -q -O /tmp/bw.zip \
|
|
"https://github.com/bitwarden/clients/releases/download/cli-v${BW_CLI_VERSION}/bw-linux-${BW_CLI_VERSION}.zip" && \
|
|
unzip -o /tmp/bw.zip -d /usr/local/bin/ && \
|
|
chmod +x /usr/local/bin/bw && \
|
|
rm /tmp/bw.zip
|
|
|
|
# Install Python dependencies
|
|
COPY requirements.txt /tmp/
|
|
RUN python3 -m pip install --no-cache-dir --break-system-packages -r /tmp/requirements.txt
|
|
|
|
# Create non-root user for Playwright, matching host UID/GID for bind-mount access
|
|
RUN groupadd -r -g 1002 provision && useradd -r -u 1002 -g provision -G audio,video -m -d /home/provision provision \
|
|
&& mkdir -p "/home/provision/.config/Bitwarden CLI" \
|
|
&& chown -R provision:provision /home/provision
|
|
|
|
WORKDIR /app
|
|
COPY . .
|
|
RUN chown -R provision:provision /app
|
|
|
|
USER provision
|
|
|
|
ENTRYPOINT ["python3", "/app/provision-agent.py"]
|