Skip to content

merge dockerfiles

merge dockerfiles #15

Workflow file for this run

name: Deploy to DigitalOcean
on:
push:
branches:
- setup/digital-ocean
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- 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
- name: Save and transfer API image to DigitalOcean
run: |
IMAGE_API_ID=$(docker images -q abibliadigital_api:latest)
docker save $IMAGE_API_ID | bzip2 | ssh root@${{ secrets.DROPLET_IP }} 'bzip2 -d | docker load'
- name: Save and transfer Mongo image to DigitalOcean
run: |
IMAGE_MONGO_ID=$(docker images -q abibliadigital_mongo:latest)
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: Deploy to DigitalOcean
run: |
ssh root@${{ secrets.DROPLET_IP }} "cd /root/app && docker-compose -f /root/app/docker-compose.yml up -d --remove-orphans"