Skip to content

Publish to DockerHub #6

Publish to DockerHub

Publish to DockerHub #6

# This workflow will download the Maven Central package and
# build Docker image and publish to DockerHub
name: Publish to DockerHub
on:
workflow_dispatch:
inputs:
DB2REST_VERSION:
description: 'DB2REST version that is already published in Maven Central'
required: true
default: '1.2.4'
# release:
# types: [created]
jobs:
build_docker_image:
runs-on: ubuntu-latest
env:
DB2REST_VERSION: ${{ github.event.inputs.DB2REST_VERSION }}
permissions:
contents: read
packages: write
steps:
- name: Download DB2REST packages from Maven Central
run: |
echo "CI--- Using DB2REST_VERSION: ${{ github.event.inputs.DB2REST_VERSION }}"
echo "CI--- Downloading DB2REST JAR from Maven Central"
wget --progress=bar:force:noscroll https://search.maven.org/remotecontent?filepath=io/9tiger/db2rest/$DB2REST_VERSION/db2rest-$DB2REST_VERSION.jar
echo "CI--- File downloaded successfully"
ls -l
# mv *.jar ${{ github.workspace }}/db2rest.jar
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push Docker images
uses: docker/build-push-action@v6
with:
# We use default Git context to build the Docker image,
# instead of PATH context `context: .`
push: true
tags: kdhrubo/db2rest:v${{ github.run_number }}, kdhrubo/db2rest:latest