dsec-discord-bot/.github/workflows/deploy.yml
2026-07-03 22:05:07 +10:00

30 lines
989 B
YAML

name: Docker Compose Deploy
on:
push:
branches:
- main # Trigger this workflow on pushes to the main branch
jobs:
build_and_deploy:
runs-on: [self-hosted, linux] # Use the labels you assigned to your self-hosted runner
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build and deploy with Docker Compose
working-directory: /home/ubuntu/dsec_bot
run: |
echo "Starting Docker Compose with --build and --force-recreate..."
sudo git pull
sudo docker compose build
sudo docker compose up -d --build
echo "Deployment complete."
# Optional: Clean up old Docker images to save disk space
- name: Clean up old Docker images
run: |
echo "Cleaning up dangling Docker images..."
sudo docker image prune -f