29 lines
891 B
Docker
29 lines
891 B
Docker
|
|
# ── Stage 1: Build React frontend ────────────────────────────────────────────
|
||
|
|
FROM node:18-alpine AS frontend-build
|
||
|
|
|
||
|
|
WORKDIR /app/frontend
|
||
|
|
COPY frontend/package*.json ./
|
||
|
|
RUN npm ci --silent
|
||
|
|
COPY frontend/ ./
|
||
|
|
RUN npm run build
|
||
|
|
|
||
|
|
# ── Stage 2: Flask + Gunicorn production image ────────────────────────────────
|
||
|
|
FROM python:3.12-slim
|
||
|
|
|
||
|
|
WORKDIR /app
|
||
|
|
|
||
|
|
COPY backend/requirements.txt ./
|
||
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
||
|
|
|
||
|
|
COPY backend/ ./
|
||
|
|
|
||
|
|
# Copy compiled React build into Flask static folder
|
||
|
|
COPY --from=frontend-build /app/frontend/dist ./app/static
|
||
|
|
|
||
|
|
# Persistent data directory for SQLite
|
||
|
|
RUN mkdir -p /app/data
|
||
|
|
|
||
|
|
EXPOSE 8080
|
||
|
|
|
||
|
|
CMD ["gunicorn", "--bind", "0.0.0.0:8080", "--workers", "2", "--timeout", "120", "run:app"]
|