Add container image (#89)

This commit is contained in:
Stephan Schnabel 2024-06-24 15:15:47 +02:00
parent c7bae85e40
commit 957713286a
Signed by: stephan.schnabel
GPG key ID: E07AF5BA239FE543
4 changed files with 93 additions and 0 deletions

View file

@ -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

View file

@ -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)

58
pom.xml
View file

@ -65,6 +65,8 @@
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<maven.release.releaseProfiles>deploy,site,ossrh,release</maven.release.releaseProfiles>
<!-- ===================================================================== -->
<!-- ============================== Libaries ============================= -->
<!-- ===================================================================== -->
@ -220,4 +222,60 @@
</plugins>
</build>
<profiles>
<profile>
<id>release</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<phase>prepare-package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<resources>
<resource>
<directory>${project.basedir}/src/main/docker</directory>
<filtering>true</filtering>
</resource>
</resources>
<outputDirectory>${project.build.directory}</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<phase>deploy</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>docker</executable>
<arguments>
<argument>build</argument>
<argument>${project.build.directory}</argument>
<argument>--tag=ghcr.io/kokuwaio/keycloak-event-metrics:latest</argument>
<argument>--tag=ghcr.io/kokuwaio/keycloak-event-metrics:${project.version}</argument>
<argument>--tag=docker.io/kokuwaio/keycloak-event-metrics:latest</argument>
<argument>--tag=docker.io/kokuwaio/keycloak-event-metrics:${project.version}</argument>
<argument>--push</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View file

@ -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