From e6841badf85d5e14b96d810528f2bccc7293c39d Mon Sep 17 00:00:00 2001 From: NixReaper Date: Fri, 4 Sep 2026 19:51:52 -0500 Subject: [PATCH] Fix worker never picking up code changes after restart docker compose restart worker looked like it should reflect new code (docker-compose.yml bind-mounts ./app:/app/app for dev), but the worker Dockerfile installed the app package non-editably (pip install .), which copies a frozen snapshot into site-packages at image build time. The bare `arq` console-script just imports whatever site-packages says `app` is -- unlike uvicorn --reload, which explicitly resolves its import string against the CWD -- so the worker silently kept running whatever code existed at the last `docker compose up --build`, no matter how many times it was restarted or how recent the git pull was. Confirmed live: after pulling the series/season ingestion pipeline and restarting, the worker log still read "Starting worker for 2 functions: ingest_movie_task, ingest_person_task" -- proof it never saw ingest_series_task/ingest_season_task at all. Switching to `pip install -e .` makes site-packages point at /app by absolute path instead of a frozen copy, so the same bind mount that already worked for the API now actually reaches the worker process too -- a plain restart after `git pull` is enough going forward. Applied to both Dockerfiles for consistency, since the API's working behavior was incidental to uvicorn, not something to rely on either. Co-Authored-By: Claude Sonnet 5 --- docker/api.Dockerfile | 6 +++++- docker/worker.Dockerfile | 9 ++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/docker/api.Dockerfile b/docker/api.Dockerfile index 1bf3af5..2acb772 100644 --- a/docker/api.Dockerfile +++ b/docker/api.Dockerfile @@ -17,7 +17,11 @@ RUN apt-get update \ && rm -rf /var/lib/apt/lists/* COPY pyproject.toml ./ COPY app ./app -RUN pip install --no-cache-dir . +# Editable install so site-packages resolves `app` by absolute path (/app) +# rather than a frozen copy — consistent with worker.Dockerfile, and keeps +# this correct even though uvicorn --reload happens to resolve its own +# import string against the CWD regardless. +RUN pip install --no-cache-dir -e . FROM base AS runtime RUN useradd --create-home --uid 1000 aurora diff --git a/docker/worker.Dockerfile b/docker/worker.Dockerfile index a525904..92b1e84 100644 --- a/docker/worker.Dockerfile +++ b/docker/worker.Dockerfile @@ -17,7 +17,14 @@ RUN apt-get update \ && rm -rf /var/lib/apt/lists/* COPY pyproject.toml ./ COPY app ./app -RUN pip install --no-cache-dir . +# Editable install: site-packages ends up pointing at this /app directory by +# absolute path rather than a frozen copy of it. That matters because the +# `arq` console-script (unlike uvicorn --reload, which explicitly resolves +# its app import against the CWD) just imports whatever site-packages says +# `app` is — a non-editable install would permanently freeze the worker's +# code at whatever this build saw, silently ignoring the dev bind mount +# (docker-compose.yml's `./app:/app/app`) on every later `restart`. +RUN pip install --no-cache-dir -e . FROM base AS runtime RUN useradd --create-home --uid 1000 aurora