1
0
mirror of https://github.com/donaldzou/WGDashboard.git synced 2024-11-22 15:20:09 +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"
# 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_port="51820"
@ -19,7 +19,7 @@ ENV update="yes"
RUN apk update \
&& apk add --no-cache bash git curl tzdata \
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.
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.
# 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}
#&& git clone ${Git_Url} /setup/app
COPY src /setup/app/src
RUN mkdir -p /setup/conf && mkdir /setup/app && mkdir ${WGDASH} \
&& git clone ${Git_Url} /setup/app
#COPY src /setup/app/src
# Set the volume to be used for WireGuard configuration persistency.
VOLUME /etc/wireguard

View File

@ -91,11 +91,11 @@ set_envvars() {
printf "\n------------- SETTING ENVIRONMENT VARIABLES ----------------\n"
# 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."
ln -sf /usr/share/zoneinfo/"${TZ}" /etc/localtime
echo "${TZ}" > /etc/timezone
ln -sf /usr/share/zoneinfo/"${tz}" /etc/localtime
echo "${tz}" > /etc/timezone
else
echo "Timezone is set correctly."
fi

View File

@ -199,25 +199,25 @@ _checkWireguard(){
if [ ! wg -h > /dev/null 2>&1 ] || [ ! wg-quick -h > /dev/null 2>&1 ]
then
case "$OS" in
ubuntu|debian)
{ sudo apt update ; sudo apt-get install -y wireguard; printf "\n\n"; } &>> ./log/install.txt
;;
#centos|fedora|redhat|rhel)
# if [ "$pythonExecutable" = "python3" ]; then
# { sudo dnf install -y python3-pip; printf "\n\n"; } >> ./log/install.txt
# else
# { sudo dnf install -y ${pythonExecutable}-pip; printf "\n\n"; } >> ./log/install.txt
# fi
#;;
alpine)
{ sudo apk update; sudo apk add wireguard-tools ; 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
ubuntu|debian)
{ sudo apt update ; sudo apt-get install -y wireguard; printf "\n\n"; } &>> ./log/install.txt
;;
#centos|fedora|redhat|rhel)
# if [ "$pythonExecutable" = "python3" ]; then
# { sudo dnf install -y python3-pip; printf "\n\n"; } >> ./log/install.txt
# else
# { sudo dnf install -y ${pythonExecutable}-pip; printf "\n\n"; } >> ./log/install.txt
# fi
#;;
alpine)
{ sudo apk update; sudo apk add wireguard-tools ; 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
fi
}
@ -280,7 +280,24 @@ install_wgd(){
printf "[WGDashboard] Upgrading Python Package Manage (PIP)\n"
{ date; python3 -m pip install --upgrade pip; printf "\n\n"; } >> ./log/install.txt
printf "[WGDashboard] Installing latest Python dependencies\n"
{ date; python3 -m pip install -r requirements.txt ; printf "\n\n"; } >> ./log/install.txt
printf "$OS"
case "$OS" in
ubuntu|debian)
echo "Lol"
{ 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] Enter ./wgd.sh start to start the dashboard\n"
}