-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDockerfile
More file actions
67 lines (46 loc) · 1.51 KB
/
Copy pathDockerfile
File metadata and controls
67 lines (46 loc) · 1.51 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
# Frontend build stage
FROM node:22-alpine AS frontend-build
WORKDIR /frontend
COPY frontend/package*.json ./
RUN npm install
COPY frontend/ .
RUN npm run build
# Backend-only stage (for development without frontend/nginx)
FROM python:3.11-slim AS backend-dev
ENV APP_HOME=/app
ENV PYTHONPATH="$APP_HOME/core" \
PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1
WORKDIR $APP_HOME
COPY core/ ./core/
WORKDIR $APP_HOME/core
COPY core/requirements.txt ./requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
RUN mkdir -p /app/core/data/db/backups \
&& mkdir -p /app/core/data/policies \
&& mkdir -p /app/core/data/examples
EXPOSE 8001
CMD ["python", "-m", "edge_mining", "standard"]
# Runtime: Python backend + nginx
FROM python:3.11-slim
ENV APP_HOME=/app
ENV PYTHONPATH="$APP_HOME/core" \
PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1
WORKDIR $APP_HOME
# System dependencies (nginx + utilities)
RUN apt-get update && \
apt-get install -y --no-install-recommends nginx && \
rm -rf /var/lib/apt/lists/*
# Copy backend core and other necessary files
COPY core/ ./core/
COPY nginx.conf /etc/nginx/nginx.conf
# Install dependencies for the backend
WORKDIR $APP_HOME/core
COPY core/requirements.txt ./requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
# Copy frontend build into nginx
COPY --from=frontend-build /frontend/dist /usr/share/nginx/html
EXPOSE 80
# Run both nginx and the Python backend
CMD ["sh", "-c", "nginx -g 'daemon off;' & python -m edge_mining standard"]