Files
MobilityOps/backend/Dockerfile
T
NuklearRabbit 2918608240
MobilityOps acceptance / backend (pull_request) Failing after 2m20s
MobilityOps acceptance / frontend (pull_request) Successful in 1m24s
MobilityOps acceptance / e2e (pull_request) Skipped
Managed validation / full (pull_request) Canceled after 0s
fix(ci): isolate contract and image scans from host paths
2026-08-29 00:27:17 +02:00

36 lines
1.3 KiB
Docker

FROM python:3.12-slim-bookworm@sha256:a116514e19457bcb7af7efe9c3dd0b9b71e85b317694e7882a1c52aa15a78134 AS runtime-base
ARG VCS_REF=development
ARG BUILD_DATE=unknown
LABEL org.opencontainers.image.title="Fleet Ops API" \
org.opencontainers.image.revision="$VCS_REF" \
org.opencontainers.image.created="$BUILD_DATE" \
org.opencontainers.image.source="https://fleetops.itworx.tech"
ENV PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1
WORKDIR /app
COPY backend/requirements-prod.lock ./
RUN pip install --no-cache-dir -r requirements-prod.lock
COPY backend/pyproject.toml ./
COPY backend/app ./app
COPY backend/alembic ./alembic
COPY backend/alembic.ini ./
COPY seed ./seed
COPY knowledge ./knowledge
COPY backend/entrypoint.sh ./entrypoint.sh
RUN pip install --no-cache-dir --no-deps -e . && chmod +x ./entrypoint.sh \
&& addgroup --system app && adduser --system --ingroup app --home /app app \
&& chown -R app:app /app
FROM runtime-base AS test
COPY backend/requirements.lock ./requirements.lock
RUN pip install --no-cache-dir -r requirements.lock
COPY backend/tests ./tests
COPY contracts ./contracts
COPY scripts/check-contracts.py ./scripts/check-contracts.py
USER app
FROM runtime-base AS runtime
# Run migrations and the API as an unprivileged user; nothing here needs root.
USER app
EXPOSE 8000
CMD ["./entrypoint.sh"]