Skip to content

Deploy API Gateway to DigitalOcean (PRE) #11

Deploy API Gateway to DigitalOcean (PRE)

Deploy API Gateway to DigitalOcean (PRE) #11

Workflow file for this run

name: Deploy API Gateway to DigitalOcean (PRE)
on:
workflow_dispatch: # Allows manual triggering
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Build Docker Image
run: |
docker compose -f ./docker/docker-compose.yml build
- name: Save Docker Image
run: |
docker save api-gateway:latest | gzip > api-gateway.tar.gz
- name: Copy Docker Image and Compose File to Droplet
uses: appleboy/[email protected]
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_KEY }}
source: "./api-gateway.tar.gz,./docker-compose.yml"
target: /opt/api-gateway/
- name: Deploy with Docker Compose
uses: appleboy/[email protected]
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_KEY }}
script: |
cd /opt/api-gateway
# Stop and remove old services
docker compose down || true
# Load the new Docker image
gunzip -c api-gateway.tar.gz | docker load
# Start the service with the new image
docker compose up -d