diff --git a/docker/alpine/Dockerfile b/docker/alpine/Dockerfile index ad6b58a..b9addcf 100644 --- a/docker/alpine/Dockerfile +++ b/docker/alpine/Dockerfile @@ -13,11 +13,11 @@ ENV global_dns="1.1.1.1" ENV enable="none" ENV isolate="wg0" ENV public_ip="0.0.0.0" -ENV update="yes" # Doing package management operations, such as upgrading RUN apk update \ - && apk add --no-cache bash git curl tzdata \ + && apk add --no-cache bash git tzdata \ + iptables ip6tables curl openrc wireguard-tools \ sudo py3-psutil py3-bcrypt # Using WGDASH -- like wg_net functionally as a ARG command. But it is needed in entrypoint.sh so it needs to be exported as environment variable. @@ -49,8 +49,8 @@ RUN echo "[Interface]" > /setup/conf/wg0.conf \ && echo "DNS = ${global_dns}" >> /setup/conf/wg0.conf # Defining a way for Docker to check the health of the container. In this case: checking the login URL. -HEALTHCHECK --interval=2m --timeout=1m --start-period=20s --retries=3 \ - CMD [ "$(curl -s -o /dev/null -w '%{http_code}' http://localhost:10086/)" -eq "200" ] || exit 1 +HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ + CMD sh -c 'pgrep gunicorn > /dev/null && pgrep tail > /dev/null' || exit 1 # Copy the basic entrypoint.sh script. diff --git a/docker/alpine/compose.yaml b/docker/alpine/compose.yaml index a921a23..ae26b90 100644 --- a/docker/alpine/compose.yaml +++ b/docker/alpine/compose.yaml @@ -1,6 +1,6 @@ services: wireguard-dashboard: - image: dselen/wgdashboard:dev + image: dselen:alpine restart: unless-stopped container_name: wgdashboard environment: diff --git a/src/wgd.sh b/src/wgd.sh index d27710f..9f89e0e 100755 --- a/src/wgd.sh +++ b/src/wgd.sh @@ -90,7 +90,7 @@ _installPython(){ fi ;; alpine) - { sudo apk update; sudo apk add python3 net-tools; printf "\n\n"; } >> ./log/install.txt + { sudo apk update; sudo apk add python3 net-tools --no-cache; printf "\n\n"; } >> ./log/install.txt ;; esac @@ -174,7 +174,7 @@ _installPythonPip(){ fi ;; alpine) - { sudo apk update; sudo apk add py3-pip ; printf "\n\n"; } >> ./log/install.txt + { sudo apk update; sudo apk add py3-pip --no-cache; printf "\n\n"; } >> ./log/install.txt ;; *) printf "[WGDashboard] %s Sorry, your OS is not supported. Currently the install script only support Debian-based, Red Hat-based OS. With experimental support for Alpine Linux.\n" "$heavy_crossmark" @@ -195,26 +195,25 @@ _installPythonPip(){ } _checkWireguard(){ - # Check if wg and wg-quick are installed if ! command -v wg > /dev/null 2>&1 || ! command -v wg-quick > /dev/null 2>&1 then case "$OS" in ubuntu|debian) { sudo apt update && sudo apt-get install -y wireguard; - printf "\nWireGuard installed on %s.\n\n" "$OS"; + printf "\n[WGDashboard] WireGuard installed on %s.\n\n" "$OS"; } &>> ./log/install.txt ;; centos|fedora|redhat|rhel) { sudo dnf install -y wireguard-tools; - printf "\nWireGuard installed on %s.\n\n" "$OS"; + printf "\n[WGDashboard] WireGuard installed on %s.\n\n" "$OS"; } &>> ./log/install.txt ;; alpine) { - sudo apk update && sudo apk add wireguard-tools; - printf "\nWireGuard installed on %s.\n\n" "$OS"; + sudo apk update && sudo apk add wireguard-tools --no-cache; + printf "\n[WGDashboard] WireGuard installed on %s.\n\n" "$OS"; } &>> ./log/install.txt ;; *) @@ -224,7 +223,7 @@ _checkWireguard(){ ;; esac else - printf "WireGuard is already installed.\n" + printf "[WGDashboard] WireGuard is already installed.\n" fi } @@ -413,7 +412,7 @@ if [ "$#" != 1 ]; printf "%s\n" "$dashes" printf "[WGDashboard] WGDashboard is already running.\n" printf "%s\n" "$dashes" - else + else start_wgd fi elif [ "$1" = "stop" ]; then