From 825ccbf3051d7fd09322cd8bd881345433944336 Mon Sep 17 00:00:00 2001 From: Marcin Grzejszczak Date: Fri, 7 Aug 2020 17:14:12 +0200 Subject: [PATCH] Improved the stub runner boot image - set the port to 8750, fixes gh-755 - stub runner app bases on thin jar, fixes gh-1385 a prerequisite for messaging support of docker images and polyglot messaging --- docker/spring-cloud-contract-docker/project/build.sh | 5 +++++ .../Dockerfile | 9 +++++++-- .../spring-cloud-contract-stub-runner-docker/run.sh | 9 +++++++++ spring-cloud-contract-stub-runner-boot/pom.xml | 10 ++++++++++ .../src/main/resources/META-INF/thin-kafka.properties | 2 ++ .../main/resources/META-INF/thin-rabbit.properties | 2 ++ .../src/main/resources/application.yml | 11 +++++++++++ 7 files changed, 46 insertions(+), 2 deletions(-) create mode 100755 docker/spring-cloud-contract-stub-runner-docker/run.sh create mode 100644 spring-cloud-contract-stub-runner-boot/src/main/resources/META-INF/thin-kafka.properties create mode 100644 spring-cloud-contract-stub-runner-boot/src/main/resources/META-INF/thin-rabbit.properties create mode 100644 spring-cloud-contract-stub-runner-boot/src/main/resources/application.yml diff --git a/docker/spring-cloud-contract-docker/project/build.sh b/docker/spring-cloud-contract-docker/project/build.sh index e2b23f441f..78a76eb328 100755 --- a/docker/spring-cloud-contract-docker/project/build.sh +++ b/docker/spring-cloud-contract-docker/project/build.sh @@ -1,5 +1,10 @@ #!/bin/bash +set -o errexit +set -o errtrace +set -o nounset +set -o pipefail + export PROJECT_NAME="${PROJECT_NAME:-example}" echo "Setting project name to [${PROJECT_NAME}]" echo "rootProject.name='${PROJECT_NAME}'" >> settings.gradle diff --git a/docker/spring-cloud-contract-stub-runner-docker/Dockerfile b/docker/spring-cloud-contract-stub-runner-docker/Dockerfile index 7fe7c50e1b..8f98e480ff 100644 --- a/docker/spring-cloud-contract-stub-runner-docker/Dockerfile +++ b/docker/spring-cloud-contract-stub-runner-docker/Dockerfile @@ -20,7 +20,12 @@ ENV JAVA_HOME /root/.sdkman/candidates/java/current/ ENV PATH "${PATH}:${JAVA_HOME}/bin" # Spring Cloud Contract -ENV SERVER_PORT 8083 +ENV SERVER_PORT 8750 VOLUME /tmp ADD target/libs/stub-runner-boot.jar stub-runner-boot.jar -ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/stub-runner-boot.jar"] +RUN echo "Fetching dependencies, please wait..." +RUN java -Dthin.dryrun=true -jar stub-runner-boot.jar +RUN java -Dthin.dryrun=true -jar stub-runner-boot.jar --thin.profile=rabbit +RUN java -Dthin.dryrun=true -jar stub-runner-boot.jar --thin.profile=kafka +COPY run.sh run.sh +ENTRYPOINT ["./run.sh"] diff --git a/docker/spring-cloud-contract-stub-runner-docker/run.sh b/docker/spring-cloud-contract-stub-runner-docker/run.sh new file mode 100755 index 0000000000..3acd972ac7 --- /dev/null +++ b/docker/spring-cloud-contract-stub-runner-docker/run.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +set -o errexit +set -o errtrace +set -o nounset +set -o pipefail + +echo "Running Spring Cloud Contract Stub Runner" +java -Djava.security.egd=file:/dev/./urandom -jar /stub-runner-boot.jar diff --git a/spring-cloud-contract-stub-runner-boot/pom.xml b/spring-cloud-contract-stub-runner-boot/pom.xml index c6ad5ccb26..43d695ff5a 100644 --- a/spring-cloud-contract-stub-runner-boot/pom.xml +++ b/spring-cloud-contract-stub-runner-boot/pom.xml @@ -13,6 +13,9 @@ jar Spring Cloud Contract Stub Runner Boot Spring Cloud Contract Stub Runner Boot + + 1.0.25.RELEASE + org.springframework.cloud @@ -35,6 +38,13 @@ true + + + org.springframework.boot.experimental + spring-boot-thin-layout + ${thin-jar.version} + + org.apache.maven.plugins diff --git a/spring-cloud-contract-stub-runner-boot/src/main/resources/META-INF/thin-kafka.properties b/spring-cloud-contract-stub-runner-boot/src/main/resources/META-INF/thin-kafka.properties new file mode 100644 index 0000000000..7827667d8e --- /dev/null +++ b/spring-cloud-contract-stub-runner-boot/src/main/resources/META-INF/thin-kafka.properties @@ -0,0 +1,2 @@ +exclusions.spring-cloud-stream-binder-rabbit: org.springframework.cloud:spring-cloud-stream-binder-rabbit +dependencies.spring-cloud-stream-binder-kafka: org.springframework.cloud:spring-cloud-stream-binder-kafka diff --git a/spring-cloud-contract-stub-runner-boot/src/main/resources/META-INF/thin-rabbit.properties b/spring-cloud-contract-stub-runner-boot/src/main/resources/META-INF/thin-rabbit.properties new file mode 100644 index 0000000000..1145b0300c --- /dev/null +++ b/spring-cloud-contract-stub-runner-boot/src/main/resources/META-INF/thin-rabbit.properties @@ -0,0 +1,2 @@ +exclusions.spring-cloud-stream-binder-kafka: org.springframework.cloud:spring-cloud-stream-binder-kafka +dependencies.spring-cloud-stream-binder-rabbit: org.springframework.cloud:spring-cloud-stream-binder-rabbit diff --git a/spring-cloud-contract-stub-runner-boot/src/main/resources/application.yml b/spring-cloud-contract-stub-runner-boot/src/main/resources/application.yml new file mode 100644 index 0000000000..d65102df1f --- /dev/null +++ b/spring-cloud-contract-stub-runner-boot/src/main/resources/application.yml @@ -0,0 +1,11 @@ +spring: + application: + name: stubrunner + +server: + port: 8750 + +info: + artifactId: "@project.artifactId@" + description: "@project.description@" + version: "@project.version@" \ No newline at end of file