This commit is contained in:
heiye1024 2024-09-19 14:36:02 +08:00 committed by GitHub
commit 16db3adb12
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 49 additions and 0 deletions

29
src/Dockerfile Executable file
View file

@ -0,0 +1,29 @@
FROM python:3.10.2-alpine3.15 as base
RUN apk --update-cache upgrade && apk add --no-cache gcc g++ libffi-dev jpeg-dev zlib-dev libjpeg wireguard-tools iptables ip6tables inotify-tools \
&& rm -rf /var/cache/apk/*
RUN mkdir -p /etc/wireguard/
# configure wireguard
RUN wg genkey | tee /etc/wireguard/privatekey | wg pubkey | tee /etc/wireguard/publick
RUN cd /etc/wireguard/ && echo "[Interface]" >> wg0.conf && echo -n "PrivateKey = " >> wg0.conf && cat privatekey >> wg0.conf \
&& echo "ListenPort = 51820" >> wg0.conf && echo "Address = 10.1.1.1/32" >> wg0.conf && chmod 700 wg0.conf
COPY requirements.txt /opt/wgdashboard/
RUN pip3 install -r /opt/wgdashboard/requirements.txt --no-cache-dir
FROM base
COPY . /opt/WGDashboard/src
WORKDIR /opt/WGDashboard/src
EXPOSE 10086
EXPOSE 51820/udp

20
src/docker-compose.yaml Normal file
View file

@ -0,0 +1,20 @@
version: "3.7"
services:
web:
build:
context: .
container_name: WGDashboard
cap_add:
- NET_ADMIN
- SYS_MODULE
command: python dashboard.py
#command: gunicorn --bind 0.0.0.0:10086 dashboard:app
restart: unless-stopped
volumes:
- ./dashboard.py:/opt/WGDashboard/src/dashboard.py:rw
ports:
- 10086:10086
- 51820:51820/udp
sysctls:
- net.ipv4.conf.all.src_valid_mark=1