Giter Club home page Giter Club logo

build-push's Introduction

build-push

Builds Docker images with customized image tags, labels, and annotations, and pushes them to a specified container registry. It is designed to run in a rootless, unprivileged container for enhanced security, including environments like self-hosted GitHub Action Runner Controller (ARC) on Kubernetes.

This is a composite GitHub Action that incorporates the following actions:

Inputs

Name Description Required Default
image_name Name of the Docker image to be built and pushed. Yes -
registry_address URL of the container registry where the image will be pushed. Yes -
registry_username Username for authentication with the container registry. Yes -
registry_password Password for authentication with the container registry. Yes -
context The directory path used as the build context. No ./
dockerfile_path Location of the Dockerfile. No Dockerfile
flavor Specifies the tagging strategy. For options, see Docker Metadata Action documentation. No -
tags Defines how the image is tagged. For detailed configuration, refer to Docker Metadata Action documentation. No
type=sha
type=ref,event=branch
type=ref,event=pr
type=schedule,pattern={{date 'YYYYMMDD-hhmmss'}}
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}},enable=${{ !startsWith(github.ref, 'refs/tags/v0.') }}
labels Custom labels to apply to the built image, separated by newlines. No -
annotations Additional annotations for the image, separated by newlines. No -
archs CPU architectures to target during the build, separated by commas (eg: amd64,arm64). Note: Not functional in Kubernetes (ARC). Cannot be used with platforms. No -
platforms Target platforms for the image build, separated by commas (eg: linux/amd64,linux/arm64). Note: Not functional in Kubernetes (ARC). Cannot be used with archs. No -
build_args Build-time variables in the form arg_name=arg_value. Separate multiple arguments with newlines. These are passed to Docker build with --build-arg. No -
buildah_extra_args Additional arguments for the buildah bud command, separated by newlines. No -
oci Sets the image format. true for OCI format, false for Docker format. Default is false. No false
push_extra_args Extra arguments for the podman push command, separated by newlines. No -

Outputs

Name Description
push_result JSON string with the digest and registry paths for pushed images.

Example Usage

name: Build image and Push to  Github Container Registry

on:
  push:

jobs:
  build-push-ghcr:
    name: Build and push image
    runs-on: ubuntu-22.04

    permissions:
      contents: read
      packages: write

    steps:
    - name: Checkout
      uses: actions/checkout@v4

    - name: Build and Push Docker image to GHCR
      uses: aleskxyz/build-push@v1
      with:
        image_name: ${{ github.event.repository.name }}
        registry_address: ghcr.io/${{ github.repository_owner }}
        registry_username: ${{ github.actor }}
        registry_password: ${{ github.token }}

build-push's People

Contributors

aleskxyz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

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.