Skip to content

feat: migrate docker image of the agent to Java 21 #9

feat: migrate docker image of the agent to Java 21

feat: migrate docker image of the agent to Java 21 #9

name: Build Test Docker image
on:
push:
branches: ["main"]
paths:
- ".github/docker/**"
- ".github/workflows/build-test-docker.yml"
pull_request:
paths:
- ".github/docker/**"
- ".github/workflows/build-test-docker.yml"
env:
REGISTRY: ghcr.io
IMAGE_NAME: agent-ci-ubuntu-22-jdk-11
jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Log in to the Container registry
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v3
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build Docker image
if: ${{ github.event_name == 'pull_request' }}
uses: docker/build-push-action@v2
with:
context: .github/docker
push: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Build and push Docker image
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
uses: docker/build-push-action@v2
with:
context: .github/docker
push: true
tags: |
"ghcr.io/input-output-hk/${{ env.IMAGE_NAME }}:latest"
"ghcr.io/input-output-hk/${{ env.IMAGE_NAME }}:main"
labels: ${{ steps.meta.outputs.labels }}