Files
Aurora-Core/docker/worker.Dockerfile
T
NixReaperandClaude Sonnet 5 e6841badf8
CI / lint (push) Canceled after 0s
CI / typecheck (push) Canceled after 0s
CI / unit-tests (push) Canceled after 0s
CI / integration-tests (push) Canceled after 0s
CI / container-build (push) Canceled after 0s
CI / dependency-audit (push) Canceled after 0s
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 <[email protected]>
2026-09-04 19:51:52 -05:00

38 lines
1.3 KiB
Docker

# syntax=docker/dockerfile:1
FROM python:3.12-slim AS base
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1
RUN apt-get update \
&& apt-get install -y --no-install-recommends libpq5 \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
FROM base AS builder
RUN apt-get update \
&& apt-get install -y --no-install-recommends build-essential libpq-dev \
&& rm -rf /var/lib/apt/lists/*
COPY pyproject.toml ./
COPY app ./app
# 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
COPY --from=builder /usr/local/lib/python3.12/site-packages /usr/local/lib/python3.12/site-packages
COPY --from=builder /usr/local/bin /usr/local/bin
COPY app ./app
USER aurora
CMD ["arq", "app.workers.worker.WorkerSettings"]