-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdockerfile
More file actions
49 lines (34 loc) · 1.12 KB
/
dockerfile
File metadata and controls
49 lines (34 loc) · 1.12 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
47
48
49
# ============================
# 1) Frontend Build Stage
# ============================
FROM node:20-alpine AS frontend-builder
WORKDIR /app
# Copy package.json + lock file first for better caching
COPY package*.json ./
# Install node dependencies
RUN npm install
# Copy the rest of the frontend source
COPY . .
# Build frontend using Webpack (creates /dist folder)
RUN npm run build
# ============================
# 2) Backend Build Stage
# ============================
FROM python:3.12-slim AS backend
WORKDIR /app
# Install system deps if Tornado or your code needs them
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# Copy Python requirements (create requirements.txt if not already present)
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy backend code
COPY . .
# Copy compiled frontend from stage 1 into backend static path
# Adjust the path if your Tornado static directory differs
COPY --from=frontend-builder /app/dist ./static/
# Expose your Tornado port
EXPOSE 5061
# Run Tornado
CMD ["python", "main.py"]