From 00ae957b278c4b3340a2024616d0af1ae530c512 Mon Sep 17 00:00:00 2001 From: Hui Lan Date: Thu, 10 Aug 2023 10:47:57 +0800 Subject: [PATCH] Try to figure out how to rebuild the image after updating the source code. --- Dockerfile | 5 +++-- app/templates/login.html | 2 +- build.sh | 6 +++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4a45c45..9ff75dc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,5 @@ -FROM tiangolo/uwsgi-nginx-flask:python3.8 +FROM tiangolo/uwsgi-nginx-flask:python3.8-alpine COPY requirements.txt /app +RUN pip3 install -U pip RUN pip3 install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/ -COPY ./app /app +COPY ./app/ /app/ diff --git a/app/templates/login.html b/app/templates/login.html index 3f118ec..81f7e0e 100644 --- a/app/templates/login.html +++ b/app/templates/login.html @@ -39,7 +39,7 @@ 注册 - + {% endif %} diff --git a/build.sh b/build.sh index 7420632..c86c07b 100755 --- a/build.sh +++ b/build.sh @@ -2,17 +2,17 @@ DEPLOYMENT_DIR=/home/lanhui/englishpal2/EnglishPal cd $DEPLOYMENT_DIR - +pwd # Install dependencies -pip3 install -r requirements.txt +#pip3 install -r requirements.txt # Stop service sudo docker stop EnglishPal sudo docker rm EnglishPal # Rebuild container. Run this after modifying the source code. -sudo docker build -t englishpal --no-cache . +sudo docker build -t englishpal . # Run the application sudo docker run --restart=always -d --name EnglishPal -p 90:80 -v ${DEPLOYMENT_DIR}/app/static/frequency:/app/static/frequency --mount type=volume,src=englishpal-db,target=/app -t englishpal # for permanently saving data