Use buildkit for image building
Some checks failed
Build and Deploy with Buildkit / build-deploy (push) Failing after 32s
Some checks failed
Build and Deploy with Buildkit / build-deploy (push) Failing after 32s
This commit is contained in:
57
.gitea/workflows/build-deploy.yml
Normal file
57
.gitea/workflows/build-deploy.yml
Normal file
@@ -0,0 +1,57 @@
|
||||
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 \
|
||||
./dashboard-backend
|
||||
|
||||
# 構建前端
|
||||
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"
|
||||
@@ -1,35 +0,0 @@
|
||||
name: Build and Deploy
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
build-deploy:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Build Docker Images
|
||||
run: |
|
||||
# 後端
|
||||
docker build -t cloudforge-dashboard-backend:${{ github.sha }} ./dashboard-backend
|
||||
docker tag cloudforge-dashboard-backend:${{ github.sha }} cloudforge-dashboard-backend:latest
|
||||
|
||||
# 前端
|
||||
docker build -t cloudforge-dashboard-frontend:${{ github.sha }} ./dashboard-frontend
|
||||
docker tag cloudforge-dashboard-frontend:${{ github.sha }} cloudforge-dashboard-frontend:latest
|
||||
|
||||
echo "✅ Images built successfully"
|
||||
|
||||
- name: Check images
|
||||
run: docker images | grep cloudforge
|
||||
|
||||
- name: Deploy to K3S
|
||||
run: |
|
||||
echo "✅ Ready to deploy"
|
||||
# 暫時先驗證 build 成功
|
||||
# 下一步:設置 kubeconfig 和部署
|
||||
@@ -1,15 +0,0 @@
|
||||
name: Test Runner
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: echo "Runner works!"
|
||||
- run: kubectl version --client || echo "kubectl not found"
|
||||
- run: helm version || echo "helm not found"
|
||||
- run: docker --version
|
||||
Reference in New Issue
Block a user