Changed the files accordingly to build JDK 11 and 17 images #109
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: image-build | |
on: | |
push: | |
branches: | |
- "jdk" | |
paths: | |
- "Dockerfile" | |
- ".github/workflows/image-build.yaml" | |
pull_request: | |
branches: | |
- "jdk" | |
jobs: | |
image-build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
jdk-version: ["11", "17"] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4.2.2 | |
timeout-minutes: 5 | |
- name: Docker meta | |
id: meta | |
if: ${{ github.event_name == 'push' }} | |
uses: docker/metadata-action@v5 | |
with: | |
images: improwised/ghar-image | |
tags: | | |
type=sha,prefix={{branch}}-${{ matrix.jdk-version }}-,suffix=-{{date 'X'}} | |
type=raw,prefix={{branch}}-${{ matrix.jdk-version }}-,value=latest | |
timeout-minutes: 2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
timeout-minutes: 5 | |
- name: Login to DockerHub | |
if: ${{ github.ref_name == 'jdk' && github.event_name == 'push' }} | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ vars.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
timeout-minutes: 2 | |
- name: Set PR Tags | |
if: ${{ github.event_name == 'pull_request' }} | |
run: echo "tags=test-jdk-${{ matrix.jdk-version }}-${{ github.sha }}" >> $GITHUB_ENV | |
timeout-minutes: 1 | |
- name: Build and Push Docker Image | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
build-args: | | |
JDK_VERSION=${{ matrix.jdk-version }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
push: ${{ github.event_name == 'push' && github.ref_name == 'jdk' }} | |
tags: ${{ github.event_name == 'pull_request' && env.tags || steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
annotations: ${{ steps.meta.outputs.annotations }} | |
timeout-minutes: 5 |