-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
41 lines (28 loc) · 965 Bytes
/
Dockerfile
File metadata and controls
41 lines (28 loc) · 965 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
40
41
# syntax=docker/dockerfile:1
# --- Builder stage: install dependencies with uv ---
FROM python:3.12-slim AS builder
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
ENV UV_COMPILE_BYTECODE=1 \
UV_LINK_MODE=copy
WORKDIR /app
# Install dependencies first (cache-friendly layer ordering)
COPY pyproject.toml uv.lock ./
RUN uv sync --frozen --no-dev --no-install-project
# Install the project itself
COPY src/ src/
COPY README.md ./
RUN uv sync --frozen --no-dev --no-editable
# --- Runtime stage: minimal image ---
FROM python:3.12-slim
WORKDIR /app
# Copy the virtual environment from the builder
COPY --from=builder /app/.venv /app/.venv
# Put the venv on PATH
ENV PATH="/app/.venv/bin:$PATH" \
PYTHONUNBUFFERED=1
# Non-root user
RUN groupadd --system app && useradd --system --gid app app
USER app
EXPOSE 8000
# Railway sets PORT; fall back to 8000 for local use
CMD uvicorn atdata_app.main:app --host 0.0.0.0 --port ${PORT:-8000}