Skip to content

Commit

Permalink
Fix bunzip2 issue and simplify image transfer
Browse files Browse the repository at this point in the history
  • Loading branch information
omarciovsena committed May 17, 2024
1 parent ebd8450 commit b5e5939
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
13 changes: 8 additions & 5 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,36 +19,39 @@ jobs:
- name: Build Docker images
run: docker-compose build

- name: List Docker images
run: docker images

- name: Set up SSH
uses: webfactory/ssh-agent@v0.5.3
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}

- name: Add DigitalOcean droplet to known_hosts
run: |
ssh-keyscan ${{ secrets.DROPLET_IP }} >> ~/.ssh/known_hosts
ssh-keyscan ${{ secrets.DROPLET_IP }} >> ~/.ssh/known_hosts
- name: Save and transfer API image to DigitalOcean
run: |
set -e
IMAGE_API_ID=$(docker images -q abibliadigital-api:latest)
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 }} 'bunzip2 | docker load'
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)
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 }} 'bunzip2 | docker load'
docker save $IMAGE_MONGO_ID | bzip2 | ssh root@${{ secrets.DROPLET_IP }} 'bzip2 -d | docker load'
- name: Deploy to DigitalOcean
run: |
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ services:
abibliadigital-api:
build: ./docker-api
command: [ "bash", "/usr/src/api/start.sh" ]
image: abibliadigital-api:latest
image: abibliadigital_api:latest
ports:
- "3000:3000"
expose:
Expand All @@ -24,7 +24,7 @@ services:
abibliadigital-mongo:
build: ./docker-mongo
container_name: abibliadigital-mongo
image: abibliadigital-mongo:latest
image: abibliadigital_mongo:latest
ports:
- "27017:27017"
expose:
Expand Down

0 comments on commit b5e5939

Please sign in to comment.