diff --git a/integration-tests/keycloak-authorization/pom.xml b/integration-tests/keycloak-authorization/pom.xml
index 05e1cd9d2e417..7463c62cdfd0b 100644
--- a/integration-tests/keycloak-authorization/pom.xml
+++ b/integration-tests/keycloak-authorization/pom.xml
@@ -15,6 +15,7 @@
http://localhost:8180/auth
+ 15.3
@@ -110,20 +111,37 @@
htmlunit
test
+
+ org.openjdk.nashorn
+ nashorn-core
+ ${nashorn-core.version}
+
+
+
+ src/test/resources
+ true
+
+
maven-surefire-plugin
true
+
+ ${keycloak.image.version}
+
maven-failsafe-plugin
true
+
+ ${keycloak.image.version}
+
@@ -137,6 +155,23 @@
+
+ org.apache.maven.plugins
+ maven-dependency-plugin
+
+
+ copy-dependencies-quarkus
+ process-test-resources
+
+ copy-dependencies
+
+
+ ${project.build.testOutputDirectory}
+ nashorn-core,asm,asm-util,asm-commons
+
+
+
+
diff --git a/integration-tests/keycloak-authorization/src/test/java/io/quarkus/it/keycloak/KeycloakLifecycleManager.java b/integration-tests/keycloak-authorization/src/test/java/io/quarkus/it/keycloak/KeycloakLifecycleManager.java
index 676a24b81bb82..a1690b8467287 100644
--- a/integration-tests/keycloak-authorization/src/test/java/io/quarkus/it/keycloak/KeycloakLifecycleManager.java
+++ b/integration-tests/keycloak-authorization/src/test/java/io/quarkus/it/keycloak/KeycloakLifecycleManager.java
@@ -31,6 +31,7 @@
import org.keycloak.util.JsonSerialization;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.wait.strategy.Wait;
+import org.testcontainers.images.builder.ImageFromDockerfile;
import org.testcontainers.images.builder.Transferable;
import io.quarkus.test.common.QuarkusTestResourceLifecycleManager;
@@ -44,16 +45,22 @@ public class KeycloakLifecycleManager implements QuarkusTestResourceLifecycleMan
protected static String KEYCLOAK_SERVER_URL;
private static final String KEYCLOAK_REALM = "quarkus";
private static final String KEYCLOAK_SERVICE_CLIENT = "quarkus-service-app";
- private static final String KEYCLOAK_VERSION = System.getProperty("keycloak.version");
+ private static final String KEYCLOAK_IMAGE = System.getProperty("keycloak.docker.image");
@SuppressWarnings("resource")
@Override
public Map start() {
- keycloak = new GenericContainer<>("quay.io/keycloak/keycloak:" + KEYCLOAK_VERSION)
- .withExposedPorts(8080)
- .withEnv("KEYCLOAK_ADMIN", "admin")
- .withEnv("KEYCLOAK_ADMIN_PASSWORD", "admin")
- .waitingFor(Wait.forLogMessage(".*Keycloak.*started.*", 1));
+ try {
+ keycloak = new GenericContainer<>(
+ new ImageFromDockerfile().withDockerfile(Paths.get(getClass().getResource("/Dockerfile").toURI()))
+ .withBuildArg("KEYCLOAK_IMAGE", KEYCLOAK_IMAGE))
+ .withExposedPorts(8080)
+ .withEnv("KEYCLOAK_ADMIN", "admin")
+ .withEnv("KEYCLOAK_ADMIN_PASSWORD", "admin")
+ .waitingFor(Wait.forLogMessage(".*Keycloak.*started.*", 1));
+ } catch (URISyntaxException e) {
+ throw new RuntimeException(e);
+ }
keycloak = keycloak
.withCopyToContainer(Transferable.of(createPoliciesJar().toByteArray()), "/opt/keycloak/providers/policies.jar")
diff --git a/integration-tests/keycloak-authorization/src/test/resources/Dockerfile b/integration-tests/keycloak-authorization/src/test/resources/Dockerfile
new file mode 100644
index 0000000000000..7e12d7f27db4f
--- /dev/null
+++ b/integration-tests/keycloak-authorization/src/test/resources/Dockerfile
@@ -0,0 +1,8 @@
+FROM ${keycloak.docker.image} as builder
+
+COPY ./*.jar /opt/keycloak/providers/
+
+FROM ${keycloak.docker.image}
+COPY --from=builder /opt/keycloak/ /opt/keycloak/
+
+ENTRYPOINT ["/opt/keycloak/bin/kc.sh"]