Added Dockerfile use kernel version of AmneziaWG

This commit is contained in:
Donald Zou 2024-12-10 23:36:10 +08:00
parent e97c3a0807
commit 57b17848f9
2 changed files with 57 additions and 0 deletions

View File

@ -0,0 +1,27 @@
services:
wireguard-dashboard:
build:
context: .
dockerfile: Ubuntu.Dev.Kernel.Version.Dockerfile
#image: donaldzou/wgdashboard:latest
restart: unless-stopped
container_name: wgdashboard
#environment:
#- tz= # <--- Set container timezone, default: Europe/Amsterdam.
#- global_dns= # <--- Set global DNS address, default: 1.1.1.1.
#- isolate= # <--- Set the interfaces that will disallow peer communication, default: 'none'.
#- public_ip= # <--- Set public IP to ensure the correct one is chosen, defaulting to the IP give by ifconfig.me.
ports:
- 10086:10086/tcp
- 51820:51820/udp
volumes:
- conf:/etc/wireguard
- data:/data
cap_add:
- NET_ADMIN
devices:
- /dev/net/tun:/dev/net/tun
volumes:
conf:
data:

View File

@ -0,0 +1,30 @@
FROM ubuntu:jammy
WORKDIR /WGDashboard
ENV TZ=UTC
EXPOSE 10086
COPY ./src /WGDashboard/
RUN cp -f /etc/apt/sources.list /etc/apt/sources.list.backup && \
sed "s/# deb-src/deb-src/" /etc/apt/sources.list.backup > /etc/apt/sources.list && \
apt-get update -y && \
apt-get upgrade -y && \
apt-get install wireguard sudo python3 python3-venv python3-pip net-tools -y && \
apt install iproute2 -y && \
apt install -y software-properties-common python3-launchpadlib gnupg2 && add-apt-repository ppa:amnezia/ppa -y && \
sudo apt-get install -y amneziawg && \
mkdir -p /etc/amnezia/amneziawg
# Copy AmneziaWG binaries
COPY entrypoint.sh /WGDashboard/entrypoint.sh
# Install necessary tools and libraries in the final image
RUN chmod +x /WGDashboard/wgd.sh && chmod +x /WGDashboard/entrypoint.sh
RUN if [ ! -c /dev/net/tun ]; then \
mkdir -p /dev/net && mknod /dev/net/tun c 10 200; \
fi
RUN ./wgd.sh install
# Start the script and keep it alive by tailing the logs
CMD ["/bin/bash", "-c", "/WGDashboard/wgd.sh start && tail -f /dev/null"]