mirror of
https://github.com/donaldzou/WGDashboard.git
synced 2024-11-22 15:20:09 +01:00
Removed copy step in entrypoint.sh
Tested updating, works as long as presistent files are compatible.
This commit is contained in:
parent
4902b5f351
commit
ba5ba2f1d6
12
Dockerfile
12
Dockerfile
@ -24,11 +24,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 \
|
RUN mkdir -p /data/conf \
|
||||||
&& mkdir /setup/app \
|
&& mkdir -p ${WGDASH}/src
|
||||||
&& mkdir ${WGDASH} \
|
COPY ./src ${WGDASH}/src
|
||||||
&& mkdir /data
|
|
||||||
COPY ./src /setup/app/src
|
|
||||||
|
|
||||||
# Set the volume to be used for WireGuard configuration persistency. Can be ignored so it does not create volumes when not specified.
|
# Set the volume to be used for WireGuard configuration persistency. Can be ignored so it does not create volumes when not specified.
|
||||||
#VOLUME /etc/wireguard
|
#VOLUME /etc/wireguard
|
||||||
@ -47,8 +45,8 @@ PreDown = iptables -t nat -D POSTROUTING -s ${wg_net}/24 -o ${out_adapt} -j MASQ
|
|||||||
PreDown = iptables -D FORWARD -i wg0 -o wg0 -j DROP\n\
|
PreDown = iptables -D FORWARD -i wg0 -o wg0 -j DROP\n\
|
||||||
ListenPort = ${wg_port}\n\
|
ListenPort = ${wg_port}\n\
|
||||||
SaveConfig = true\n\
|
SaveConfig = true\n\
|
||||||
DNS = ${global_dns}" > /setup/conf/wg0.conf \
|
DNS = ${global_dns}" > /data/conf/wg0.conf \
|
||||||
&& chmod 600 /setup/conf/wg0.conf
|
&& chmod 600 /data/conf/wg0.conf
|
||||||
|
|
||||||
# Defining a way for Docker to check the health of the container. In this case: checking the login URL.
|
# Defining a way for Docker to check the health of the container. In this case: checking the login URL.
|
||||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
||||||
|
@ -5,13 +5,7 @@ echo "Starting the WireGuard Dashboard Docker container."
|
|||||||
|
|
||||||
ensure_installation() {
|
ensure_installation() {
|
||||||
# When using a custom directory to store the files, this part moves over and makes sure the installation continues.
|
# When using a custom directory to store the files, this part moves over and makes sure the installation continues.
|
||||||
echo "Checking if everything is present."
|
echo "Quick-installing..."
|
||||||
|
|
||||||
if [ -z "$(ls -A "${WGDASH}")" ]; then # [ ! -f "/data/wg-dashboard.ini" ] && [ ! -d "/data/db" ]
|
|
||||||
echo "Detected empty directory, moving over..."
|
|
||||||
|
|
||||||
# Moving over source files. (This does not include src/db and src/wg-dashboard.ini folder and file.)
|
|
||||||
mv -v /setup/app/* "${WGDASH}"
|
|
||||||
|
|
||||||
[ ! -d "/data/db" ] && echo "Creating database dir" && mkdir /data/db
|
[ ! -d "/data/db" ] && echo "Creating database dir" && mkdir /data/db
|
||||||
ln -s /data/db "${WGDASH}/src/db"
|
ln -s /data/db "${WGDASH}/src/db"
|
||||||
@ -19,7 +13,6 @@ ensure_installation() {
|
|||||||
[ ! -f "/data/wg-dashboard.ini" ] && echo "Creating wg-dashboard.ini file" && touch /data/wg-dashboard.ini
|
[ ! -f "/data/wg-dashboard.ini" ] && echo "Creating wg-dashboard.ini file" && touch /data/wg-dashboard.ini
|
||||||
ln -s /data/wg-dashboard.ini "${WGDASH}/src/wg-dashboard.ini"
|
ln -s /data/wg-dashboard.ini "${WGDASH}/src/wg-dashboard.ini"
|
||||||
|
|
||||||
|
|
||||||
python3 -m venv "${WGDASH}"/src/venv
|
python3 -m venv "${WGDASH}"/src/venv
|
||||||
. "${WGDASH}/src/venv/bin/activate"
|
. "${WGDASH}/src/venv/bin/activate"
|
||||||
|
|
||||||
@ -30,17 +23,14 @@ ensure_installation() {
|
|||||||
cd "${WGDASH}"/src || exit
|
cd "${WGDASH}"/src || exit
|
||||||
./wgd.sh install
|
./wgd.sh install
|
||||||
|
|
||||||
echo "Looks like the installation succesfully moved over."
|
echo "Looks like the installation succeeded."
|
||||||
else
|
|
||||||
echo "Looks like everything is present. Or the directory is not empty."
|
|
||||||
fi
|
|
||||||
|
|
||||||
# This first step is to ensure the wg0.conf file exists, and if not, then its copied over from the ephemeral container storage.
|
# This first step is to ensure the wg0.conf file exists, and if not, then its copied over from the ephemeral container storage.
|
||||||
# This is done so WGDashboard it works out of the box
|
# This is done so WGDashboard it works out of the box
|
||||||
|
|
||||||
if [ ! -f "/etc/wireguard/wg0.conf" ]; then
|
if [ ! -f "/etc/wireguard/wg0.conf" ]; then
|
||||||
echo "Standard wg0 Configuration file not found, grabbing template."
|
echo "Standard wg0 Configuration file not found, grabbing template."
|
||||||
cp -a "/setup/conf/wg0.conf" "/etc/wireguard/wg0.conf"
|
cp -a "/data/conf/wg0.conf" "/etc/wireguard/wg0.conf"
|
||||||
|
|
||||||
echo "Setting a secure private key." # SORRY 4 BE4 - Daan
|
echo "Setting a secure private key." # SORRY 4 BE4 - Daan
|
||||||
|
|
||||||
@ -89,7 +79,6 @@ clean_up() {
|
|||||||
echo "Removed unneeded logs!"
|
echo "Removed unneeded logs!"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
set_envvars() {
|
set_envvars() {
|
||||||
printf "\n------------- SETTING ENVIRONMENT VARIABLES ----------------\n"
|
printf "\n------------- SETTING ENVIRONMENT VARIABLES ----------------\n"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user