Giter Club home page Giter Club logo

gcr-docker-action's Introduction

gcr-docker-action

Simple extension for the docker/github-actions for able to support default GCR authentication in self-hosted runners.

!!! Some default values overwritten by the repository. !!!

Inputs

Example usage

Inputs

repository

Required Docker repository to tag the image with.

cmd

commands to run( build-push | build | push ). If not set then will default to build-push.

username

Username used to log in to a Docker registry. If not set then no login will occur.

password

Password or personal access token used to log in to a Docker registry. If not set then no login will occur.

registry

Server address of Docker registry. If not set then will default to eu.gcr.io.

tags

Comma-delimited list of tags. These will be added to the registry/repository to form the image's tags.

Example:

tags: tag1,tag2

tag_with_ref

Boolean value. Defaults to true.

Automatically tags the built image with the git reference. The format of the tag depends on the type of git reference with all forward slashes replaced with -.

For pushes to a branch the reference will be refs/heads/{branch-name} and the tag will be {branch-name}. If {branch-name} is master then the tag will be latest.

For pull requests the reference will be refs/pull/{pull-request} and the tag will be pr-{pull-request}.

For git tags the reference will be refs/tags/{git-tag} and the tag will be {git-tag}.

Examples:

Git Reference Image tag
refs/heads/master latest
refs/heads/my/branch my-branch
refs/pull/2/merge pr-2-merge
refs/tags/v1.0.0 v1.0.0

tag_with_sha

Boolean value. Defaults to true.

Automatically tags the built image with the git short SHA prefixed with sha-.

Example:

Git SHA Image tag
676cae2f85471aeff6776463c72881ebd902dcf9 sha-676cae2

path

Path to run the docker build from. Defaults to ..

dockerfile

Name of the Dockerfile. Defaults to {path}/Dockerfile.

target

Sets the target stage to build.

always_pull

Boolean value. Defaults to true.

Always attempt to pull a newer version of the image.

build_args

Comma-delimited list of build-time variables.

Example:

build_args: arg1=value1,arg2=value2

cache_froms

Comma-delimited list of images to consider as cache sources.

Example:

cache_froms: myorg/baseimage:latest

labels

Comma-delimited list of labels to add to the built image.

Example:

labels: label_name_1=label_value_1,label_name_2=label_value_2

add_git_labels

Boolean value. Defaults to true.

Adds labels with git repository information to the built image based on the standards set out in https://github.com/opencontainers/image-spec/blob/master/annotations.md.

The labels are:

Label key Example value Description
org.opencontainers.image.created 2020-03-06T23:00:00Z Date and time on which the image was built (string, date-time as defined by RFC 3339).
org.opencontainers.image.source https://github.com/myorg/myrepository URL to the GitHub repository.
org.opencontainers.image.revision 676cae2f85471aeff6776463c72881ebd902dcf9 The full git SHA of this commit.

push

Boolean value. Defaults to true.

Whether to push the built image.

Example usage

The following will build the root Dockerfile, tag the image as myorg/myrepository:latest, log in to Docker Hub using GitHub secrets, and push the image to the Docker Hub repository myorg/myrepository:

uses: aweris/gcr-docker-action@v1
with:
  repository: myorg/myrepository
  tags: latest

The following will build the root Dockerfile, tag the image with the git reference and SHA as described above, log in to Docker Hub using GitHub secrets, and push the image to the Docker Hub repository myorg/myrepository:

uses: aweris/gcr-docker-action@v1
with:
  repository: myorg/myrepository
  tag_with_ref: true
  tag_with_sha: true

The following will only push the image when the event that kicked off the workflow was a push of a git tag:

uses: aweris/gcr-docker-action@v1
with:
  repository: myorg/myrepository
  tag_with_ref: true
  push: ${{ startsWith(github.ref, 'refs/tags/') }}

The following builds the mytarget stage and pushes that:

uses: aweris/gcr-docker-action@v1
with:
  repository: myorg/myrepository
  tag_with_ref: true
  target: mytarget

More info

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.