-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
40 lines (30 loc) · 907 Bytes
/
Dockerfile
File metadata and controls
40 lines (30 loc) · 907 Bytes
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
# ============================
# 1) FRONTEND BUILD STAGE
# ============================
FROM node:18 AS frontend
WORKDIR /frontend
COPY frontend/package.json frontend/package-lock.json ./
RUN npm install
COPY frontend/ .
RUN npm run build # <--- creates /frontend/dist/
# ============================
# 2) BACKEND BUILD STAGE
# ============================
FROM python:3.13-slim
RUN apt-get update && apt-get install -y \
build-essential \
curl \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Install backend requirements
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy backend code
COPY . .
# Copy the built frontend into /app/frontend/dist
COPY --from=frontend /frontend/dist ./frontend/dist
# Expose port
ENV PORT=8080
EXPOSE 8080
# Start FastAPI
CMD ["sh", "-c", "gunicorn -w 4 -k uvicorn.workers.UvicornWorker main:app --bind 0.0.0.0:${PORT}"]