forked from Om-5640/InternPilot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
39 lines (29 loc) · 1017 Bytes
/
Copy pathDockerfile
File metadata and controls
39 lines (29 loc) · 1017 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# ---- Build stage: install Python dependencies ----
FROM python:3.12-slim AS builder
WORKDIR /app
ENV UV_LINK_MODE=copy \
UV_COMPILE_BYTECODE=1 \
PYTHONDONTWRITEBYTECODE=1
# Install uv
RUN pip install --no-cache-dir uv==0.5.26
# Install only production deps, frozen from uv.lock
COPY pyproject.toml uv.lock ./
RUN uv sync --frozen --no-dev --no-cache
# ---- Runtime stage ----
FROM python:3.12-slim AS runtime
WORKDIR /app
# Copy the virtual env from builder (avoids re-installing in runtime)
COPY --from=builder /app/.venv /app/.venv
ENV PATH="/app/.venv/bin:$PATH" \
PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1
# Copy application code
COPY app/ ./app/
COPY alembic/ ./alembic/
COPY alembic.ini ./
COPY scripts/start.sh ./scripts/start.sh
RUN chmod +x ./scripts/start.sh
EXPOSE 8000
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8000/api/health')"
CMD ["./scripts/start.sh"]