Merge pull request #1500 from kroxylicious/dependabot/maven/com.githu… #80
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
# docker.yaml - builds and pushes a kroxylicious container image. | |
# | |
# Requires repository variables: | |
# - REGISTRY_SERVER - the server of the container registry service e.g. `quay.io` or `docker.io` | |
# - REGISTRY_USERNAME - - your username on the service (or username of your robot account) | |
# - REGISTRY_DESTINATION - the push destination (without tag portion) e.g. `quay.io/<my org>/kroxylicious` | |
# and a repository secret | |
# - REGISTRY_TOKEN - the access token that corresponds to `REGISTRY_USERNAME` | |
# | |
# If the required repository variables aren't set the workflow will be skipped. This means the workflow won't fail | |
# on the forks of developers who haven't configured the variables/secrets. | |
name: Docker Build | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- 'main' | |
tags: | |
- 'v*.*.*' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
if: ${{ vars.REGISTRY_SERVER != '' && vars.REGISTRY_USERNAME != '' && vars.REGISTRY_DESTINATION != '' }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v3 | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
- name: Set Release version env variable | |
run: | | |
echo "RELEASE_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV | |
- name: Login to container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ vars.REGISTRY_SERVER }} | |
username: ${{ vars.REGISTRY_USERNAME }} | |
password: ${{ secrets.REGISTRY_TOKEN }} | |
- name: Build | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
build-args: | | |
KROXYLICIOUS_VERSION=${{ env.RELEASE_VERSION }} | |
tags: ${{ vars.REGISTRY_DESTINATION }}:${{ env.RELEASE_VERSION }} |