Skip to content

Deploy using SSH and Docker Compose #93

Deploy using SSH and Docker Compose

Deploy using SSH and Docker Compose #93

Workflow file for this run

name: Deploy using SSH and Docker Compose
on:
workflow_call:
workflow_dispatch:
jobs:
deploy:
name: Run ssh command on host machine
runs-on: ubuntu-latest
environment: deploy
steps:
- name: Tailscale
uses: tailscale/github-action@v2
with:
oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }}
oauth-secret: ${{ secrets.TS_OAUTH_SECRET }}
tags: tag:wrx-sh-ci
- name: Run ssh deploy command
run: |
ssh -o StrictHostKeyChecking=no github-actions@hetzner-server "
cd ~/wrx.sh
git fetch origin main
git reset --hard origin/main
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
docker compose -f docker/docker-compose.prod.yml -p wrx-sh pull
docker compose -f docker/docker-compose.prod.yml -p wrx-sh --env-file=./.env up --detach --no-build --remove-orphans
docker compose -f docker/docker-compose.prod.yml -p wrx-sh restart caddy
docker compose -f docker/docker-compose.prod.yml -p wrx-sh restart vector
docker system prune --all --volumes --force
"