Skip to content

Commit

Permalink
Transfer application code and docker-compose.yml to droplet
Browse files Browse the repository at this point in the history
  • Loading branch information
omarciovsena committed May 17, 2024
1 parent 6b3afc1 commit 229872b
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,30 +33,22 @@ jobs:
- name: Save and transfer API image to DigitalOcean
run: |
set -e
IMAGE_API_ID=$(docker images -q abibliadigital_api:latest)
echo "API Image ID: $IMAGE_API_ID"
if [ -z "$IMAGE_API_ID" ]; then
echo "API image not found!"
exit 1
fi
docker save $IMAGE_API_ID | bzip2 | ssh root@${{ secrets.DROPLET_IP }} 'bzip2 -d | docker load'
- name: Save and transfer Mongo image to DigitalOcean
run: |
set -e
IMAGE_MONGO_ID=$(docker images -q abibliadigital_mongo:latest)
echo "Mongo Image ID: $IMAGE_MONGO_ID"
if [ -z "$IMAGE_MONGO_ID" ]; then
echo "Mongo image not found!"
exit 1
fi
docker save $IMAGE_MONGO_ID | bzip2 | ssh root@${{ secrets.DROPLET_IP }} 'bzip2 -d | docker load'
- name: Transfer application code to DigitalOcean
run: |
rsync -avz --exclude 'node_modules' --exclude '.git' . root@${{ secrets.DROPLET_IP }}:/root/app
- name: Transfer docker-compose.yml to DigitalOcean
run: |
scp docker-compose.yml root@${{ secrets.DROPLET_IP }}:/root/docker-compose.yml
- name: Deploy to DigitalOcean
run: |
ssh root@${{ secrets.DROPLET_IP }} "docker-compose -f /root/docker-compose.yml up -d"
ssh root@${{ secrets.DROPLET_IP }} "cd /root/app && docker-compose -f /root/docker-compose.yml up -d"

0 comments on commit 229872b

Please sign in to comment.