trying forgejo actions

This commit is contained in:
liyunze 2026-01-04 10:46:06 +08:00
parent b5d87d2aaf
commit a2572cd634
2 changed files with 31 additions and 1 deletions

View file

@ -0,0 +1,30 @@
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]
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
sudo git pull
sudo docker-compose build
sudo docker-compose up -d --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..."
sudo docker image prune -f

View file

@ -5,7 +5,7 @@ COPY . .
RUN cargo build --release RUN cargo build --release
# Runtime stage # Runtime stage
FROM debian:bookworm-slim FROM debian:trixie-slim
RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/* RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/*
WORKDIR /app WORKDIR /app
COPY --from=builder /usr/src/portfolio-roast-bot/target/release/portfolio-roast-bot . COPY --from=builder /usr/src/portfolio-roast-bot/target/release/portfolio-roast-bot .