Skip to content

zmiklank/build-and-push-action

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The Build and Push GitHub Action

The action builds a container image and pushes it to the specified registry. The path to upload the image is constructed from inputs as follows:

registry/registry_namespace/image_name

Action Inputs

Registry information

Input Name Description Default value
registry Registry to push container image to. required
registry_namespace Namespace of the registry, where the image would be pushed. required
registry_username Login to specified registry. required
registry_token Access token to specified registry. required

Build information

Input Name Description Default value
image_name Name of the built image. required
tag Tag of the built image. ""
use_default_tags Add default tags to image - SHA, latest, current date true
archs Label the image with this architecture. For multiple architectures, seperate them by a comma. amd64
dockerfile Dockerfile and its relative path to build the image. Dockerfile
docker_context Docker build context. .

Other information

Input Name Description Default value
readme If path to readme is set, the readme is updated to the registry. Only quay.io is supported. ""
quay_application_token Application token is used for updating description for image. ""

Example

The example below shows how the sclorg/build-and-push-action can be used.

name: Build and push to quay.io registry
on:
  push:
    branches:
      - main

jobs:
  build-and-push:
    runs-on: ubuntu-20.04
    steps:
      - name: Build and push to quay.io registry
        uses: sclorg/build-and-push-action@v2
        with:
          registry: "quay.io"
          registry_namespace: "namespace"
          registry_username: ${{ secrets.REGISTRY_LOGIN }}
          registry_token: ${{ secrets.REGISTRY_TOKEN }}
          dockerfile: "1.20/Dockerfile"
          image_name: "container_image-1.20"
          tag: "tag"

Multi arch builds

Input archs is provided to build the multi architecture images. archs input should be comma separated ( i.e. archs: "amd64, s390x" ). It is an optional argument, if not provided image will be built on amd64 i.e. default arch

The example below shows how the sclorg/build-and-push-action can be used for multi-arch image

name: Build and push to quay.io registry
on:
  push:
    branches:
      - main

jobs:
  build-and-push:
    runs-on: ubuntu-20.04
    steps:
      - name: Build and push to quay.io registry
        uses: sclorg/build-and-push-action@v2
        with:
          registry: "quay.io"
          registry_namespace: "namespace"
          registry_username: ${{ secrets.REGISTRY_LOGIN }}
          registry_token: ${{ secrets.REGISTRY_TOKEN }}
          dockerfile: "1.20/Dockerfile"
          image_name: "container_image-1.20"
          tag: "tag"
          archs: "amd64, s390x"

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%