From c41f9193e87ce0c6eab578047c5b55809a54f42a Mon Sep 17 00:00:00 2001 From: Averi Kitsch Date: Tue, 27 Nov 2018 11:51:23 -0800 Subject: [PATCH] update Docker file to respect PORT (#523) --- serving/samples/helloworld-java/Dockerfile | 3 ++- serving/samples/helloworld-java/README.md | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/serving/samples/helloworld-java/Dockerfile b/serving/samples/helloworld-java/Dockerfile index 2e1c64734..6e2290853 100644 --- a/serving/samples/helloworld-java/Dockerfile +++ b/serving/samples/helloworld-java/Dockerfile @@ -23,4 +23,5 @@ ENV PORT 8080 EXPOSE $PORT # Run the web service on container startup. -CMD [ "java", "-Djava.security.egd=file:/dev/./urandom", "-jar", "/helloworld.jar" ] +CMD ["java","-Djava.security.egd=file:/dev/./urandom","-Dserver.port=${PORT}","-jar","/helloworld.jar"] + diff --git a/serving/samples/helloworld-java/README.md b/serving/samples/helloworld-java/README.md index 476aa81d3..5ddcdd331 100644 --- a/serving/samples/helloworld-java/README.md +++ b/serving/samples/helloworld-java/README.md @@ -71,7 +71,7 @@ recreate the source files from this folder. 1. Run the application locally: ```shell - ./mvnw package && java -jar target/gs-spring-boot-docker-0.1.0.jar + ./mvnw package && java -jar target/helloworld-0.0.1-SNAPSHOT.jar ``` Go to `http://localhost:8080/` to see your `Hello World!` message. @@ -108,7 +108,7 @@ recreate the source files from this folder. EXPOSE $PORT # Run the web service on container startup. - CMD [ "java", "-Djava.security.egd=file:/dev/./urandom", "-jar", "/helloworld.jar" ] + CMD ["java","-Djava.security.egd=file:/dev/./urandom","-Dserver.port=${PORT}","-jar","/helloworld.jar"] ``` 1. Create a new file, `service.yaml` and copy the following service definition