forked from mirrors/easyappointments
34 lines
1,004 B
Bash
Executable file
34 lines
1,004 B
Bash
Executable file
#!/bin/bash
|
|
|
|
# Nginx Docker Localtest
|
|
|
|
CONT_NAME="IFLRANDEVU_NGINX_LOCALTEST" # nginx docker name
|
|
MOUNT_PATH="/source" # binded mount path in nginx docker
|
|
FILE_NAME="nginx_docker_localtest.sh" # name of the *this* file
|
|
|
|
_RED='\033[0;31m'
|
|
_NC='\033[0m \e[0m' # No Color, No Effect
|
|
if [[ $1 != "docker" ]]; then
|
|
if [[ $(pwd) != *iflrandevu ]]; then
|
|
echo "PLEASE CHANGE DIRECTORY TO \`iflrandevu/\` BEFORE STARTING SCRIPT"
|
|
exit
|
|
fi
|
|
docker stop $CONT_NAME
|
|
docker rm $CONT_NAME
|
|
echo "removed"
|
|
|
|
docker run -it -d --name "$CONT_NAME" --mount type=bind,source=".",target=/source/,readonly --publish 8000:80 nginx bash
|
|
echo -e "RUN SCRIPT: \`${_RED}bash $MOUNT_PATH/nginx_docker_localtest.sh docker${_NC}\`"
|
|
docker attach $CONT_NAME --detach-keys="ctrl-k"
|
|
echo "EXIT"
|
|
exit
|
|
|
|
elif [[ $1 == "docker" ]]; then
|
|
apt update
|
|
apt install nano exa tree -y
|
|
cd /usr/share/nginx/html
|
|
rm -f "50x.html"
|
|
rm -f "index.html"
|
|
cp -r /source/build/ .
|
|
|
|
fi
|