From 5036ec1c9ccf186af85d575ae0bd63bf84cbd25a Mon Sep 17 00:00:00 2001 From: Adam Ross Date: Mon, 26 Nov 2018 02:39:22 -0700 Subject: [PATCH] serving/samples/helloworld-rust: simplify and standardize Dockerfile (#502) --- serving/samples/helloworld-rust/Dockerfile | 11 +++++++++-- serving/samples/helloworld-rust/README.md | 9 ++++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/serving/samples/helloworld-rust/Dockerfile b/serving/samples/helloworld-rust/Dockerfile index c3de829fb..84d3c30c1 100644 --- a/serving/samples/helloworld-rust/Dockerfile +++ b/serving/samples/helloworld-rust/Dockerfile @@ -1,10 +1,17 @@ +# Use the official Rust image. +# https://hub.docker.com/_/rust FROM rust:1.27.0 +# Copy local code to the container image. WORKDIR /usr/src/app COPY . . +# Install production dependencies and build a release artifact. RUN cargo install -EXPOSE 8080 +# Configure and document the service HTTP port. +ENV PORT 8080 +EXPOSE $PORT -CMD ["hellorust"] \ No newline at end of file +# Run the web service on container startup. +CMD ["hellorust"] diff --git a/serving/samples/helloworld-rust/README.md b/serving/samples/helloworld-rust/README.md index 0a2030a0e..75faa7471 100644 --- a/serving/samples/helloworld-rust/README.md +++ b/serving/samples/helloworld-rust/README.md @@ -88,15 +88,22 @@ following instructions recreate the source files from this folder. block below into it. ```docker + # Use the official Rust image. + # https://hub.docker.com/_/rust FROM rust:1.27.0 + # Copy local code to the container image. WORKDIR /usr/src/app COPY . . + # Install production dependencies and build a release artifact. 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"] ```