FROM python:3.12-slim AS builder WORKDIR /build RUN pip install --no-cache-dir --upgrade pip build COPY pyproject.toml ./ COPY app ./app RUN python -m build --wheel FROM python:3.12-slim ENV PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1 RUN addgroup --system --gid 10001 han && adduser --system --uid 10001 --ingroup han han WORKDIR /app COPY --from=builder /build/dist/*.whl /tmp/ RUN pip install --no-cache-dir /tmp/*.whl && rm -f /tmp/*.whl COPY alembic.ini ./ COPY migrations ./migrations USER 10001:10001 EXPOSE 8080 CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8080", "--no-proxy-headers"]