build.sh: use a variable DEPLOYMENT_DIR to represent the code folder

Deployment
Lan Hui 2022-02-07 13:56:14 +08:00
parent 2a92881581
commit 8647af3158
1 changed files with 3 additions and 4 deletions

View File

@ -1,6 +1,7 @@
#!/bin/sh #!/bin/sh
cd /home/lanhui/englishpal2/EnglishPal DEPLOYMENT_DIR=/home/lanhui/EnglishPal
cd $DEPLOYMENT_DIR
# Stop service # Stop service
sudo docker stop EnglishPal sudo docker stop EnglishPal
@ -10,9 +11,7 @@ sudo docker rm EnglishPal
sudo docker build -t englishpal . sudo docker build -t englishpal .
# Run the application # Run the application
sudo docker run -d --name EnglishPal -p 90:80 -v /home/lanhui/englishpal2/EnglishPal/app/static/frequency:/app/static/frequency -v /home/lanhui/englishpal2/EnglishPal/app/static/:/app/static/ -t englishpal # for permanently saving data sudo docker run -d --name EnglishPal -p 90:80 -v ${DEPLOYMENT_DIR}/app/static/frequency:/app/static/frequency -v ${DEPLOYMENT_DIR}/app/static/:/app/static/ -t englishpal # for permanently saving data
# Save space. Run it after sudo docker run # Save space. Run it after sudo docker run
sudo docker system prune -a -f sudo docker system prune -a -f