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