Skip to content

Commit

Permalink
build and use test docker-images in github's repository
Browse files Browse the repository at this point in the history
  • Loading branch information
sschum committed Nov 11, 2024
1 parent c753f21 commit 74b9c16
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 9 deletions.
29 changes: 21 additions & 8 deletions .github/workflows/build-test-image.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
name: Build Test Image
on:
workflow_dispatch: {}
workflow_dispatch: { }
push:
branches:
- master
paths:
- ".github/workflows/build-test-image.yml"
- "test/Dockerfile"

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}-keycloak-dev

jobs:
build:
# runs-on: ubuntu-latest
runs-on: self-hosted
strategy:
matrix:
keycloak-version:
- '26.0.5'
- '25.0.2'
- '24.0.5'
- '23.0.7'
Expand All @@ -26,23 +31,31 @@ jobs:
cancel-in-progress: true
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

- name: Login to Github Docker Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Login to Docker Hub
uses: docker/login-action@v2
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push
uses: docker/build-push-action@v6
with:
push: true
platforms: linux/amd64,linux/arm64
tags: markusqvestseidl/keycloak-dev:${{ matrix.keycloak-version }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
file: test/Dockerfile
build-args: |
KEYCLOAK_VERSION=${{ matrix.keycloak-version }}
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:
keycloak:
# we have to use a custom docker image for these tests, since it's not possible to provide command-line args
# to a service container. see https://github.com/actions/runner/issues/2139
image: markusqvestseidl/keycloak-dev:${{ matrix.keycloak-version }}
image: ghcr.io/${{ github.repository }}-keycloak-dev:${{ matrix.keycloak-version }}
ports:
- 8080:8080
env:
Expand Down

0 comments on commit 74b9c16

Please sign in to comment.