Skip to content

LaCapitale-Old/github-actions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

71 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

actions-docker

Opinionated GitHub Actions for common Docker workflows

Fork from https://github.com/urcomputeringpal/actions-docker

Opinions (expressed via default environment variables)

  • 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

echo -n "$(cat path-to/downloaded-key/4a276e9e5862.json)" | base64
  • 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: benjlevesque/actions-docker-gcr/build@master

      - name: Docker Push
        uses: benjlevesque/actions-docker-gcr/push@master
        env:
          GCLOUD_SERVICE_ACCOUNT_KEY: ${{ secrets.GCLOUD_SERVICE_ACCOUNT_KEY }}

Specify a different Registry, Project & image name

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

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

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

About

***** THIS REPO IS PUBLIC ****

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published