-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactored dockerfiles into one file
- Loading branch information
Showing
10 changed files
with
182 additions
and
174 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,15 +34,11 @@ jobs: | |
|
||
dockerfile: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
context: [base, temurin, temurin-import, distroless, distroless-import] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: hadolint/[email protected] | ||
with: | ||
dockerfile: src/main/docker/${{ matrix.context }}/Dockerfile | ||
dockerfile: src/main/docker/Dockerfile | ||
|
||
verify: | ||
runs-on: ubuntu-latest | ||
|
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,164 @@ | ||
FROM docker.io/library/debian:stable-slim AS keycloak | ||
ARG VERSION=${version.org.keycloak} | ||
ADD keycloak-quarkus-dist-$VERSION.tar.gz /tmp | ||
RUN mv "/tmp/keycloak-$VERSION" /app && rm -rf /app/bin/client /app/bin/*.bat | ||
|
||
FROM docker.io/eclipse-temurin:${maven.compiler.target}-jre AS keycloak-runtime | ||
# https://www.keycloak.org/server/all-config | ||
ENV \ | ||
KC_DB=postgres \ | ||
KC_CACHE=ispn \ | ||
KC_CACHE_STACK=kubernetes \ | ||
KC_CACHE_DNS=keycloak-headless \ | ||
KC_CACHE_OWNERS=2 \ | ||
KC_HEALTH_ENABLED=true \ | ||
KC_METRICS_ENABLED=true \ | ||
KC_METRICS_EVENT_REPLACE_IDS=true \ | ||
KC_METRICS_STATS_ENABLED=true \ | ||
URI_METRICS_ENABLED=false \ | ||
URI_METRICS_DETAILED=false \ | ||
KC_PROXY=edge \ | ||
KC_LOG_CONSOLE_OUTPUT=json | ||
COPY --from=keycloak /app /app | ||
COPY cache-ispn.xml /app/conf/cache-ispn.xml | ||
COPY keycloak-event-metrics-${version.io.kokuwa.keycloak.metrics}.jar /app/providers/metrics-spi.jar | ||
RUN java -Dkc.home.dir=/app -jar /app/lib/quarkus-run.jar build | ||
|
||
FROM docker.io/eclipse-temurin:${maven.compiler.target}-jre AS keycloak-import | ||
ENV KC_DB=postgres KC_CACHE=local KC_LOG_CONSOLE_OUTPUT=json | ||
COPY --from=keycloak /app /app | ||
RUN java -Dkc.home.dir=/app -jar /app/lib/quarkus-run.jar build | ||
|
||
### | ||
### Temurin | ||
### | ||
|
||
FROM docker.io/eclipse-temurin:${maven.compiler.target}-jre AS temurin | ||
|
||
# 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 ${version.org.keycloak} | ||
LABEL org.opencontainers.image.created ${git.build.time} | ||
LABEL org.opencontainers.image.revision ${git.commit.id} | ||
LABEL org.opencontainers.image.ref.name ${image.tag}-temurin | ||
LABEL org.opencontainers.image.base.name docker.io/eclipse-temurin:${maven.compiler.target}-jre | ||
|
||
# https://www.keycloak.org/server/all-config | ||
ENV \ | ||
KC_DB=postgres \ | ||
KC_CACHE=ispn \ | ||
KC_CACHE_STACK=kubernetes \ | ||
KC_CACHE_DNS=keycloak-headless \ | ||
KC_CACHE_OWNERS=2 \ | ||
KC_HEALTH_ENABLED=true \ | ||
KC_METRICS_ENABLED=true \ | ||
KC_METRICS_EVENT_REPLACE_IDS=true \ | ||
KC_METRICS_STATS_ENABLED=true \ | ||
URI_METRICS_ENABLED=false \ | ||
URI_METRICS_DETAILED=false \ | ||
KC_PROXY=edge \ | ||
KC_LOG_CONSOLE_OUTPUT=json | ||
|
||
COPY --from=keycloak-runtime /app /app | ||
ENTRYPOINT ["java", "-XX:+ExitOnOutOfMemoryError", "-Dkc.home.dir=/app", "-Djgroups.dns.query=${KC_CACHE_DNS}", "-jar", "/app/lib/quarkus-run.jar"] | ||
CMD ["start", "--optimized"] | ||
|
||
### | ||
### Temurin Import | ||
### | ||
|
||
FROM docker.io/eclipse-temurin:${maven.compiler.target}-jre AS temurin-import | ||
|
||
# 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 ${version.org.keycloak} | ||
LABEL org.opencontainers.image.created ${git.build.time} | ||
LABEL org.opencontainers.image.revision ${git.commit.id} | ||
LABEL org.opencontainers.image.ref.name ${image.tag}-temurin-import | ||
LABEL org.opencontainers.image.base.name docker.io/eclipse-temurin:${maven.compiler.target}-jre | ||
|
||
# https://www.keycloak.org/server/all-config | ||
ENV KC_DB=postgres KC_CACHE=local KC_LOG_CONSOLE_OUTPUT=json | ||
|
||
COPY --from=keycloak-import /app /app | ||
ENTRYPOINT ["java", "-XX:+ExitOnOutOfMemoryError", "-Dkc.home.dir=/app", "-jar", "/app/lib/quarkus-run.jar"] | ||
CMD ["import", "--dir=/realms"] | ||
|
||
### | ||
### Distroless | ||
### | ||
|
||
FROM gcr.io/distroless/java${maven.compiler.target}:nonroot AS distroless | ||
|
||
# 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 ${version.org.keycloak} | ||
LABEL org.opencontainers.image.created ${git.build.time} | ||
LABEL org.opencontainers.image.revision ${git.commit.id} | ||
LABEL org.opencontainers.image.ref.name ${image.tag}-distroless | ||
LABEL org.opencontainers.image.base.name gcr.io/distroless/java${maven.compiler.target}:nonroot | ||
|
||
# https://www.keycloak.org/server/all-config | ||
ENV \ | ||
KC_DB=postgres \ | ||
KC_CACHE=ispn \ | ||
KC_CACHE_STACK=kubernetes \ | ||
KC_CACHE_DNS=keycloak-headless \ | ||
KC_CACHE_OWNERS=2 \ | ||
KC_HEALTH_ENABLED=true \ | ||
KC_METRICS_ENABLED=true \ | ||
KC_METRICS_EVENT_REPLACE_IDS=true \ | ||
KC_METRICS_STATS_ENABLED=true \ | ||
URI_METRICS_ENABLED=false \ | ||
URI_METRICS_DETAILED=false \ | ||
KC_PROXY=edge \ | ||
KC_LOG_CONSOLE_OUTPUT=json | ||
|
||
COPY --from=keycloak-runtime /app /app | ||
ENTRYPOINT ["java", "-XX:+ExitOnOutOfMemoryError", "-Dkc.home.dir=/app", "-Djgroups.dns.query=${KC_CACHE_DNS}", "-jar", "/app/lib/quarkus-run.jar"] | ||
CMD ["start", "--optimized"] | ||
|
||
### | ||
### Distroless Import | ||
### | ||
|
||
FROM gcr.io/distroless/java${maven.compiler.target}:nonroot AS distroless-import | ||
|
||
# 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 ${version.org.keycloak} | ||
LABEL org.opencontainers.image.created ${git.build.time} | ||
LABEL org.opencontainers.image.revision ${git.commit.id} | ||
LABEL org.opencontainers.image.ref.name ${image.tag}-distroless-import | ||
LABEL org.opencontainers.image.base.name gcr.io/distroless/java${maven.compiler.target}:nonroot | ||
|
||
# https://www.keycloak.org/server/all-config | ||
ENV KC_DB=postgres KC_CACHE=local KC_LOG_CONSOLE_OUTPUT=json | ||
|
||
COPY --from=keycloak-import /app /app | ||
ENTRYPOINT ["java", "-XX:+ExitOnOutOfMemoryError", "-Dkc.home.dir=/app", "-jar", "/app/lib/quarkus-run.jar"] | ||
CMD ["import", "--dir=/realms"] |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.