Skip to content
This repository has been archived by the owner on Dec 15, 2024. It is now read-only.

feat: how to dump database #74

feat: how to dump database

feat: how to dump database #74

Workflow file for this run

name: Deployment
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up SSH
run: |
sudo apt-get update
sudo apt-get install -y sshpass
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Docker Compose Build
run: |
docker compose build
- name: Save Docker images to tar file
run: docker save -o images.tar $(docker images --format "{{.Repository}}:{{.Tag}}" | tr '\n' ' ')
- name: Compress the tarball
run: |
gzip images.tar
- name: Send compressed tarball over SSH
run: |
sshpass -v -p "${{ secrets.SSH_PASSWORD }}" scp images.tar.gz ${{ secrets.SERVER_USER }}@${{ env.SERVER_IP }}:${{ secrets.DEPLOY_PATH }}
- name: Load Docker images on the remote server
run: |
sshpass -v -p "${{ secrets.SSH_PASSWORD }}" ssh ${{ secrets.SERVER_USER }}@${{ secrets.SERVER_IP }} "cd ${{ secrets.DEPLOY_PATH }} && gunzip -c myapp_images.tar.gz | docker load && docker compose down && docker compose up -d"