Skip to content

Commit

Permalink
Merge pull request #74 from conduktor/tom/hub_build
Browse files Browse the repository at this point in the history
PXY-1013 hub build
  • Loading branch information
thomaskwscott authored Aug 18, 2023
2 parents 70c4136 + 0f0618e commit 1461e6a
Showing 1 changed file with 66 additions and 0 deletions.
66 changes: 66 additions & 0 deletions .github/workflows/docker_hub_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Publish to DockerHub

on:
workflow_dispatch:
inputs:
input_tag:
description: 'ghcr tag'
required: true
output_tag:
description: 'docker hub tag'
required: true


jobs:
publish-public-dockerhub:
name: Publish ${{ github.event.inputs.output_tag }} to DockerHub
runs-on: cdk-standard
timeout-minutes: 15
env:
PUBLISH_TAG: ''
IMAGE_NAME: conduktor/conduktor-gateway-oss
steps:
- name: Set GHCR_DISTROLESS_IMAGE env
run: echo "GHCR_DISTROLESS_IMAGE=ghcr.io/${{ env.IMAGE_NAME }}-distroless:${{ github.event.inputs.input_tag }}" >> $GITHUB_ENV

- name: Set DOCKERHUB_DISTROLESS_IMAGE env
run: echo "DOCKERHUB_DISTROLESS_IMAGE=docker.io/${{ env.IMAGE_NAME }}:${{ github.event.inputs.output_tag }}-distroless" >> $GITHUB_ENV

- name: Set DOCKERHUB_IMAGE_LATEST env
run: echo "DOCKERHUB_IMAGE_LATEST=docker.io/${{ env.IMAGE_NAME }}:latest" >> $GITHUB_ENV

- name: DEBUG env
run: |
echo "GHCR_DISTROLESS_IMAGE=${{ env.GHCR_DISTROLESS_IMAGE }}"
echo "DOCKERHUB_DISTROLESS_IMAGE=${{ env.DOCKERHUB_DISTROLESS_IMAGE }}"
echo "DOCKERHUB_IMAGE_LATEST=${{ env.DOCKERHUB_IMAGE_LATEST }}"
- name: Print jobs outputs
run: echo "Publish version ${{ github.event.inputs.output_tag }} to DockerHub registry"

- name: Login to ghcr.io
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Load images in daemon
shell: bash
run: |
docker image pull "${GHCR_DISTROLESS_IMAGE}"
docker image ls -a
- name: Login to DockerHub registry
uses: docker/login-action@v2
with:
username: ${{ secrets.CONDUKTORBOT_DOCKER_HUB_USERNAME }}
password: ${{ secrets.CONDUKTORBOT_DOCKER_HUB_PAT }}

- name: Push to DockerHub registry
shell: bash
run: |
echo "Create tag ${DOCKERHUB_DISTROLESS_IMAGE} from ${GHCR_DISTROLESS_IMAGE}"
docker tag "${GHCR_DISTROLESS_IMAGE}" "${DOCKERHUB_DISTROLESS_IMAGE}"
docker push "${DOCKERHUB_DISTROLESS_IMAGE}"

0 comments on commit 1461e6a

Please sign in to comment.