1
0
mirror of https://github.com/donaldzou/WGDashboard.git synced 2024-11-06 07:50:13 +01:00
This commit is contained in:
Dselen 2024-08-23 11:58:14 -05:00
parent d6801966c4
commit 3012619049
3 changed files with 45 additions and 28 deletions

View File

@ -3,7 +3,7 @@ FROM alpine:latest AS build
LABEL maintainer="dselen@nerthus.nl" LABEL maintainer="dselen@nerthus.nl"
# Declaring environment variables, change Peernet to an address you like, standard is a 24 bit subnet. # Declaring environment variables, change Peernet to an address you like, standard is a 24 bit subnet.
ARG Git_Url="https://github.com/donaldzou/WGDashboard.git" ARG Git_Url="https://github.com/DaanSelen/WGDashboard.git"
ARG wg_net="10.0.0.1" ARG wg_net="10.0.0.1"
ARG wg_port="51820" ARG wg_port="51820"
@ -19,7 +19,7 @@ ENV update="yes"
RUN apk update \ RUN apk update \
&& apk add --no-cache bash git curl tzdata \ && apk add --no-cache bash git curl tzdata \
wireguard-tools sudo \ wireguard-tools sudo \
gcc py3-pip python3-dev musl-dev linux-headers py3-pip python3-dev
# 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. # 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.
ENV WGDASH=/opt/wireguarddashboard ENV WGDASH=/opt/wireguarddashboard
@ -27,9 +27,9 @@ ENV WGDASH=/opt/wireguarddashboard
# Removing the Linux Image package to preserve space on the image, for this reason also deleting apt lists, to be able to install packages: run apt update. # Removing the Linux Image package to preserve space on the image, for this reason also deleting apt lists, to be able to install packages: run apt update.
# Doing WireGuard Dashboard installation measures. Modify the git clone command to get the preferred version, with a specific branch for example. # Doing WireGuard Dashboard installation measures. Modify the git clone command to get the preferred version, with a specific branch for example.
RUN mkdir -p /setup/conf && mkdir /setup/app && mkdir ${WGDASH} RUN mkdir -p /setup/conf && mkdir /setup/app && mkdir ${WGDASH} \
#&& git clone ${Git_Url} /setup/app && git clone ${Git_Url} /setup/app
COPY src /setup/app/src #COPY src /setup/app/src
# Set the volume to be used for WireGuard configuration persistency. # Set the volume to be used for WireGuard configuration persistency.
VOLUME /etc/wireguard VOLUME /etc/wireguard

View File

@ -91,11 +91,11 @@ set_envvars() {
printf "\n------------- SETTING ENVIRONMENT VARIABLES ----------------\n" printf "\n------------- SETTING ENVIRONMENT VARIABLES ----------------\n"
# If the timezone is different, for example in North-America or Asia. # If the timezone is different, for example in North-America or Asia.
if [ "${TZ}" != "$(cat /etc/localtime)" ]; then if [ "${tz}" != "$(cat /etc/localtime)" ]; then
echo "Changing timezone." echo "Changing timezone."
ln -sf /usr/share/zoneinfo/"${TZ}" /etc/localtime ln -sf /usr/share/zoneinfo/"${tz}" /etc/localtime
echo "${TZ}" > /etc/timezone echo "${tz}" > /etc/timezone
else else
echo "Timezone is set correctly." echo "Timezone is set correctly."
fi fi

View File

@ -280,7 +280,24 @@ install_wgd(){
printf "[WGDashboard] Upgrading Python Package Manage (PIP)\n" printf "[WGDashboard] Upgrading Python Package Manage (PIP)\n"
{ date; python3 -m pip install --upgrade pip; printf "\n\n"; } >> ./log/install.txt { date; python3 -m pip install --upgrade pip; printf "\n\n"; } >> ./log/install.txt
printf "[WGDashboard] Installing latest Python dependencies\n" printf "[WGDashboard] Installing latest Python dependencies\n"
printf "$OS"
case "$OS" in
ubuntu|debian)
echo "Lol"
{ date; python3 -m pip install -r requirements.txt ; printf "\n\n"; } >> ./log/install.txt { date; python3 -m pip install -r requirements.txt ; printf "\n\n"; } >> ./log/install.txt
;;
## TO DO ADD RHEL and ROCKY SUPPORT
alpine)
printf "[WGDashboard] Grabbing Alpine dependencies.\n"
{ date; sudo apk add gcc python3-dev musl-dev linux-headers ; python3 -m pip install -r requirements.txt ; 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"
printf "%s\n" "$helpMsg"
kill $TOP_PID
;;
esac
printf "[WGDashboard] WGDashboard installed successfully!\n" printf "[WGDashboard] WGDashboard installed successfully!\n"
printf "[WGDashboard] Enter ./wgd.sh start to start the dashboard\n" printf "[WGDashboard] Enter ./wgd.sh start to start the dashboard\n"
} }