-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
69 lines (54 loc) · 1.71 KB
/
Dockerfile
File metadata and controls
69 lines (54 loc) · 1.71 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
# ------------------------------
# QuantumGuard Production Dockerfile
# ------------------------------
# ------------------------------
# Stage 1: Build Python dependencies
# ------------------------------
FROM python:3.11-slim AS build
# Set working directory
WORKDIR /app
# Install build dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential git libffi-dev libssl-dev pkg-config && \
rm -rf /var/lib/apt/lists/*
# Copy requirements file
COPY requirements.txt .
# Create virtual environment and install Python dependencies
RUN python -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
RUN pip install --upgrade pip
RUN pip install --no-cache-dir -r requirements.txt
# ------------------------------
# Stage 2: Runtime image
# ------------------------------
FROM python:3.11-slim AS runtime
# Set working directory
WORKDIR /app
# Copy installed packages from build stage
COPY --from=build /opt/venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
# Copy application code
COPY app/ ./app/
COPY simulator/ ./simulator/
COPY scanner/ ./scanner/
COPY scripts/ ./scripts/
COPY hardening/ ./hardening/
COPY terraform/ ./terraform/
COPY k8s/ ./k8s/
COPY utils.py ./
COPY self_learning.py ./
COPY quantumguard.py ./
# Copy the dashboard folder (make sure this exists in repo root!)
COPY dashboard/ ./dashboard/
# Expose Flask port
EXPOSE 5000
# Create a non-root user for security
RUN useradd -m quantumguard
USER quantumguard
# Install Gunicorn for production Flask server
RUN pip install gunicorn
# Set Flask app environment variables
ENV FLASK_APP=dashboard/app.py
ENV FLASK_ENV=production
# Start Flask app with Gunicorn
CMD ["gunicorn", "--workers", "3", "--bind", "0.0.0.0:5000", "dashboard.app:app"]