Skip to content

Commit

Permalink
Optimize of the workflow. Optimize nginx container usage
Browse files Browse the repository at this point in the history
  • Loading branch information
semeniak97mf committed Sep 10, 2024
1 parent 9c9a4d4 commit 4913840
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 74 deletions.
19 changes: 8 additions & 11 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,18 @@ jobs:

steps:
- name: Checkout Repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Create Image Tarball for explorer-frontend
run: |
docker build --build-arg GIT_COMMIT_SHA=$(git rev-parse --short HEAD) --build-arg GIT_TAG=$(git describe --tags --abbrev=0) -t explorer-frontend .
docker save -o explorer-frontend.tar explorer-frontend
mkdir -p artifacts
mv explorer-frontend.tar artifacts/
docker build --build-arg GIT_COMMIT_SHA=$(git rev-parse --short HEAD) --build-arg GIT_TAG=$(git describe --tags --abbrev=0) --tag explorer-frontend .
docker save --output artifacts/explorer-frontend.tar explorer-frontend
- name: Create Image Tarball for nginx
run: |
docker build --build-arg GIT_COMMIT_SHA=$(git rev-parse --short HEAD) --build-arg GIT_TAG=$(git describe --tags --abbrev=0) -t nginx-explorer nginx-docker/
docker save -o nginx-explorer.tar nginx-explorer
mv nginx-explorer.tar artifacts/
docker build --tag nginx-explorer docker/nginx
docker save --output artifacts/nginx-explorer.tar nginx-explorer
- name: Set up SSH
run: |
Expand All @@ -40,7 +38,6 @@ jobs:
scp -r artifacts/* ${{ secrets.HOST_USER}}@${{ secrets.EXPLORER_HOST }}:/blockscout/
scp -r deploy/* ${{ secrets.HOST_USER}}@${{ secrets.EXPLORER_HOST }}:/blockscout/
- name: SSH into Server and Deploy
uses: appleboy/[email protected]
with:
Expand All @@ -49,8 +46,8 @@ jobs:
key: ${{ secrets.SSH_PRIVATE_KEY }}
script: |
cd /blockscout
docker load -i explorer-frontend.tar
docker load -i nginx-explorer.tar
docker load --input explorer-frontend.tar
docker load --input nginx-explorer.tar
docker compose down
docker compose pull
docker compose up -d --build --remove-orphans
docker compose up --detach --build --remove-orphans
2 changes: 1 addition & 1 deletion deploy/services/certbot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: '3.9'
services:
certbot:
image: certbot/certbot
restart: unless-stopped
restart: always
volumes:
- /etc/letsencrypt:/etc/letsencrypt
- ./certbot/www:/var/www/certbot
Expand Down
1 change: 0 additions & 1 deletion deploy/services/nginx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,4 @@ services:
- 443:443
- 8080:8080
- 8081:8081
command: /bin/sh -c "/check_ssl.sh & nginx -g 'daemon off;'"

11 changes: 11 additions & 0 deletions docker/nginx/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM nginx:stable-alpine

COPY check_ssl.sh /

ENTRYPOINT ["/bin/sh", "-c"]

EXPOSE 80

STOPSIGNAL SIGQUIT

CMD ["/check_ssl.sh & exec /docker-entrypoint.sh nginx -g 'daemon off;'"]
File renamed without changes.
12 changes: 0 additions & 12 deletions nginx-docker/Dockerfile

This file was deleted.

49 changes: 0 additions & 49 deletions nginx-docker/docker-entrypoint.sh

This file was deleted.

0 comments on commit 4913840

Please sign in to comment.