2026-09-04 17:34:03 -05:00
|
|
|
# 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
|
2026-09-04 19:51:52 -05:00
|
|
|
# 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 .
|
2026-09-04 17:34:03 -05:00
|
|
|
|
|
|
|
|
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"]
|