From 553c860955efd92c56554b70965e33d556d41974 Mon Sep 17 00:00:00 2001 From: Guillaume Smet Date: Mon, 3 Jul 2023 18:24:03 +0200 Subject: [PATCH] Restore ENTRYPOINT in Dockerfile templates Fixes #34347 (cherry picked from commit 28d1939c14f47813ef5b7605be1b3249cf14a55e) --- .../dockerfiles/base/Dockerfile-layout.include.qute | 2 ++ .../base/src/main/docker/Dockerfile.tpl.qute.native | 2 +- .../src/main/docker/Dockerfile.tpl.qute.native-micro | 2 +- .../quarkus/QuarkusCodestartGenerationTest.java | 9 ++++----- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/independent-projects/tools/base-codestarts/src/main/resources/codestarts/quarkus/tooling/dockerfiles/base/Dockerfile-layout.include.qute b/independent-projects/tools/base-codestarts/src/main/resources/codestarts/quarkus/tooling/dockerfiles/base/Dockerfile-layout.include.qute index 666b5bcc45d08..d407dc64296f9 100644 --- a/independent-projects/tools/base-codestarts/src/main/resources/codestarts/quarkus/tooling/dockerfiles/base/Dockerfile-layout.include.qute +++ b/independent-projects/tools/base-codestarts/src/main/resources/codestarts/quarkus/tooling/dockerfiles/base/Dockerfile-layout.include.qute @@ -90,3 +90,5 @@ ENV AB_JOLOKIA_OFF="" {/if} ENV JAVA_OPTS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager" ENV JAVA_APP_JAR="/deployments/quarkus-run.jar" + +ENTRYPOINT [ "/opt/jboss/container/java/run/run-java.sh" ] diff --git a/independent-projects/tools/base-codestarts/src/main/resources/codestarts/quarkus/tooling/dockerfiles/base/src/main/docker/Dockerfile.tpl.qute.native b/independent-projects/tools/base-codestarts/src/main/resources/codestarts/quarkus/tooling/dockerfiles/base/src/main/docker/Dockerfile.tpl.qute.native index 5f84d15ec5541..dd2a17091aa4a 100644 --- a/independent-projects/tools/base-codestarts/src/main/resources/codestarts/quarkus/tooling/dockerfiles/base/src/main/docker/Dockerfile.tpl.qute.native +++ b/independent-projects/tools/base-codestarts/src/main/resources/codestarts/quarkus/tooling/dockerfiles/base/src/main/docker/Dockerfile.tpl.qute.native @@ -24,4 +24,4 @@ COPY --chown=1001:root {buildtool.build-dir}/*-runner /work/application EXPOSE 8080 USER 1001 -CMD ["./application", "-Dquarkus.http.host=0.0.0.0"] +ENTRYPOINT ["./application", "-Dquarkus.http.host=0.0.0.0"] diff --git a/independent-projects/tools/base-codestarts/src/main/resources/codestarts/quarkus/tooling/dockerfiles/base/src/main/docker/Dockerfile.tpl.qute.native-micro b/independent-projects/tools/base-codestarts/src/main/resources/codestarts/quarkus/tooling/dockerfiles/base/src/main/docker/Dockerfile.tpl.qute.native-micro index 1209d56d5c35c..fe30d4da1cf5d 100644 --- a/independent-projects/tools/base-codestarts/src/main/resources/codestarts/quarkus/tooling/dockerfiles/base/src/main/docker/Dockerfile.tpl.qute.native-micro +++ b/independent-projects/tools/base-codestarts/src/main/resources/codestarts/quarkus/tooling/dockerfiles/base/src/main/docker/Dockerfile.tpl.qute.native-micro @@ -27,4 +27,4 @@ COPY --chown=1001:root {buildtool.build-dir}/*-runner /work/application EXPOSE 8080 USER 1001 -CMD ["./application", "-Dquarkus.http.host=0.0.0.0"] +ENTRYPOINT ["./application", "-Dquarkus.http.host=0.0.0.0"] diff --git a/independent-projects/tools/devtools-testing/src/test/java/io/quarkus/devtools/codestarts/quarkus/QuarkusCodestartGenerationTest.java b/independent-projects/tools/devtools-testing/src/test/java/io/quarkus/devtools/codestarts/quarkus/QuarkusCodestartGenerationTest.java index cc668750782cf..51240540b5619 100644 --- a/independent-projects/tools/devtools-testing/src/test/java/io/quarkus/devtools/codestarts/quarkus/QuarkusCodestartGenerationTest.java +++ b/independent-projects/tools/devtools-testing/src/test/java/io/quarkus/devtools/codestarts/quarkus/QuarkusCodestartGenerationTest.java @@ -6,7 +6,6 @@ import static io.quarkus.devtools.testing.FakeExtensionCatalog.FAKE_QUARKUS_CODESTART_CATALOG; import static io.quarkus.devtools.testing.SnapshotTesting.assertThatMatchSnapshot; import static io.quarkus.devtools.testing.SnapshotTesting.checkContains; -import static io.quarkus.devtools.testing.SnapshotTesting.checkNotContains; import static org.assertj.core.api.Assertions.assertThat; import java.nio.file.Path; @@ -299,7 +298,7 @@ private void checkDockerfilesWithMaven(Path projectDir) { .satisfies(checkContains("docker build -f src/main/docker/Dockerfile.jvm")) .satisfies(checkContains("registry.access.redhat.com/ubi8/openjdk-11:1.16"))//TODO: make a test for java17 .satisfies(checkContains("ENV JAVA_APP_JAR=\"/deployments/quarkus-run.jar\"")) - .satisfies(checkNotContains("ENTRYPOINT")); + .satisfies(checkContains("ENTRYPOINT [ \"/opt/jboss/container/java/run/run-java.sh\" ]")); assertThat(projectDir.resolve("src/main/docker/Dockerfile.legacy-jar")).exists() .satisfies(checkContains("./mvnw package -Dquarkus.package.type=legacy-jar")) .satisfies(checkContains("docker build -f src/main/docker/Dockerfile.legacy-jar")) @@ -307,15 +306,15 @@ private void checkDockerfilesWithMaven(Path projectDir) { .satisfies(checkContains("EXPOSE 8080")) .satisfies(checkContains("USER 185")) .satisfies(checkContains("ENV JAVA_APP_JAR=\"/deployments/quarkus-run.jar\"")) - .satisfies(checkNotContains("ENTRYPOINT")); + .satisfies(checkContains("ENTRYPOINT [ \"/opt/jboss/container/java/run/run-java.sh\" ]")); assertThat(projectDir.resolve("src/main/docker/Dockerfile.native-micro")).exists() .satisfies(checkContains("./mvnw package -Pnative")) .satisfies(checkContains("quay.io/quarkus/quarkus-micro-image:2.0")) - .satisfies(checkContains("CMD [\"./application\", \"-Dquarkus.http.host=0.0.0.0\"]")); + .satisfies(checkContains("ENTRYPOINT [\"./application\", \"-Dquarkus.http.host=0.0.0.0\"]")); assertThat(projectDir.resolve("src/main/docker/Dockerfile.native")).exists() .satisfies(checkContains("./mvnw package -Pnative")) .satisfies(checkContains("registry.access.redhat.com/ubi8/ubi-minimal")) - .satisfies(checkContains("CMD [\"./application\", \"-Dquarkus.http.host=0.0.0.0\"]")); + .satisfies(checkContains("ENTRYPOINT [\"./application\", \"-Dquarkus.http.host=0.0.0.0\"]")); } private void checkDockerfilesWithGradle(Path projectDir) {