mirror of https://github.com/knative/docs.git
serving/samples/helloworld-clojure: simplify and standardize Dockerfile (#499)
This commit is contained in:
parent
a25fc162cb
commit
1176fc35c1
|
@ -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
|
FROM clojure
|
||||||
|
|
||||||
# Create the project and download dependencies.
|
# Create the project and download dependencies.
|
||||||
RUN mkdir -p /usr/src/app
|
|
||||||
WORKDIR /usr/src/app
|
WORKDIR /usr/src/app
|
||||||
COPY project.clj /usr/src/app/
|
COPY project.clj .
|
||||||
RUN lein deps
|
RUN lein deps
|
||||||
|
|
||||||
# Copy the local package files inside the container.
|
# Copy local code to the container image.
|
||||||
COPY . /usr/src/app
|
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 mv "$(lein uberjar | sed -n 's/^Created \(.*standalone\.jar\)/\1/p')" app-standalone.jar
|
||||||
|
|
||||||
# Run the app by default when the container starts.
|
# Configure and document the service HTTP port.
|
||||||
CMD ["java", "-jar", "app-standalone.jar"]
|
ENV PORT 8080
|
||||||
|
EXPOSE $PORT
|
||||||
|
|
||||||
# Document that the service listens on port 8080.
|
# Run the web service on container startup.
|
||||||
EXPOSE 8080
|
CMD ["java", "-jar", "app-standalone.jar"]
|
||||||
|
|
|
@ -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).
|
[the clojure image documentation](https://github.com/docker-library/docs/tree/master/clojure).
|
||||||
|
|
||||||
```docker
|
```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
|
FROM clojure
|
||||||
|
|
||||||
# Create the project and download dependencies.
|
# Create the project and download dependencies.
|
||||||
RUN mkdir -p /usr/src/app
|
|
||||||
WORKDIR /usr/src/app
|
WORKDIR /usr/src/app
|
||||||
COPY project.clj /usr/src/app/
|
COPY project.clj .
|
||||||
RUN lein deps
|
RUN lein deps
|
||||||
|
|
||||||
# Copy the local package files inside the container.
|
# Copy local code to the container image.
|
||||||
COPY . /usr/src/app
|
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 mv "$(lein uberjar | sed -n 's/^Created \(.*standalone\.jar\)/\1/p')" app-standalone.jar
|
||||||
|
|
||||||
# Run the app by default when the container starts.
|
# Configure and document the service HTTP port.
|
||||||
CMD ["java", "-jar", "app-standalone.jar"]
|
ENV PORT 8080
|
||||||
|
EXPOSE $PORT
|
||||||
|
|
||||||
# Document that the service listens on port 8080.
|
# Run the web service on container startup.
|
||||||
EXPOSE 8080
|
CMD ["java", "-jar", "app-standalone.jar"]
|
||||||
```
|
```
|
||||||
|
|
||||||
1. Create a new file, `service.yaml` and copy the following service definition
|
1. Create a new file, `service.yaml` and copy the following service definition
|
||||||
|
|
Loading…
Reference in New Issue