@cryptotaxi247 / CoPilot / commits / f1799842

Deb12 test (#522)

* Update Docker configuration for backend and frontend to use debian:12 and change branch trigger to deb12-test * Refactor Dockerfile to use multi-stage builds, optimize environment setup, and streamline dependency installation * Update Dockerfile to install dependencies inside virtual environment and streamline environment setup * Optimize Dockerfile for single-stage build, enhance environment setup, and streamline dependency installation with uv * Update Dockerfile to include libmagic1 and file dependencies for wkhtmltopdf * Remove commented-out Dockerfile instructions to clean up the file * Update workflow trigger branch from deb12-test to main

taylor_socfortress committed Oct 18, 2025 at 10:37 UTC f179984251a0d0869b68aeb3a9aa58fc48e7649e
1 file changed +96 -106
backend/Dockerfile
+96 -106
@@ -1,118 +1,108 @@
1 -FROM debian:11
1 +# ─────────────────────────────────────────────
2 +# SOCFortress CoPilot Backend – Single-Stage Build
3 +# Optimized with uv (Rust-based pip)
4 +# Compatible with Debian 12 / ARM64 / x86_64
5 +# ─────────────────────────────────────────────
6 +
7 +FROM debian:12
8 +
9 +# ───────────────
10 +# Core Environment
11 +# ───────────────
12 +ENV PYTHONDONTWRITEBYTECODE=1 \
13 + PYTHONUNBUFFERED=1 \
14 + PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python \
15 + UV_CACHE_DIR=/root/.cache/uv \
16 + PATH="/opt/venv/bin:$PATH"
17 +
18 +# ───────────────
19 +# System Dependencies
20 +# ───────────────
21 +RUN apt-get update && apt-get install -y \
22 + curl ca-certificates build-essential \
23 + python3.11 python3.11-venv python3.11-dev \
24 + libnss3 libatk-bridge2.0-0 libxkbcommon0 libgtk-3-0 libasound2 libx11-xcb1 \
25 + wkhtmltopdf libmagic1 file && \
26 + rm -rf /var/lib/apt/lists/*
27 +
28 +# ───────────────
29 +# Virtual Environment + uv
30 +# ───────────────
31 +RUN python3.11 -m venv /opt/venv && \
32 + curl -LsSf https://astral.sh/uv/install.sh | sh && \
33 + ln -s /root/.local/bin/uv /usr/local/bin/uv
34
3 -# Set environment variables
4 -ENV PYTHONDONTWRITEBYTECODE 1
5 -ENV PYTHONUNBUFFERED 1
6 -# Set environment variable to use pure-Python implementation
7 -ENV PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python
8 -
9 -# Update the package lists
10 -RUN apt-get update
11 -
12 -# Install necessary dependencies
13 -RUN apt-get install -y \
14 - apt-transport-https \
15 - ca-certificates \
16 - curl \
17 - gnupg \
18 - lsb-release
19 -
20 -# Add the deadsnakes PPA
21 -RUN echo "deb http://ppa.launchpad.net/deadsnakes/ppa/ubuntu focal main" | tee /etc/apt/sources.list.d/focal.list
22 -RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F23C5A6CF475977595C89F51BA6932366A755776
23 -
24 -# Update the package lists
25 -RUN apt-get update
26 -
27 -# Install Python 3.11, pip and venv
28 -RUN apt-get install -y python3.11 python3-pip python3.11-venv python3.11-dev
29 -
30 -# Create a Python virtual environment and activate it
31 -RUN python3.11 -m venv /opt/venv
32 -ENV PATH="/opt/venv/bin:$PATH"
33 -
34 -# Install setuptools
35 -RUN /opt/venv/bin/pip install setuptools
36 -
37 -# Install your application's dependencies
35 WORKDIR /opt/copilot/backend
39 -COPY requirements.txt ./
40 -RUN /opt/venv/bin/pip install --no-cache-dir -r requirements.txt
36
42 -# Install required browsers for playwright
43 -RUN playwright install-deps
44 -RUN playwright install
37 +# ───────────────
38 +# Install Dependencies
39 +# ───────────────
40 +COPY requirements.txt ./
41 +RUN uv pip install -r requirements.txt --no-cache
42
46 -# Install wkhtmltopdf
47 -RUN apt-get install -y wkhtmltopdf
43 +# ───────────────
44 +# Install Playwright Chromium
45 +# ───────────────
46 +RUN /opt/venv/bin/python -m playwright install-deps && \
47 + /opt/venv/bin/python -m playwright install chromium
48
49 -# Copy your application into the Docker image
50 -WORKDIR /opt/copilot/backend
49 +# ───────────────
50 +# Copy Application
51 +# ───────────────
52 COPY . .
52 -COPY wait-for-it.sh /usr/wait-for-it.sh
53 -RUN chmod +x /usr/wait-for-it.sh
54 -# Create file-store folder
55 -RUN mkdir file-store
53 +COPY wait-for-it.sh /usr/local/bin/wait-for-it.sh
54 +RUN chmod +x /usr/local/bin/wait-for-it.sh && mkdir -p file-store
55
57 -# Expose ports
56 +# ───────────────
57 +# Expose API Port
58 +# ───────────────
59 EXPOSE 5000
60
60 -ENV SERVER_IP=0.0.0.0
61 -
62 -# Connector Credentials
63 -# ! SETTING UP YOUR CONNECTORS DEMOs https://www.youtube.com/@taylorwalton_socfortress/videos! #
64 -ENV WAZUH_INDEXER_URL=https://1.1.1.1:9200
65 -ENV WAZUH_INDEXER_USERNAME=admin
66 -ENV WAZUH_INDEXER_PASSWORD=admin
67 -
68 -ENV WAZUH_MANAGER_URL=https://1.1.1.1
69 -ENV WAZUH_MANAGER_USERNAME=dummy
70 -ENV WAZUH_MANAGER_PASSWORD=dummy
71 -
72 -ENV GRAYLOG_URL=http://1.1.1.1
73 -ENV GRAYLOG_USERNAME=dummy
74 -ENV GRAYLOG_PASSWORD=dummy
75 -
76 -ENV SHUFFLE_URL=https://1.1.1.1
77 -ENV SHUFFLER_API_KEY=dummy
78 -
79 -ENV DFIR_IRIS_URL=https://1.1.1.1
80 -ENV DFIR_IRIS_API_KEY=dummy
81 -
82 -ENV VELOCIRAPTOR_URL=https://1.1.1.1
83 -ENV VELOCIRAPTOR_API_KEY_PATH=dummy
84 -
85 -ENV SUBLIME_URL=http://1.1.1.1
86 -ENV SUBLIME_API_KEY=dummy
87 -
88 -ENV INFLUXDB_URL=http://1.1.1.1
89 -ENV INFLUXDB_API_KEY=dummy
90 -ENV INFLUXDB_ORG_AND_BUCKET=dummy,dummy
91 -
92 -ENV ASKSOCFORTRESS_URL=https://knowledge.socfortress.co
93 -ENV ASKSOCFORTRESS_API_KEY=dummy
94 -
95 -ENV SOCFORTRESSTHREATINTEL_URL=https://intel.socfortress.co/search
96 -ENV SOCFORTRESSTHREATINTEL_API_KEY=dummy
97 -
98 -ENV CORTEX_URL=http://1.1.1.1
99 -ENV CORTEX_API_KEY=dummy
100 -
101 -ENV GRAFANA_URL=http://1.1.1.1
102 -ENV GRAFANA_USERNAME=dummy
103 -ENV GRAFANA_PASSWORD=dummy
104 -
105 -ENV WAZUH_WORKER_PROVISIONING_URL=http://1.1.1.1
106 -
107 -ENV EVENT_SHIPPER_URL=graylog_host
108 -ENV GELF_INPUT_PORT=gelf_port
109 -
110 -ENV ALERT_CREATION_PROVISIONING_URL=http://1.1.1.1
111 -
61 +# ───────────────
62 +# Runtime Environment
63 +# ───────────────
64 +ENV SERVER_IP=0.0.0.0 \
65 + WAZUH_INDEXER_URL=https://1.1.1.1:9200 \
66 + WAZUH_INDEXER_USERNAME=admin \
67 + WAZUH_INDEXER_PASSWORD=admin \
68 + WAZUH_MANAGER_URL=https://1.1.1.1 \
69 + WAZUH_MANAGER_USERNAME=dummy \
70 + WAZUH_MANAGER_PASSWORD=dummy \
71 + GRAYLOG_URL=http://1.1.1.1 \
72 + GRAYLOG_USERNAME=dummy \
73 + GRAYLOG_PASSWORD=dummy \
74 + SHUFFLE_URL=https://1.1.1.1 \
75 + SHUFFLER_API_KEY=dummy \
76 + DFIR_IRIS_URL=https://1.1.1.1 \
77 + DFIR_IRIS_API_KEY=dummy \
78 + VELOCIRAPTOR_URL=https://1.1.1.1 \
79 + VELOCIRAPTOR_API_KEY_PATH=dummy \
80 + SUBLIME_URL=http://1.1.1.1 \
81 + SUBLIME_API_KEY=dummy \
82 + INFLUXDB_URL=http://1.1.1.1 \
83 + INFLUXDB_API_KEY=dummy \
84 + INFLUXDB_ORG_AND_BUCKET=dummy,dummy \
85 + ASKSOCFORTRESS_URL=https://knowledge.socfortress.co \
86 + ASKSOCFORTRESS_API_KEY=dummy \
87 + SOCFORTRESSTHREATINTEL_URL=https://intel.socfortress.co/search \
88 + SOCFORTRESSTHREATINTEL_API_KEY=dummy \
89 + CORTEX_URL=http://1.1.1.1 \
90 + CORTEX_API_KEY=dummy \
91 + GRAFANA_URL=http://1.1.1.1 \
92 + GRAFANA_USERNAME=dummy \
93 + GRAFANA_PASSWORD=dummy \
94 + WAZUH_WORKER_PROVISIONING_URL=http://1.1.1.1 \
95 + EVENT_SHIPPER_URL=graylog_host \
96 + GELF_INPUT_PORT=gelf_port \
97 + ALERT_CREATION_PROVISIONING_URL=http://1.1.1.1
98 +
99 +# ───────────────
100 +# Optional Build ARG
101 +# ───────────────
102 ARG COPILOT_API_KEY
103 ENV COPILOT_API_KEY=$COPILOT_API_KEY
104
115 -# Run your application
116 -# CMD ["sh", "-c", "ls -la && /opt/venv/bin/python copilot.py"]
117 -# Use wait-for-it.sh to wait for the MySQL service to be ready before starting your application
118 -CMD ["/usr/wait-for-it.sh", "copilot-mysql:3306", "--", "/opt/venv/bin/python", "copilot.py"]
105 +# ───────────────
106 +# Start Application
107 +# ───────────────
108 +CMD ["wait-for-it.sh", "copilot-mysql:3306", "--", "python", "copilot.py"]