Skip to content

Commit

Permalink
ci(jobs): devide actions to teo jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
anteqkois committed May 31, 2024
1 parent e41eebc commit 83ef2a9
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 9 deletions.
15 changes: 10 additions & 5 deletions .github/workflows/build-and-deploy-api-gateway.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: build-and-deploy-api-gateway
on: workflow_dispatch

jobs:
build_and_deploy:
build:
runs-on: ubuntu-latest
name: Build images
steps:
Expand Down Expand Up @@ -45,6 +45,12 @@ jobs:
run: docker build -t registry.digitalocean.com/linkerry/api-gateway:latest -f ./apps/api-gateway/Dockerfile . --platform=linux/amd64
- name: Push image to DO Container Registry
run: docker push registry.digitalocean.com/linkerry/api-gateway:latest
- name: Clear DO container registry
run: doctl registry garbage-collection start
deploy:
runs-on: ubuntu-latest
name: Deploy api
steps:
- name: Connect to VPS and refresh docker compose
uses: appleboy/[email protected]
with:
Expand All @@ -55,7 +61,6 @@ jobs:
port: 22
script: |
cd api.linkerry.com/
docker-compose pull
docker-compose up -d --no-deps --build api-gateway
- name: Clear DO container registry
run: doctl registry garbage-collection start
docker compose pull
docker compose up -d --no-deps --build api-gateway
docker image prune -f
19 changes: 19 additions & 0 deletions .github/workflows/build-and-deploy-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,22 @@ jobs:
run: docker build -t registry.digitalocean.com/linkerry/web:latest --build-arg NEXT_PUBLIC_API_HOST=$NEXT_PUBLIC_API_HOST -f ./apps/web/Dockerfile . --platform=linux/amd64
- name: Push image to DO Container Registry
run: docker push registry.digitalocean.com/linkerry/web:latest
- name: Connect to VPS and refresh docker composes
uses: appleboy/[email protected]
with:
host: ${{ secrets.VPS_IP }}
username: root
key: ${{ secrets.SSH_PASSPHRASE_PRIVATE_KEY }}
passphrase: ${{ secrets.SSH_PASSPHRASE }}
port: 22
script: |
cd api.linkerry.com/
docker compose pull
docker compose up -d --no-deps --build api-gateway
cd ..
cd linkerry.com/
docker compose pull
docker compose up -d --no-deps --build web
docker image prune -f
- name: Clear DO container registry
run: doctl registry garbage-collection start
7 changes: 3 additions & 4 deletions .github/workflows/build-and-deploy-web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,8 @@ jobs:
port: 22
script: |
cd linkerry.com/
docker-compose pull
docker compose up --force-recreate --build -d
docker-compose up -d --no-deps --build api-gateway
docker compose pull
docker compose up -d --no-deps --build web
docker image prune -f
- name: Clear DO container registry
run: doctl registry garbage-collection start

1 change: 1 addition & 0 deletions apps/web/docker-compose.prod.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
version: '3.8'
services:
web:
container_name: web
image: registry.digitalocean.com/linkerry/web:latest
ports:
- ${VIRTUAL_PORT}:${VIRTUAL_PORT}
Expand Down

0 comments on commit 83ef2a9

Please sign in to comment.