better arch #13
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy Model Serving Cluster GKE | |
on: | |
push: | |
branches: | |
- "master" | |
paths-ignore: | |
- "*.md" | |
permissions: | |
contents: "read" | |
id-token: "write" | |
jobs: | |
Build-Docker-Image: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build and Push Lens Docker Image | |
uses: docker/build-push-action@v6 | |
with: | |
context: ./lens | |
file: ./lens/Dockerfile | |
tags: anhtu293/lens-app:${{ github.sha }} | |
push: true | |
- name: Build and Push OCR Docker Image | |
uses: docker/build-push-action@v6 | |
with: | |
context: ./ocr_app | |
file: ./ocr_app/Dockerfile | |
tags: anhtu293/ocr-app:${{ github.sha }} | |
push: true | |
- name: Build and Push Translation Docker Image | |
uses: docker/build-push-action@v6 | |
with: | |
context: ./trans_app | |
file: ./trans_app/Dockerfile | |
tags: anhtu293/translation-app:${{ github.sha }} | |
push: true | |
Deploy-Model-Serving-Cluster: | |
runs-on: ubuntu-latest | |
needs: [Build-Docker-Image] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- id: "auth" | |
name: "Authenticate to Google Cloud" | |
uses: "google-github-actions/auth@f112390a2df9932162083945e46d439060d66ec2" # google-github-actions/auth@v2 | |
with: | |
credentials_json: "${{ secrets.GCP_CREDENTIALS }}" | |
- name: "Set up Cloud SDK" | |
uses: "google-github-actions/setup-gcloud@v2" | |
- name: "Use gcloud CLI" | |
run: "gcloud info" | |
# Get the GKE credentials so we can deploy to the cluster | |
- name: "Set up GKE credentials" | |
uses: "google-github-actions/get-gke-credentials@6051de21ad50fbb1767bc93c11357a49082ad116" # google-github-actions/get-gke-credentials@v2 | |
with: | |
cluster_name: "${{ vars.GKE_CLUSTER }}" | |
location: "${{ vars.GKE_ZONE }}" | |
- name: Install Helm | |
run: | | |
curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash | |
- name: Deploy Lens App | |
run: | | |
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list | |
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add - | |
sudo apt update | |
sudo apt-get install google-cloud-sdk-gke-gcloud-auth-plugin kubectl | |
export USE_GKE_GCLOUD_AUTH_PLUGIN=True | |
gcloud container clusters get-credentials ${{ vars.GKE_CLUSTER }} \ | |
--zone ${{ vars.GKE_ZONE }} \ | |
--project ${{ secrets.GKE_PROJECT }} | |
cd deployments/model-serving | |
helm upgrade --install app ./lens --set lens_app.image.tag=${{ github.sha }} --set ocr_app.image.tag=${{ github.sha }} --set translation_app.image.tag=${{ github.sha }} --namespace model-serving |