release
This commit is contained in:
parent
99caa42e48
commit
0e17390973
57
.github/workflows/cicd.yaml
vendored
57
.github/workflows/cicd.yaml
vendored
@ -2,7 +2,8 @@ name: Frontend CI/CD Pipeline
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ main ]
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
env:
|
env:
|
||||||
REGISTRY: dg0200cr.azurecr.io
|
REGISTRY: dg0200cr.azurecr.io
|
||||||
@ -13,6 +14,9 @@ env:
|
|||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
image_tag: ${{ steps.set-image-tag.outputs.image_tag }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@ -21,7 +25,6 @@ jobs:
|
|||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: '20'
|
node-version: '20'
|
||||||
cache: 'npm'
|
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci
|
run: npm ci
|
||||||
@ -35,11 +38,16 @@ jobs:
|
|||||||
name: build-files
|
name: build-files
|
||||||
path: build/
|
path: build/
|
||||||
|
|
||||||
|
- name: Generate image tag
|
||||||
|
id: set-image-tag
|
||||||
|
run: |
|
||||||
|
timestamp=$(date '+%Y%m%d%H%M%S')
|
||||||
|
echo "image_tag=${timestamp}" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
release:
|
release:
|
||||||
needs: build
|
needs: build
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
outputs:
|
|
||||||
image_tag: ${{ steps.set_tag.outputs.tag }}
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@ -48,13 +56,7 @@ jobs:
|
|||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: build-files
|
name: build-files
|
||||||
path: build/
|
path: build
|
||||||
|
|
||||||
- name: Generate image tag
|
|
||||||
id: set_tag
|
|
||||||
run: |
|
|
||||||
tag=$(date +'%Y%m%d%H%M%S')
|
|
||||||
echo "tag=${tag}" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- name: Login to Azure Container Registry
|
- name: Login to Azure Container Registry
|
||||||
uses: azure/docker-login@v1
|
uses: azure/docker-login@v1
|
||||||
@ -64,26 +66,29 @@ jobs:
|
|||||||
password: ${{ secrets.ACR_PASSWORD }}
|
password: ${{ secrets.ACR_PASSWORD }}
|
||||||
|
|
||||||
- name: Build and push Docker image
|
- name: Build and push Docker image
|
||||||
run: |
|
uses: docker/build-push-action@v5
|
||||||
docker build \
|
with:
|
||||||
--build-arg PROJECT_FOLDER="." \
|
context: .
|
||||||
--build-arg REACT_APP_MEMBER_URL="http://20.249.185.127/member" \
|
file: deployment/Dockerfile-lifesub-web
|
||||||
--build-arg REACT_APP_MYSUB_URL="http://20.249.185.127/mysub" \
|
push: true
|
||||||
--build-arg REACT_APP_RECOMMEND_URL="http://20.249.185.127/recommend" \
|
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_ORG }}/${{ env.APP_NAME }}:${{ needs.build.outputs.image_tag }}
|
||||||
--build-arg BUILD_FOLDER="deployment" \
|
build-args: |
|
||||||
--build-arg EXPORT_PORT="18080" \
|
PROJECT_FOLDER=.
|
||||||
-f deployment/Dockerfile-lifesub-web \
|
REACT_APP_MEMBER_URL=http://20.249.185.127/member
|
||||||
-t ${{ env.REGISTRY }}/${{ env.IMAGE_ORG }}/${{ env.APP_NAME }}:${{ steps.set_tag.outputs.tag }} .
|
REACT_APP_MYSUB_URL=http://20.249.185.127/mysub
|
||||||
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_ORG }}/${{ env.APP_NAME }}:${{ steps.set_tag.outputs.tag }}
|
REACT_APP_RECOMMEND_URL=http://20.249.185.127/recommend
|
||||||
|
BUILD_FOLDER=deployment
|
||||||
|
EXPORT_PORT=18080
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
needs: release
|
needs: [build, release]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Azure Login
|
- name: Azure login
|
||||||
uses: azure/login@v1
|
uses: azure/login@v1
|
||||||
with:
|
with:
|
||||||
creds: ${{ secrets.AZURE_CREDENTIALS }}
|
creds: ${{ secrets.AZURE_CREDENTIALS }}
|
||||||
@ -101,7 +106,7 @@ jobs:
|
|||||||
- name: Generate deployment manifest
|
- name: Generate deployment manifest
|
||||||
run: |
|
run: |
|
||||||
export namespace=${{ env.NAMESPACE }}
|
export namespace=${{ env.NAMESPACE }}
|
||||||
export lifesub_web_image_path=${{ env.REGISTRY }}/${{ env.IMAGE_ORG }}/${{ env.APP_NAME }}:${{ needs.release.outputs.image_tag }}
|
export lifesub_web_image_path=${{ env.REGISTRY }}/${{ env.IMAGE_ORG }}/${{ env.APP_NAME }}:${{ needs.build.outputs.image_tag }}
|
||||||
export replicas=1
|
export replicas=1
|
||||||
export export_port=18080
|
export export_port=18080
|
||||||
export resources_requests_cpu=256m
|
export resources_requests_cpu=256m
|
||||||
@ -116,8 +121,6 @@ jobs:
|
|||||||
- name: Deploy to AKS
|
- name: Deploy to AKS
|
||||||
run: |
|
run: |
|
||||||
kubectl apply -f deployment/deploy.yaml
|
kubectl apply -f deployment/deploy.yaml
|
||||||
|
|
||||||
echo "Waiting for deployment to be ready..."
|
|
||||||
kubectl -n ${{ env.NAMESPACE }} wait --for=condition=available deployment/lifesub-web --timeout=300s
|
kubectl -n ${{ env.NAMESPACE }} wait --for=condition=available deployment/lifesub-web --timeout=300s
|
||||||
|
|
||||||
echo "Waiting for service external IP..."
|
echo "Waiting for service external IP..."
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user