mirror of https://github.com/knative/docs.git
Removing the PORT environment variable from Docker file and Java code. (#1211)
This commit is contained in:
parent
0d8cfba60f
commit
1b6c806ccb
|
@ -18,9 +18,6 @@ FROM openjdk:8-jre-alpine
|
|||
# Copy the jar to the production image from the builder stage.
|
||||
COPY --from=builder /app/target/helloworld-0.0.1-SNAPSHOT-jar-with-dependencies.jar /helloworld.jar
|
||||
|
||||
# Service must listen to $PORT environment variable.
|
||||
# This default value facilitates local development.
|
||||
ENV PORT 8080
|
||||
|
||||
# Run the web service on container startup.
|
||||
CMD ["java","-Dserver.port=${PORT}","-jar","/helloworld.jar"]
|
||||
|
|
|
@ -8,10 +8,17 @@ public class HelloWorldApplication {
|
|||
|
||||
|
||||
public static void main(String args[]) {
|
||||
//Default port in SparkJava is 4567
|
||||
// Setting the PORT to 8080 here
|
||||
if(System.getenv("PORT") != null)
|
||||
port(Integer.valueOf(System.getenv("PORT")));
|
||||
|
||||
/*
|
||||
* Please Note:
|
||||
* Default port in SparkJava is 4567
|
||||
* If you wish to use port of your choice,
|
||||
* uncomment the following code and set the
|
||||
* required port
|
||||
*/
|
||||
|
||||
//private static final String PORT = "8080";
|
||||
//port(Integer.valueOf(System.getenv("PORT")));
|
||||
|
||||
if( System.getenv("TARGET") == null)
|
||||
message = "World";
|
||||
|
|
Loading…
Reference in New Issue