forked from mirrors/easyappointments
feat: local test with nginx docker
This commit is contained in:
parent
a8bb2d0dc9
commit
56531810b7
1 changed files with 34 additions and 0 deletions
34
nginx_docker_localtest.sh
Executable file
34
nginx_docker_localtest.sh
Executable file
|
@ -0,0 +1,34 @@
|
||||||
|
#!/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
|
Loading…
Reference in a new issue