-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
37 lines (27 loc) · 1.4 KB
/
Copy pathDockerfile
File metadata and controls
37 lines (27 loc) · 1.4 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
# ── Stage 1: Build frontend ──────────────────────────────────────────────────
FROM node:22-alpine AS frontend-build
WORKDIR /build/frontend
COPY frontend/package.json frontend/package-lock.json ./
RUN npm ci
COPY frontend/ ./
RUN npm run build
# ── Stage 2: Python runtime ─────────────────────────────────────────────────
FROM python:3.13-slim
# Install curl for health checks
RUN apt-get update && apt-get install -y --no-install-recommends curl && rm -rf /var/lib/apt/lists/*
# Recreate the same directory layout the app expects:
# /app/backend/ ← working directory (main.py, routers/, etc.)
# /app/frontend/dist/ ← built SPA
# /app/data/ ← subtitles & translated (ephemeral)
WORKDIR /app/backend
COPY backend/requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
ENV SRT_ENV=production
COPY backend/ ./
COPY --from=frontend-build /build/frontend/dist /app/frontend/dist
# Pre-create data directories
RUN mkdir -p /app/data/subtitles /app/data/translated
EXPOSE 8000
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD curl -f http://localhost:8000/api/health || exit 1
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]