FROM python:3.11-slim AS builder WORKDIR /build COPY pyproject.toml ./ COPY src ./src RUN pip wheel --no-cache-dir --wheel-dir /wheels . FROM builder AS test RUN pip install --no-cache-dir /wheels/*.whl COPY tests ./tests COPY scripts ./scripts CMD ["python", "-m", "unittest", "discover", "-s", "tests", "-v"] FROM python:3.11-slim ENV PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1 RUN if ! getent group 1001 >/dev/null; then \ groupadd --gid 1001 archive-control; \ fi \ && if ! getent passwd 1001 >/dev/null; then \ useradd --uid 1001 --gid 1001 --no-create-home archive-control; \ fi COPY --from=builder /wheels /wheels RUN pip install --no-cache-dir /wheels/*.whl && rm -rf /wheels USER 1001:1001 ENTRYPOINT ["archive-client"] CMD ["--config", "/etc/archive-control/client.toml"]