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 CMD ["python", "-m", "unittest", "discover", "-s", "tests", "-v"] FROM python:3.11-slim ENV PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1 RUN groupadd --gid 1001 archive-control \ && useradd --uid 1001 --gid 1001 --no-create-home archive-control 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"]