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".
IMAGE_NAME
- name of the image (including the docker organization)DOCKER_FOLDER
(optional, defaults to './') - folder where Dockerfile is in; needs a trailing slashVERSION
- semantic version used as the tag for the resulting imageDATETIME
(optional) - in case you want to build multiple images and refer to them with the same datetime string, e.g., YYYYMMDDHHmmss; (defaults toDATETIME=$(date +'%Y%m%d%H%M')
)FILE
(optional, defaults to 'Dockerfile') - name of the Dockerfile
None at the moment
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"
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"