diff --git a/serving/samples/helloworld-clojure/Dockerfile b/serving/samples/helloworld-clojure/Dockerfile index 1f0491b4b..8b8e0894e 100644 --- a/serving/samples/helloworld-clojure/Dockerfile +++ b/serving/samples/helloworld-clojure/Dockerfile @@ -1,20 +1,21 @@ -# Start from a Debian image with the latest version of Clojure installed. +# Use the official Clojure image. +# https://hub.docker.com/_/clojure FROM clojure # Create the project and download dependencies. -RUN mkdir -p /usr/src/app WORKDIR /usr/src/app -COPY project.clj /usr/src/app/ +COPY project.clj . RUN lein deps -# Copy the local package files inside the container. -COPY . /usr/src/app +# Copy local code to the container image. +COPY . . -# Build the app as an uberjar. +# Build an uberjar release artifact. RUN mv "$(lein uberjar | sed -n 's/^Created \(.*standalone\.jar\)/\1/p')" app-standalone.jar -# Run the app by default when the container starts. -CMD ["java", "-jar", "app-standalone.jar"] +# Configure and document the service HTTP port. +ENV PORT 8080 +EXPOSE $PORT -# Document that the service listens on port 8080. -EXPOSE 8080 \ No newline at end of file +# Run the web service on container startup. +CMD ["java", "-jar", "app-standalone.jar"] diff --git a/serving/samples/helloworld-clojure/README.md b/serving/samples/helloworld-clojure/README.md index bc0ece4df..97f41e058 100644 --- a/serving/samples/helloworld-clojure/README.md +++ b/serving/samples/helloworld-clojure/README.md @@ -58,26 +58,27 @@ following instructions recreate the source files from this folder. [the clojure image documentation](https://github.com/docker-library/docs/tree/master/clojure). ```docker - # Start from a Debian image with the latest version of Clojure installed. + # Use the official Clojure image. + # https://hub.docker.com/_/clojure FROM clojure # Create the project and download dependencies. - RUN mkdir -p /usr/src/app WORKDIR /usr/src/app - COPY project.clj /usr/src/app/ + COPY project.clj . RUN lein deps - # Copy the local package files inside the container. - COPY . /usr/src/app + # Copy local code to the container image. + COPY . . - # Build the app as an uberjar. + # Build an uberjar release artifact. RUN mv "$(lein uberjar | sed -n 's/^Created \(.*standalone\.jar\)/\1/p')" app-standalone.jar - # Run the app by default when the container starts. - CMD ["java", "-jar", "app-standalone.jar"] + # Configure and document the service HTTP port. + ENV PORT 8080 + EXPOSE $PORT - # Document that the service listens on port 8080. - EXPOSE 8080 + # Run the web service on container startup. + CMD ["java", "-jar", "app-standalone.jar"] ``` 1. Create a new file, `service.yaml` and copy the following service definition