From 09b0722f081daa3cb1a52dde5ced618cae953803 Mon Sep 17 00:00:00 2001 From: liyunze <50455574+liyunze-coding@users.noreply.github.com> Date: Tue, 11 Nov 2025 22:37:08 +1100 Subject: [PATCH] added deploy yml for Github Actions CI/CD --- .github/workflows/deploy.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..c0a49ec --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,28 @@ +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 + run: | + echo "Starting Docker Compose with --build and --force-recreate..." + cd /dsec_bot + docker-compose up -d --build --force-recreate + + 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..." + docker image prune -f