2025-04-03 17:01:19 -03:00
|
|
|
# Build stage: install build dependencies and Python packages
|
|
|
|
FROM python:3.12-slim AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
# Install build dependencies required for compiling C extensions
|
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
|
|
gcc \
|
|
|
|
build-essential \
|
|
|
|
librrd-dev \
|
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
|
# Copy requirements and install Python packages to a separate directory
|
|
|
|
COPY requirements.txt /app/
|
|
|
|
RUN pip install --prefix=/install --no-cache-dir -r requirements.txt
|
2024-02-14 16:36:01 -03:00
|
|
|
|
2025-04-03 17:01:19 -03:00
|
|
|
# Final stage: runtime image
|
|
|
|
FROM python:3.12-slim
|
2024-02-14 16:36:01 -03:00
|
|
|
WORKDIR /app
|
|
|
|
|
2025-04-03 17:01:19 -03:00
|
|
|
# Install necessary runtime packages
|
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
2024-02-14 16:36:01 -03:00
|
|
|
wireguard \
|
|
|
|
iptables \
|
|
|
|
iproute2 \
|
|
|
|
net-tools \
|
|
|
|
inetutils-ping \
|
|
|
|
inetutils-traceroute \
|
|
|
|
nano \
|
2024-02-16 11:59:03 -03:00
|
|
|
openssl \
|
2024-07-09 14:46:59 -03:00
|
|
|
dnsutils \
|
2025-02-21 13:57:24 -03:00
|
|
|
rrdtool \
|
2025-04-03 17:01:19 -03:00
|
|
|
procps \
|
2024-02-14 16:36:01 -03:00
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
2025-04-03 17:01:19 -03:00
|
|
|
# Copy installed Python packages from the builder stage
|
|
|
|
COPY --from=builder /install /usr/local
|
2024-02-14 16:36:01 -03:00
|
|
|
|
2025-04-03 17:01:19 -03:00
|
|
|
# Copy the application code
|
2024-02-14 16:36:01 -03:00
|
|
|
COPY . /app/
|
|
|
|
|
2025-04-03 17:01:19 -03:00
|
|
|
# Set execution permissions on scripts
|
|
|
|
RUN chmod +x /app/init.sh && chmod +x /app/entrypoint.sh
|
|
|
|
|
2024-02-16 11:59:03 -03:00
|
|
|
ARG SERVER_ADDRESS
|
|
|
|
ARG DEBUG_MODE
|
2024-02-14 16:36:01 -03:00
|
|
|
|
2025-04-03 17:01:19 -03:00
|
|
|
ENTRYPOINT ["/app/entrypoint.sh"]
|
2024-02-14 16:36:01 -03:00
|
|
|
CMD ["/app/init.sh"]
|