Skip to content

add config to deploy on gcp (#142) #29

add config to deploy on gcp (#142)

add config to deploy on gcp (#142) #29

name: Build and push image to GCP
on:
workflow_dispatch:
push:
branches:
- main
jobs:
docker_build_push_gcp:
name: 'Docker build and push to GCP'
runs-on: ubuntu-latest
permissions:
contents: 'read'
id-token: 'write'
steps:
- uses: 'actions/checkout@v4'
- name: Authenticate to Google Cloud
id: auth
uses: 'google-github-actions/auth@v2'
with:
credentials_json: ${{ secrets.GCS_ACC_KEY_JSON }}
# To optionally display info about current gcloud environment
- name: 'Set up Cloud SDK'
uses: "google-github-actions/setup-gcloud@v1"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Use gcloud CLI
run: "gcloud info"
# Auth Docker to access the artifact registry
- name: "Docker auth"
run: |-
gcloud auth configure-docker europe-north1-docker.pkg.dev --quiet
- name: Login to GAR
uses: docker/login-action@v3
with:
registry: europe-north1-docker.pkg.dev
username: _json_key
password: ${{ secrets.GCS_ACC_KEY_JSON }}
- name: Push to Google Artifact Registry
uses: docker/build-push-action@v2
with:
context: .
file: Dockerfile
push: true
tags: |
europe-north1-docker.pkg.dev/spire-ros-5lmr/kv-ros/backend:latest
platforms: linux/amd64,linux/arm64