-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
69 lines (57 loc) · 2.17 KB
/
Dockerfile
File metadata and controls
69 lines (57 loc) · 2.17 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
69
# ==============================
# 1. Build React frontends
# ==============================
FROM node:20 AS frontend
WORKDIR /app
# Make login module available
COPY src/openscada_lite/web/login /app/openscada_lite/web/login
COPY src/openscada_lite/web/lib /app/openscada_lite/web/lib
#
# SCADA frontend
#
WORKDIR /app/openscada_lite/web/scada/static/frontend
COPY src/openscada_lite/web/scada/static/frontend/package*.json ./
RUN npm install
COPY src/openscada_lite/web/scada/static/frontend/ ./
RUN npm run build
#
# Config Editor frontend
#
WORKDIR /app/openscada_lite/web/config_editor/static/frontend
COPY src/openscada_lite/web/config_editor/static/frontend/package*.json ./
RUN npm install
COPY src/openscada_lite/web/config_editor/static/frontend/ ./
RUN npm run build
#
# Security Editor frontend
#
WORKDIR /app/openscada_lite/web/security_editor/static/frontend
COPY src/openscada_lite/web/security_editor/static/frontend/package*.json ./
RUN npm install
COPY src/openscada_lite/web/security_editor/static/frontend/ ./
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 src/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
ENV SCADA_CONFIG_PATH=/app/config
ENV LOGGING_CONFIG_PATH=/app/config/logging_config.json
CMD ["uvicorn", "openscada_lite.app:asgi_app", "--host", "0.0.0.0", "--port", "5443"]