Skip to content

About

GH Action to Build Docker Images with some Keptn-internal improvements

Resources

Code of conduct

Security policy

Stars

0 stars

Watchers

13 watching

Forks

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GH Action to Build Docker Images (with some Keptn internal stuff)

GitHub release (latest by date)

This repo provides a utility GitHub action for the CI Workflow in the Keptn Project. Nevertheless, this action provides a very basic functionality, as in "Build a docker image and do some sanity checks".

Inputs

  • IMAGE_NAME - name of the image (including the docker organization)
  • DOCKER_FOLDER (optional, defaults to './') - folder where Dockerfile is in; needs a trailing slash
  • VERSION - semantic version used as the tag for the resulting image
  • DATETIME (optional) - in case you want to build multiple images and refer to them with the same datetime string, e.g., YYYYMMDDHHmmss; (defaults to DATETIME=$(date +'%Y%m%d%H%M'))
  • FILE (optional, defaults to 'Dockerfile') - name of the Dockerfile

Outputs

None at the moment

Example usage

Simple Example

    env:
      VERSION: "1.2.3"
    steps:
      - name: Checkout Code
        uses: actions/checkout@v2

      - id: docker_login
        name: Docker Login
        uses: docker/login-action@v1
        with:
          username: ${{ secrets.REGISTRY_USER }}
          password: ${{ secrets.REGISTRY_PASSWORD }}

      - id: docker_build
        name: Docker Build
        uses: keptn/gh-action-build-docker-image@master
        with:
          PLATFORMS: ${{ env.DOCKER_PLATFORMS }}
          VERSION: ${{ env.VERSION }}
          IMAGE_NAME: "yourdockerorg/yourimagename"

Extended Example

    env:
      VERSION: "1.2.3"
    steps:
      - name: Checkout Code
        uses: actions/checkout@v2

      - id: docker_login
        name: Docker Login
        # only run docker login on pushes; also for PRs, but only if this is not a fork
        if: (github.event_name == 'push') || (github.event.pull_request.head.repo.full_name == github.repository)
        # note: GH does not allow to access secrets for PRs from a forked repositories due to security reasons
        # that's fine, but it means we can't push images to dockerhub
        uses: docker/login-action@v1
        with:
          username: ${{ secrets.REGISTRY_USER }}
          password: ${{ secrets.REGISTRY_PASSWORD }}

      - id: docker_build
        name: Docker Build
        uses: keptn/gh-action-build-docker-image@master
        with:
          PLATFORMS: "linux/amd64,linux/arm/v7,linux/arm64"
          VERSION: ${{ env.VERSION }}
          IMAGE_NAME: "yourdockerorg/yourimagename"
          DOCKER_FOLDER: "your-sub-directory/"
          FILE: "your-dockerfile.Dockerfile"

About

GH Action to Build Docker Images with some Keptn-internal improvements

Resources

Code of conduct

Security policy

Stars

0 stars

Watchers

13 watching

Forks

Releases

Packages

Used by

Contributors

Languages