Skip to content

Build and Push Keycloak Service Image #273

Build and Push Keycloak Service Image

Build and Push Keycloak Service Image #273

name: Build and Push Keycloak Service Image
# This workflow is necessary to build a Keycloak image with an entry point since
# GitHub actions are not allowing to specify the image command and Keycloak
# image not having a default one. It could be avoided with the direct call to
# docker to start container, but this is also a way and keeps the image close to
# the place where it is necessary causing less network traffic.
on:
push:
branches:
- main
paths:
- 'tools/Dockerfile.keycloak' # Trigger build only when Dockerfile changes
- '.github/workflows/build-keycloak-image.yml'
pull_request:
branches: ["main" ]
paths:
- 'tools/Dockerfile.keycloak' # Trigger build only when Dockerfile changes
- '.github/workflows/build-keycloak-image.yml'
workflow_dispatch: # Allows manual trigger
merge_group:
jobs:
build_and_push:
runs-on: ubuntu-latest
permissions:
packages: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Log in to Docker Hub (or GHCR)
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
with:
registry: ghcr.io
username: openstack-experimental
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Keycloak image
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
with:
context: .
file: tools/Dockerfile.keycloak
push: true
tags: |
ghcr.io/openstack-experimental/keystone/keycloak-ci-service:26.2
ghcr.io/openstack-experimental/keystone/keycloak-ci-service:${{ github.sha }}