wireguard_webadmin/Dockerfile

49 lines
1.2 KiB
Docker
Raw Permalink Normal View History

# 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
# Final stage: runtime image
FROM python:3.12-slim
2024-02-14 16:36:01 -03:00
WORKDIR /app
# 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 \
openssl \
2024-07-09 14:46:59 -03:00
dnsutils \
rrdtool \
procps \
2024-02-14 16:36:01 -03:00
&& rm -rf /var/lib/apt/lists/*
# Copy installed Python packages from the builder stage
COPY --from=builder /install /usr/local
2024-02-14 16:36:01 -03:00
# Copy the application code
2024-02-14 16:36:01 -03:00
COPY . /app/
# Set execution permissions on scripts
RUN chmod +x /app/init.sh && chmod +x /app/entrypoint.sh
ARG SERVER_ADDRESS
ARG DEBUG_MODE
2024-02-14 16:36:01 -03:00
ENTRYPOINT ["/app/entrypoint.sh"]
2024-02-14 16:36:01 -03:00
CMD ["/app/init.sh"]