Browse Source

Refactor paths in scripts

pull/1322/head
Johann Frei 3 years ago
parent
commit
4c192ca8c7
2 changed files with 11 additions and 11 deletions
  1. 18
      offline_deployment/offline_01_2-patch_and_extract_Docker_images.sh
  2. 4
      offline_deployment/offline_02_2-import_Docker_images.sh

18
offline_deployment/offline_01_2-patch_and_extract_Docker_images.sh

@ -8,32 +8,32 @@ unset DIR
echo "Patching docker-compose to match Ubuntu 18.04 compose package"
sed -i 's|version: "3.7"|version: "3.3"|g' ../docker-compose.prod.yml
sed -i 's^dockerfile: app/Dockerfile.prod^dockerfile: app/Dockerfile.prod\n image: doccano-app:custom^g' ../docker-compose.prod.yml
sed -i 's^dockerfile: backend/Dockerfile.prod^dockerfile: backend/Dockerfile.prod\n image: doccano-backend:custom^g' ../docker-compose.prod.yml
sed -i 's^dockerfile: nginx/Dockerfile^dockerfile: nginx/Dockerfile\n image: doccano-nginx:custom^g' ../docker-compose.prod.yml
# Modify Dockerfile for nginx to add python3 and offline patch
sed -i 's|FROM nginx|COPY offline_deployment/offline_patcher.py /patch.py\
RUN apk add -U --no-cache py3-requests \\\
\&\& mkdir -p /app/dist/offline \&\& python3 /patch.py /app/dist /app/dist/offline /offline\
\&\& mkdir -p /backend/dist/offline \&\& python3 /patch.py /backend/dist /backend/dist/offline /offline\
\
FROM nginx|' ../nginx/Dockerfile
# Modify Dockerfile for app to add python3 and offline patch
# Modify Dockerfile for backend to add python3 and offline patch
# TODO: Remark: Not needed due to SPA frontend
#sed -i 's|COPY ./Pipfile\* /app/|COPY ./Pipfile\* /app/\
#sed -i 's|COPY ./Pipfile\* /backend/|COPY ./Pipfile\* /backend/\
#COPY offline_deployment/offline_patcher.py /patch.py\
#RUN apt-get update \
# \&\& apt-get install -y --no-install-recommends \
# python3 python3-requests \
# \&\& apt-get clean \\\
# \&\& rm -rf /var/lib/apt/lists/\*\
# \&\& mkdir -p /app/server/static/offline \&\& python3 /patch.py /app/server /server/static/offline\
# \&\& mkdir -p /backend/server/static/offline \&\& python3 /patch.py /backend/server /server/static/offline\
#\
#|' ../app/Dockerfile.prod
#|' ../backend/Dockerfile.prod
docker-compose -f ../docker-compose.prod.yml pull
docker-compose -f ../docker-compose.prod.yml build
docker image save -o doccano-app.tar doccano-app:custom
docker image save -o doccano-nginx.tar doccano-nginx:custom
docker image save -o postgres.tar postgres:13.1-alpine
docker image save -o doccano-backend.tar doccano-backend:custom
docker image save -o doccano-nginx.tar doccano-nginx:custom
docker image save -o postgres.tar postgres:13.1-alpine

4
offline_deployment/offline_02_2-import_Docker_images.sh

@ -5,10 +5,10 @@ cd $DIR
unset DIR
# Set image tag in Compose to avoid image build
sed -i 's^dockerfile: app/Dockerfile.prod^dockerfile: app/Dockerfile.prod\n image: doccano-app:custom^g' ../docker-compose.prod.yml
sed -i 's^dockerfile: backend/Dockerfile.prod^dockerfile: backend/Dockerfile.prod\n image: doccano-backend:custom^g' ../docker-compose.prod.yml
sed -i 's^dockerfile: nginx/Dockerfile^dockerfile: nginx/Dockerfile\n image: doccano-nginx:custom^g' ../docker-compose.prod.yml
# Load docker images
docker image load -i doccano-app.tar
docker image load -i doccano-backend.tar
docker image load -i doccano-nginx.tar
docker image load -i postgres.tar
Loading…
Cancel
Save