Skip to content

Build, Test, and Push Services #9

Build, Test, and Push Services

Build, Test, and Push Services #9

Workflow file for this run

name: Build and Deploy Microservices
on:
push:
branches: ["deploy"]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Docker
uses: docker/setup-buildx-action@v2
- name: Build Docker image
run: docker compose build --progress=plain --no-cache -t fight-club-backend:latest .
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- name: Save Docker image
run: docker save fight-club-backend:latest > fight-club-backend.tar
- name: Transfer image to server via SSH
uses: appleboy/ssh-action@master
with:
host: 37.139.41.110
username: ubuntu
key: ${{ secrets.SSH_PRIVATE_KEY }}
script: |
sudo mkdir -p /opt/docker-images
cat fight-club-backend.tar | sudo docker load -i -
sudo docker compose up -d --remove-orphans