Skip to content

Build and Push Dockerfiles #10

Build and Push Dockerfiles

Build and Push Dockerfiles #10

name: Build and Push Dockerfiles
permissions: read-all
on:
workflow_dispatch:
inputs:
publish_release:
description: Should the license bundle be published to docker-release
type: boolean
required: true
default: false
image_version:
description: Version to associate with the image (default- 'latest')
type: string
required: false
default: 'latest'
env:
PUBLISH_RELEASE: ${{ github.event.inputs.publish_release }}
TARGET_DOCKER_REGISTRY: ""
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Set target docker registry
run: |
if [ "$PUBLISH_RELEASE" = true ]; then
echo "TARGET_DOCKER_REGISTRY=zowe-docker-release.jfrog.io" >> $GITHUB_ENV
else
echo "TARGET_DOCKER_REGISTRY=zowe-docker-snapshot.jfrog.io" >> $GITHUB_ENV
fi
- name: Checkout
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to JFrog
uses: docker/login-action@v1
with:
registry: ${{ env.TARGET_DOCKER_REGISTRY }}
username: ${{ secrets.ARTIFACTORY_USERNAME }}
password: ${{ secrets.ARTIFACTORY_PASSWORD }}
- name: Build and push to release
id: docker_build
uses: docker/build-push-action@v2
with:
push: true
file: .dockerfiles/ort.Dockerfile
tags: ${{ env.TARGET_DOCKER_REGISTRY }}/ompzowe/zowecicd-license-base:${{ github.event.inputs.image_version }}