From 4fb7b2a2b0ee17e891bb92ff1474dd7f62c0b717 Mon Sep 17 00:00:00 2001 From: Stephan Schnabel Date: Mon, 24 Jun 2024 13:58:09 +0200 Subject: [PATCH] Add container image --- .github/workflows/release.yaml | 12 +++++++ README.md | 9 ++++++ pom.xml | 58 ++++++++++++++++++++++++++++++++++ src/main/docker/Dockerfile | 14 ++++++++ 4 files changed, 93 insertions(+) create mode 100644 src/main/docker/Dockerfile diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 3afdbf8..61f46be 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -8,6 +8,18 @@ jobs: env: MAVEN_ARGS: --batch-mode --color=always --no-transfer-progress --settings=.github/settings.xml steps: + - name: docker/login-action docker.io + uses: docker/login-action@v3.2.0 + with: + registry: docker.io + username: ${{ secrets.DOCKERIO_USERNAME }} + password: ${{ secrets.DOCKERIO_TOKEN }} + - name: docker/login-action ghcr.io + uses: docker/login-action@v3.2.0 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GIT_ACTION_TOKEN }} - run: git config --global user.name "${{ vars.KOKUWA_IO_BOT_NAME }}" - run: git config --global user.email "${{ vars.KOKUWA_IO_BOT_EMAIL }}" - uses: actions/checkout@v4 diff --git a/README.md b/README.md index 7a0a58b..3530a0e 100644 --- a/README.md +++ b/README.md @@ -119,6 +119,15 @@ Can be found here: [kokuwaio/keycloak keycloak-metrics.json](https://github.com/ For usage in [Testcontainers](https://www.testcontainers.org/) see [KeycloakExtension.java](src/test/java/io/kokuwa/keycloak/metrics/junit/KeycloakExtension.java#L57-L68) +### Container Image + +Registries: + +* [ghcr.io/kokuwaio/keycloak-event-metrics](https://github.com/kokuwaio/keycloak-event-metrics/pkgs/container/keycloak-event-metrics) +* [docker.io/kokuwaio/keycloak-event-metrics](https://hub.docker.com/r/kokuwaio/keycloak-event-metrics) + +This images are based on busybox, so you can use cp to copy the jar into your keycloak. + ### Docker Check: [kokuwaio/keycloak](https://github.com/kokuwaio/keycloak) diff --git a/pom.xml b/pom.xml index 387577d..4b8f179 100644 --- a/pom.xml +++ b/pom.xml @@ -65,6 +65,8 @@ 17 17 + release + @@ -220,4 +222,60 @@ + + + + release + + + + org.apache.maven.plugins + maven-resources-plugin + + + prepare-package + + copy-resources + + + + + ${project.basedir}/src/main/docker + true + + + ${project.build.directory} + + + + + + org.codehaus.mojo + exec-maven-plugin + + + deploy + + exec + + + docker + + build + ${project.build.directory} + --tag=ghcr.io/kokuwaio/keycloak-event-metrics:latest + --tag=ghcr.io/kokuwaio/keycloak-event-metrics:${project.version} + --tag=docker.io/kokuwaio/keycloak-event-metrics:latest + --tag=docker.io/kokuwaio/keycloak-event-metrics:${project.version} + --push + + + + + + + + + + diff --git a/src/main/docker/Dockerfile b/src/main/docker/Dockerfile new file mode 100644 index 0000000..b1aeb9a --- /dev/null +++ b/src/main/docker/Dockerfile @@ -0,0 +1,14 @@ +FROM busybox:latest + +# https://github.com/opencontainers/image-spec/blob/main/annotations.md +LABEL org.opencontainers.image.title ${project.name} +LABEL org.opencontainers.image.description ${project.description} +LABEL org.opencontainers.image.url ${project.url} +LABEL org.opencontainers.image.source ${project.url}/src/main/docker/Dockerfile +LABEL org.opencontainers.image.vendor ${project.organization.name} +LABEL org.opencontainers.image.authors https://github.com/orgs/kokuwaio/people +LABEL org.opencontainers.image.licenses Apache-2.0 +LABEL org.opencontainers.image.version ${project.version} +LABEL org.opencontainers.image.base.name busybox:latest + +COPY ${project.build.finalName}.jar /keycloak-event-metrics.jar -- 2.47.2