-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.prod
More file actions
46 lines (32 loc) · 1.05 KB
/
Dockerfile.prod
File metadata and controls
46 lines (32 loc) · 1.05 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
# Stage 1: Build frontend assets
FROM node:22-alpine AS frontend-build
WORKDIR /app
COPY package.json package-lock.json* ./
RUN npm install
COPY vite.config.js tailwind.config.js postcss.config.js ./
COPY frontend/ frontend/
COPY templates/ templates/
RUN npm run build
# Stage 2: Python application
FROM python:3.12-slim AS production
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
libpq-dev \
curl \
&& rm -rf /var/lib/apt/lists/*
# Install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy project
COPY . .
# Copy built frontend assets from stage 1
COPY --from=frontend-build /app/frontend/dist ./frontend/dist
# Collect static files
RUN DJANGO_SECRET_KEY=build-placeholder \
DATABASE_URL=sqlite:///tmp/build.db \
python manage.py collectstatic --noinput
EXPOSE 8000
CMD ["gunicorn", "config.wsgi:application", "--bind", "0.0.0.0:8000", "--workers", "3", "--timeout", "120"]