Skip to content

Commit 0f3524a

Browse files
authored
Fix documentation + Added alternate way to auth for docker (#5)
* fix readme Signed-off-by: Mateusz Piórowski <[email protected]> * fix Signed-off-by: Mateusz Piórowski <[email protected]> * added missing repository name Signed-off-by: Mateusz Piórowski <[email protected]> Signed-off-by: Mateusz Piórowski <[email protected]>
1 parent 8fb954d commit 0f3524a

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

workflows/deploy-cloudrun/cloudrun-docker.yml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ on:
5252
env:
5353
PROJECT_ID: YOUR_PROJECT_ID # TODO: update Google Cloud project id
5454
GAR_LOCATION: YOUR_GAR_LOCATION # TODO: update Artifact Registry location
55+
REPOSITORY: YOUR_REPOSITORY_NAME # TODO: update Artifact Registry repository name
5556
SERVICE: YOUR_SERVICE_NAME # TODO: update Cloud Run service name
5657
REGION: YOUR_SERVICE_REGION # TODO: update Cloud Run service region
5758

@@ -80,7 +81,7 @@ jobs:
8081
# id: auth
8182
# uses: 'google-github-actions/auth@v0'
8283
# with:
83-
# credentials_json: '${{ secrets.GCP_CREDENTIALS }}''
84+
# credentials_json: '${{ secrets.GCP_CREDENTIALS }}'
8485

8586
# BEGIN - Docker auth and build (NOTE: If you already have a container image, these Docker steps can be omitted)
8687

@@ -92,11 +93,20 @@ jobs:
9293
username: 'oauth2accesstoken'
9394
password: '${{ steps.auth.outputs.access_token }}'
9495
registry: '${{ env.GAR_LOCATION }}-docker.pkg.dev'
96+
97+
# NOTE: Alternative option - authentication via credentials json
98+
# - name: Docker Auth
99+
# id: docker-auth
100+
# uses: 'docker/login-action@v1'
101+
# with:
102+
# registry: ${{ env.GAR_LOCATION }}-docker.pkg.dev
103+
# username: _json_key
104+
# password: ${{ secrets.GCP_CREDENTIALS }}
95105

96106
- name: Build and Push Container
97107
run: |-
98-
docker build -t "${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.SERVICE }}:${{ github.sha }}" ./
99-
docker push "${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.SERVICE }}:${{ github.sha }}"
108+
docker build -t "${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.REPOSITORY }}/${{ env.SERVICE }}:${{ github.sha }}" ./
109+
docker push "${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.REPOSITORY }}/${{ env.SERVICE }}:${{ github.sha }}"
100110
101111
# END - Docker auth and build
102112

@@ -107,7 +117,11 @@ jobs:
107117
service: ${{ env.SERVICE }}
108118
region: ${{ env.REGION }}
109119
# NOTE: If using a pre-built image, update the image name here
110-
image: ${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.SERVICE }}:${{ github.sha }}
120+
image: ${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.REPOSITORY }}/${{ env.SERVICE }}:${{ github.sha }}
121+
# NOTE: You can also set env variables here:
122+
# env_vars: |
123+
# NODE_ENV=production
124+
# TOKEN_EXPIRE=6400
111125

112126
# If required, use the Cloud Run url output in later steps
113127
- name: Show Output

0 commit comments

Comments
 (0)