Manually Deploy Docker Files to Artifact Registry #26
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: "Manually Deploy Docker Files to Artifact Registry" | |
on: | |
workflow_dispatch: | |
jobs: | |
deploy: | |
env: | |
PROJECT_ID: ${{ secrets.PROJECT_ID }} | |
SA_KEY: ${{ secrets.OWNER_SA_KEY }} | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Code Checkout | |
uses: actions/checkout@v4 | |
- id: 'auth' | |
name: Authenticate to Google Cloud | |
uses: google-github-actions/auth@v1 | |
with: | |
credentials_json: ${{ secrets.OWNER_SA_KEY }} | |
- name: Decode credentials.json | |
run: echo "${{ secrets.B64_ENCODED_KEY }}" | base64 --decode > ./backend/credentials.json | |
- name: Install GCloud CLI | |
uses: google-github-actions/setup-gcloud@v1 | |
- name: List files in the backend directory | |
run: ls -l ./backend | |
- name: Build and Push Backend Docker Image | |
env: | |
GOOGLE_PROJECT: ${{ secrets.PROJECT_ID }} | |
CREDENTIALS_JSON: ${{ secrets.B64_ENCODED_KEY }} | |
run: | | |
gcloud auth configure-docker us-central1-docker.pkg.dev | |
docker build --build-arg CREDENTIALS_JSON=./credentials.json -t us-central1-docker.pkg.dev/automate-gdsc/backend-images/backend:latest ./backend | |
docker push us-central1-docker.pkg.dev/automate-gdsc/backend-images/backend:latest | |
- name: Build and Push Frontend Docker Image | |
env: | |
GOOGLE_PROJECT: ${{ secrets.PROJECT_ID }} | |
run: | | |
gcloud auth configure-docker us-central1-docker.pkg.dev | |
docker build -t us-central1-docker.pkg.dev/automate-gdsc/frontend-images/frontend:latest ./frontend | |
docker push us-central1-docker.pkg.dev/automate-gdsc/frontend-images/frontend:latest | |
# - name: Build and Push ML Docker Image | |
# env: | |
# GOOGLE_PROJECT: ${{ secrets.PROJECT_ID }} | |
# run: | | |
# gcloud auth configure-docker us-central1-docker.pkg.dev | |
# docker build -t us-central1-docker.pkg.dev/automateml/ml-docker-image/ml:latest ./machine-learning | |
# docker push us-central1-docker.pkg.dev/automateml/ml-docker-image/ml:latest |