-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.prod
More file actions
40 lines (30 loc) · 1.14 KB
/
Dockerfile.prod
File metadata and controls
40 lines (30 loc) · 1.14 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
# Stage 1: Build React SPA
FROM node:20-alpine AS frontend
WORKDIR /web
COPY web/package.json web/package-lock.json web/.npmrc ./
RUN npm ci
COPY web/ .
RUN npm run build
# Stage 2: Python app
FROM python:3.12-slim
WORKDIR /app
# System deps
RUN apt-get update && apt-get install -y --no-install-recommends \
libpq-dev gcc && \
rm -rf /var/lib/apt/lists/*
# Python deps — production only
COPY requirements/ requirements/
RUN pip install --no-cache-dir -r requirements/prod.txt
# Source baked in — no volume mounts
COPY src/ src/
# Copy built SPA from stage 1
COPY --from=frontend /web/dist /app/static/spa
ENV PYTHONUNBUFFERED=1
ENV PYTHONPATH=/app/src
ENV DJANGO_SETTINGS_MODULE=vtaskforge.settings.prod
ENV STATIC_ROOT=/app/staticfiles
# Collect static files (Django admin + any app statics)
# The SPA is served directly from /app/static/spa/ (not via collectstatic)
RUN python src/manage.py collectstatic --noinput 2>/dev/null || true
EXPOSE 8000
CMD ["gunicorn", "vtaskforge.wsgi:application", "--bind", "0.0.0.0:8000", "--workers", "2", "--worker-class", "gevent", "--worker-connections", "100", "--timeout", "120", "--chdir", "/app/src"]