Files
dashboard-backend/.gitea/workflows/build-deploy.yml
CloudForge Dev ecdd3c9847
Some checks failed
Build and Deploy with Buildkit / build-deploy (push) Failing after 33s
Use buildkit for image building - Backend Only
2025-11-19 15:36:44 +08:00

58 lines
1.7 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

name: Build and Deploy with Buildkit
on:
push:
branches:
- main
jobs:
build-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Buildx (buildkit)
run: |
# 安裝 buildx
mkdir -p ~/.docker/cli-plugins
curl https://github.com/docker/buildx/releases/download/v0.12.0/buildx-v0.12.0.linux-amd64 -L -o ~/.docker/cli-plugins/docker-buildx
chmod +x ~/.docker/cli-plugins/docker-buildx
- name: Build with buildkit (no docker daemon needed)
run: |
# 啟用 buildx builder
docker buildx create --use --name=buildkit-runner 2>/dev/null || docker buildx use buildkit-runner
# 構建後端
docker buildx build \
--load \
-t cloudforge-dashboard-backend:${{ github.sha }} \
-t cloudforge-dashboard-backend:latest \
.
# # 構建前端
# docker buildx build \
# --load \
# -t cloudforge-dashboard-frontend:${{ github.sha }} \
# -t cloudforge-dashboard-frontend:latest \
# ./dashboard-frontend
- name: Verify images
run: |
docker images | grep cloudforge
echo "✅ Images built successfully"
- name: Save images
run: |
# 保存為 tar用於後續部署
mkdir -p /tmp/images
docker save cloudforge-dashboard-backend:latest -o /tmp/images/backend.tar
# docker save cloudforge-dashboard-frontend:latest -o /tmp/images/frontend.tar
- name: Summary
run: |
echo "✅ Build completed"
echo "Images ready for deployment"