41 lines
1.4 KiB
Docker
41 lines
1.4 KiB
Docker
# Stage 1: Builder
|
|
FROM python:3.11-slim-bookworm AS builder
|
|
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvbin/uv
|
|
|
|
WORKDIR /app
|
|
ENV UV_CACHE_DIR=/app/.cache/uv
|
|
|
|
COPY pyproject.toml uv.lock ./
|
|
COPY packages/common ./packages/common
|
|
COPY apps/pipeline-api ./apps/pipeline-api
|
|
|
|
# Create a VALID dummy for the other workspace member for validation
|
|
RUN mkdir -p apps/dashboard/dashboard && \
|
|
echo '[project]\nname = "dashboard"\nversion = "0.1.0"\n[build-system]\nrequires = ["hatchling"]\nbuild-backend = "hatchling.build"' > apps/dashboard/pyproject.toml
|
|
|
|
# Install dependencies into the virtualenv
|
|
RUN /uvbin/uv sync --frozen --no-dev --package pipeline_api
|
|
|
|
# Stage 2: Final
|
|
FROM python:3.11-slim-bookworm
|
|
WORKDIR /app
|
|
|
|
# Copy project configuration for uv run
|
|
COPY pyproject.toml uv.lock ./
|
|
|
|
# Copy only necessary parts from builder
|
|
COPY --from=builder /app/.venv /app/.venv
|
|
COPY --from=builder /app/packages/common /app/packages/common
|
|
COPY --from=builder /app/apps/pipeline-api /app/apps/pipeline-api
|
|
COPY --from=builder /uvbin/uv /usr/local/bin/uv
|
|
COPY scripts ./scripts
|
|
|
|
# Create output directory with proper permissions
|
|
RUN mkdir -p output && chmod -R 777 output
|
|
|
|
ENV PYTHONPATH=/app/apps/pipeline-api
|
|
ENV INTERVAL=3600
|
|
ENV PATH="/app/.venv/bin:$PATH"
|
|
|
|
# --no-sync is required as we don't have the uv cache in the final image
|
|
CMD ["uv", "run", "--frozen", "--no-sync", "--package", "pipeline_api", "python", "-m", "pipeline_api.main", "run"]
|