Skip to content

Instantly share code, notes, and snippets.

@beemi
Created October 3, 2021 15:08
Show Gist options
  • Save beemi/1e0bf72db19443872236f76170c4a31f to your computer and use it in GitHub Desktop.
Save beemi/1e0bf72db19443872236f76170c4a31f to your computer and use it in GitHub Desktop.
Angular APP Docker Image to Google Container Registry
name: Push Docker image
on:
push:
branches:
- master
env:
PROJECT_ID: ${{ secrets.GCP_PROD_SERVICE_PROJECT_ID }}
IMAGE_NAME: front-end-angular-app
REGISTRY: ghcr.io
TAG: 1.0.${{ github.run_number }}
REGION: us-central1
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- uses: satackey/action-docker-layer-caching@v0.0.11
continue-on-error: true
# Setup GCP SDK
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@master
with:
version: '290.0.1'
project_id: ${{ secrets.GCP_PROD_SERVICE_PROJECT_ID }}
service_account_key: ${{ secrets.GCP_PROD_SERVICE_PRIVATE_KEY }}
export_default_credentials: true
- run: |
gcloud --quiet auth configure-docker
# Build the Docker image
- name: Build Docker Image
run: |
docker build --tag "gcr.io/$PROJECT_ID/$IMAGE_NAME:$TAG" .
# Push the Docker image to Google Container Registry
- name: Push image to Google Container Registry(GCR)
run: |
docker push "gcr.io/$PROJECT_ID/$IMAGE_NAME:$TAG"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment