serving/samples/helloworld-rust: simplify and standardize Dockerfile (#502)

This commit is contained in:
Adam Ross 2018-11-26 02:39:22 -07:00 committed by Knative Prow Robot
parent 26a7f1e9dc
commit 5036ec1c9c
2 changed files with 17 additions and 3 deletions

View File

@ -1,10 +1,17 @@
# Use the official Rust image.
# https://hub.docker.com/_/rust
FROM rust:1.27.0 FROM rust:1.27.0
# Copy local code to the container image.
WORKDIR /usr/src/app WORKDIR /usr/src/app
COPY . . COPY . .
# Install production dependencies and build a release artifact.
RUN cargo install RUN cargo install
EXPOSE 8080 # Configure and document the service HTTP port.
ENV PORT 8080
EXPOSE $PORT
# Run the web service on container startup.
CMD ["hellorust"] CMD ["hellorust"]

View File

@ -88,15 +88,22 @@ following instructions recreate the source files from this folder.
block below into it. block below into it.
```docker ```docker
# Use the official Rust image.
# https://hub.docker.com/_/rust
FROM rust:1.27.0 FROM rust:1.27.0
# Copy local code to the container image.
WORKDIR /usr/src/app WORKDIR /usr/src/app
COPY . . COPY . .
# Install production dependencies and build a release artifact.
RUN cargo install RUN cargo install
EXPOSE 8080 # Configure and document the service HTTP port.
ENV PORT 8080
EXPOSE $PORT
# Run the web service on container startup.
CMD ["hellorust"] CMD ["hellorust"]
``` ```