Skip to content

ci: deployment test #37

ci: deployment test

ci: deployment test #37

Workflow file for this run

name: Build with docker
on: [push, pull_request]
jobs:
build-docker:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver: docker
- name: Build production environment using docker-compose
run: |
docker-compose -f docker-compose.yml build production
- name: Save Docker image as a tarball
run: docker save bxt_production:latest -o bxt-production.tar
- name: Upload Docker image to artifacts
uses: actions/upload-artifact@v3
with:
name: bxt-production-image
path: bxt-production.tar
deploy-ssh:
name: Deploy to server using ssh
needs: build-docker
runs-on: ubuntu-latest
steps:
- name: Download Docker image from artifacts
uses: actions/download-artifact@v3
with:
name: bxt-production-image
- name: Transfer Docker image to server
uses: appleboy/[email protected]
with:
host: ${{ secrets.DEPLOYMENT_SERVER_HOST }}
username: ${{ secrets.DEPLOYMENT_SERVER_USER }}
key: ${{ secrets.DEPLOYMENT_SERVER_SSH_KEY }}
source: "bxt-production.tar"
target: "/tmp"
- name: Deploy Docker image on server
uses: appleboy/[email protected]
with:
host: ${{ secrets.DEPLOYMENT_SERVER_HOST }}
username: ${{ secrets.DEPLOYMENT_SERVER_USER }}
key: ${{ secrets.DEPLOYMENT_SERVER_SSH_KEY }}
script: |
docker load -i /tmp/bxt-production.tar
docker stop bxt-production || true
docker rm bxt || true
docker run -d --name bxt bxt_production:latest