Skip to content

plejon/actions-docker-build-and-push-gcr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Docker build and push to GCR

Simple anctions workflow that takes your Dockerfile puts your iamge at gcr.
Fork from https://github.com/urcomputeringpal/actions-docker

Options

  • REGISTRY=gcr.io
  • IMAGE=$GITHUB_REPOSITORY
    • (Expects a Google Cloud Project named after your GitHub username)
  • TAG=$GITHUB_SHA
  • DEFAULT_BRANCH_TAG=true

Usage

Google Container Registry Setup

# Linux
cat path-to/key.json | base64 -w 0

# MacOS
cat path-to/key.json | base64 -b 0
  • That's it! The GitHub Actions in this repository read this Secret and provide the correct values to the Docker daemon by default if present. If a Secret isn't present, build may succeed but push will return an error!

Build and push images for each commit

Add the following to .github/workflows/docker.yaml:

name: Docker

on: [push]

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v1

      - name: Docker Build
        uses: plejon/actions-docker-build-and-push-gcr/build@master

      - name: Docker Push
        uses: plejon/actions-docker-build-and-push-gcr/push@master
        env:
          GCLOUD_SERVICE_ACCOUNT_KEY: ${{ secrets.GCLOUD_SERVICE_ACCOUNT_KEY }}
          ARG: --build-args clark=superman --build-args bruce=batman

Specify a different Registry, Project & image name

    [...]
    steps:
      - uses: actions/checkout@v1

      - name: Docker Build
        uses: plejon/actions-docker-build-and-push-gcr/build@master
        env:
          IMAGE: my-project/my-image
          GCLOUD_REGISTRY: eu.gcr.io

      - name: Docker Push
        uses: plejon/actions-docker-build-and-push-gcr/push@master
        env:
          IMAGE: my-project/my-image
          GCLOUD_REGISTRY: eu.gcr.io
          GCLOUD_SERVICE_ACCOUNT_KEY: ${{ secrets.GCLOUD_SERVICE_ACCOUNT_KEY }}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published