mirror of https://github.com/knative/docs.git
serving/samples/helloworld-rust: simplify and standardize Dockerfile (#502)
This commit is contained in:
parent
26a7f1e9dc
commit
5036ec1c9c
|
@ -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
|
||||||
|
|
||||||
CMD ["hellorust"]
|
# Run the web service on container startup.
|
||||||
|
CMD ["hellorust"]
|
||||||
|
|
|
@ -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"]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue