generated from coulomb/repo-seed
32 lines
870 B
Docker
32 lines
870 B
Docker
# Stage 1: install production dependencies into an isolated virtualenv.
|
|
FROM python:3.12-slim AS builder
|
|
|
|
RUN pip install uv --no-cache-dir
|
|
WORKDIR /app
|
|
|
|
COPY pyproject.toml uv.lock README.md ./
|
|
COPY src/ ./src/
|
|
COPY alembic.ini ./
|
|
COPY migrations/ ./migrations/
|
|
COPY scripts/ ./scripts/
|
|
|
|
RUN uv sync --no-dev --frozen
|
|
|
|
# Stage 2: runtime image for API and migration job commands.
|
|
FROM python:3.12-slim AS runtime
|
|
|
|
WORKDIR /app
|
|
COPY --from=builder /app/.venv /app/.venv
|
|
COPY --from=builder /app/src /app/src
|
|
COPY --from=builder /app/alembic.ini /app/alembic.ini
|
|
COPY --from=builder /app/migrations /app/migrations
|
|
COPY --from=builder /app/scripts /app/scripts
|
|
|
|
ENV PATH="/app/.venv/bin:$PATH"
|
|
ENV PYTHONPATH="/app/src"
|
|
ENV CORE_HUB_ENV="staging"
|
|
ENV CORE_HUB_AUTO_CREATE_TABLES="0"
|
|
|
|
EXPOSE 8010
|
|
CMD ["uvicorn", "core_hub.app:app", "--host", "0.0.0.0", "--port", "8010"]
|