-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
45 lines (34 loc) · 2.15 KB
/
Dockerfile
File metadata and controls
45 lines (34 loc) · 2.15 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
# ──────────────────────────────────────────────────────────────────────────────
# Dockerfile — zKill Activity Tracker (wrighttech/zcamp:latest)
# ──────────────────────────────────────────────────────────────────────────────
# Multi-stage build:
# Stage 1 (frontend): Node 22 — npm install + vite build → /app/dist
# Stage 2 (runtime): Python 3.12 — FastAPI serves API + static frontend
# ──────────────────────────────────────────────────────────────────────────────
# ─── Stage 1: Build React frontend ──────────────────────────────────────────
FROM node:22-alpine AS frontend-build
WORKDIR /app
# Install deps first (cached layer)
COPY frontend/package.json frontend/package-lock.json* ./
RUN npm install
# Copy frontend source and build
COPY frontend/ .
RUN npm run build
# ─── Stage 2: Python runtime ────────────────────────────────────────────────
FROM python:3.12-slim
WORKDIR /app
# Install Python dependencies (cached layer)
COPY backend/requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy backend source
COPY backend/server.py .
COPY backend/activity_manager.py .
COPY backend/constants.py .
# Copy built frontend from stage 1
# server.py serves this via StaticFiles(directory="frontend/dist", html=True)
COPY --from=frontend-build /app/dist ./frontend/dist
# Default port — matches the old Node.js image
EXPOSE 8080
# Run with uvicorn
# PORT can be overridden via environment variable
CMD ["sh", "-c", "uvicorn server:app --host 0.0.0.0 --port ${PORT:-8080} --log-level info"]