-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
68 lines (56 loc) · 2.26 KB
/
Dockerfile
File metadata and controls
68 lines (56 loc) · 2.26 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# ==============================
# 1. Build React frontends
# ==============================
FROM node:20 AS frontend
WORKDIR /app
# ------------------------------
# SCADA frontend
# ------------------------------
WORKDIR /app/openscada_lite/web/scada/static/frontend
COPY openscada_lite/web/scada/static/frontend/package*.json ./
RUN npm install
COPY openscada_lite/web/scada/static/frontend/ ./
COPY openscada_lite/web/login ./node_modules/login
RUN npm run build
# ------------------------------
# Config Editor frontend
# ------------------------------
WORKDIR /app/openscada_lite/web/config_editor/static/frontend
COPY openscada_lite/web/config_editor/static/frontend/package*.json ./
RUN npm install
COPY openscada_lite/web/config_editor/static/frontend/ ./
COPY openscada_lite/web/login ./node_modules/login
RUN npm run build
# ------------------------------
# Security Editor frontend
# ------------------------------
WORKDIR /app/openscada_lite/web/security_editor/static/frontend
COPY openscada_lite/web/security_editor/static/frontend/package*.json ./
RUN npm install
COPY openscada_lite/web/security_editor/static/frontend/ ./
COPY openscada_lite/web/login ./node_modules/login
RUN npm run build
# ==============================
# 2. Python backend
# ==============================
FROM python:3.12-slim
WORKDIR /app
# Install OS dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential && \
rm -rf /var/lib/apt/lists/*
# Install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
RUN pip install gunicorn
# Copy backend + config + modules
COPY openscada_lite ./openscada_lite
COPY config ./config
# Copy built frontends from previous stage
COPY --from=frontend /app/openscada_lite/web/scada/static/frontend/dist ./openscada_lite/web/scada/static/frontend/dist
COPY --from=frontend /app/openscada_lite/web/config_editor/static/frontend/dist ./openscada_lite/web/config_editor/static/frontend/dist
COPY --from=frontend /app/openscada_lite/web/security_editor/static/frontend/dist ./openscada_lite/web/security_editor/static/frontend/dist
# Expose port (optional, Render uses $PORT)
EXPOSE 5443
# Start Flask via Gunicorn using Render $PORT
CMD ["gunicorn", "-b", "0.0.0.0:5443", "openscada_lite.app:app"]