Skip to content

Commit

Permalink
another one
Browse files Browse the repository at this point in the history
  • Loading branch information
rasulov1337 committed Dec 15, 2024
1 parent 8be179a commit 79a969a
Showing 1 changed file with 14 additions and 16 deletions.
30 changes: 14 additions & 16 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,27 @@ on:
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: Checkout code
uses: actions/checkout@v4
- name: Install rsync
run: sudo apt-get update && sudo apt-get install -y rsync
- name: Copy code to server using rsync
uses: appleboy/ssh-action@master
with:
host: 37.139.41.110
username: ubuntu
key: ${{ secrets.SSH_PRIVATE_KEY }}
script: |
rsync -avz -e "ssh -p 22" ./ [email protected]:/opt/backend-deploy/
- name: Build and deploy on server
- 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 apt update && sudo apt install -y docker.io docker-compose
cd /opt/backend-deploy/
sudo docker-compose build --no-cache
sudo mkdir -p /opt/docker-images
cat fight-club-backend.tar | sudo docker load -i -
sudo docker-compose up -d --remove-orphans

0 comments on commit 79a969a

Please sign in to comment.