Docker build workflow
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
name: Deploy to K3S
|
||||
name: Build and Deploy
|
||||
|
||||
on:
|
||||
push:
|
||||
@@ -6,24 +6,30 @@ on:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
build-deploy:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Install Helm
|
||||
- name: Build Docker Images
|
||||
run: |
|
||||
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
|
||||
helm version
|
||||
# 後端
|
||||
docker build -t cloudforge-dashboard-backend:${{ github.sha }} ./dashboard-backend
|
||||
docker tag cloudforge-dashboard-backend:${{ github.sha }} cloudforge-dashboard-backend:latest
|
||||
|
||||
- name: Deploy with Helm
|
||||
run: |
|
||||
helm upgrade --install cloudforge ./cloudforge-dashboard-helm \
|
||||
-n cloudforge \
|
||||
--create-namespace
|
||||
# 前端
|
||||
docker build -t cloudforge-dashboard-frontend:${{ github.sha }} ./dashboard-frontend
|
||||
docker tag cloudforge-dashboard-frontend:${{ github.sha }} cloudforge-dashboard-frontend:latest
|
||||
|
||||
- name: Verify Deployment
|
||||
echo "✅ Images built successfully"
|
||||
|
||||
- name: Check images
|
||||
run: docker images | grep cloudforge
|
||||
|
||||
- name: Deploy to K3S
|
||||
run: |
|
||||
kubectl rollout status deployment/dashboard-backend -n cloudforge -t 300s
|
||||
echo "✅ Ready to deploy"
|
||||
# 暫時先驗證 build 成功
|
||||
# 下一步:設置 kubeconfig 和部署
|
||||
|
||||
Reference in New Issue
Block a user