-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
58 lines (45 loc) · 1.87 KB
/
Copy pathDockerfile
File metadata and controls
58 lines (45 loc) · 1.87 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# ── Stage 1: Build the React frontend ──────────────────────────────
# Pin to the build host platform so npm ci never runs under QEMU.
# The output is static HTML/JS/CSS and is platform-independent.
FROM --platform=$BUILDPLATFORM node:25-alpine AS frontend-build
WORKDIR /build
COPY frontend/package.json frontend/package-lock.json ./
RUN npm ci
COPY frontend/ ./
# Auth env vars are baked into the frontend at build time.
# Pass these as --build-arg when building for production.
ARG VITE_CLIENT_ID=""
ARG VITE_TENANT_ID=""
ARG VITE_API_SCOPE=""
ARG VITE_AUTHORITY=""
# Build metadata — injected by CI/CD or docker build.
ARG VITE_BUILD_COMMIT=""
ARG VITE_BUILD_TAG=""
ARG VITE_BUILD_BRANCH=""
ARG VITE_BUILD_TIME=""
RUN npm run build
# ── Stage 2: Python runtime with FastAPI + built frontend ─────────
FROM python:3.14-slim AS runtime
WORKDIR /app
# Install uv for fast dependency resolution
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
# Install Python dependencies
COPY pyproject.toml uv.lock* ./
RUN uv sync --frozen --no-dev --no-install-project 2>/dev/null || uv sync --no-dev --no-install-project
# Copy application code
COPY app/ app/
COPY resources/ resources/
COPY base_data_import/ base_data_import/
# Copy Alembic configuration and migrations
COPY alembic.ini ./
COPY alembic/ alembic/
# Copy built frontend into the static directory
COPY --from=frontend-build /build/dist static/
# Create a directory for the SQLite database (used when DATABASE_URL is not set)
RUN mkdir -p /data
# Database configuration:
# - Set DATABASE_URL for PostgreSQL (e.g. postgresql://user:pass@host/db)
# - Falls back to SQLite at DATABASE_PATH when DATABASE_URL is not set
ENV DATABASE_PATH=/data/app.db
EXPOSE 8000
CMD ["uv", "run", "uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]