From ccff770d1470d259ecf7f89fec46b354a155f598 Mon Sep 17 00:00:00 2001 From: Laurent Picard Date: Fri, 30 Aug 2019 11:12:07 +0200 Subject: [PATCH] Use smaller images (Node.js, Python, Ruby) --- .../samples/hello-world/helloworld-nodejs/Dockerfile | 6 +++--- .../serving/samples/hello-world/helloworld-nodejs/README.md | 6 +++--- .../samples/hello-world/helloworld-python/Dockerfile | 4 ++-- .../serving/samples/hello-world/helloworld-python/README.md | 6 +++--- docs/serving/samples/hello-world/helloworld-ruby/Dockerfile | 6 +++--- docs/serving/samples/hello-world/helloworld-ruby/README.md | 6 +++--- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/docs/serving/samples/hello-world/helloworld-nodejs/Dockerfile b/docs/serving/samples/hello-world/helloworld-nodejs/Dockerfile index 5bf4b67c988..14fc5a7f4b5 100644 --- a/docs/serving/samples/hello-world/helloworld-nodejs/Dockerfile +++ b/docs/serving/samples/hello-world/helloworld-nodejs/Dockerfile @@ -1,6 +1,6 @@ -# Use the official Node.js 12 image. +# Use the official lightweight Node.js 12 image. # https://hub.docker.com/_/node -FROM node:12 +FROM node:12-slim # Create and change to the app directory. WORKDIR /usr/src/app @@ -14,7 +14,7 @@ COPY package*.json ./ RUN npm install --only=production # Copy local code to the container image. -COPY . . +COPY . ./ # Run the web service on container startup. CMD [ "npm", "start" ] diff --git a/docs/serving/samples/hello-world/helloworld-nodejs/README.md b/docs/serving/samples/hello-world/helloworld-nodejs/README.md index 18686f56337..37344ead793 100644 --- a/docs/serving/samples/hello-world/helloworld-nodejs/README.md +++ b/docs/serving/samples/hello-world/helloworld-nodejs/README.md @@ -95,9 +95,9 @@ cd knative-docs/docs/serving/samples/hello-world/helloworld-nodejs [Dockerizing a Node.js web app](https://nodejs.org/en/docs/guides/nodejs-docker-webapp/). ```Dockerfile - # Use the official Node.js 12 image. + # Use the official lightweight Node.js 12 image. # https://hub.docker.com/_/node - FROM node:12 + FROM node:12-slim # Create and change to the app directory. WORKDIR /usr/src/app @@ -111,7 +111,7 @@ cd knative-docs/docs/serving/samples/hello-world/helloworld-nodejs RUN npm install --only=production # Copy local code to the container image. - COPY . . + COPY . ./ # Run the web service on container startup. CMD [ "npm", "start" ] diff --git a/docs/serving/samples/hello-world/helloworld-python/Dockerfile b/docs/serving/samples/hello-world/helloworld-python/Dockerfile index 05c054d2ced..ee8b2ebbf49 100644 --- a/docs/serving/samples/hello-world/helloworld-python/Dockerfile +++ b/docs/serving/samples/hello-world/helloworld-python/Dockerfile @@ -1,11 +1,11 @@ # Use the official Python image. # https://hub.docker.com/_/python -FROM python:3.7 +FROM python:3.7-slim # Copy local code to the container image. ENV APP_HOME /app WORKDIR $APP_HOME -COPY . . +COPY . ./ # Install production dependencies. RUN pip install Flask gunicorn diff --git a/docs/serving/samples/hello-world/helloworld-python/README.md b/docs/serving/samples/hello-world/helloworld-python/README.md index 29721a0e4bd..e178eac0c5c 100644 --- a/docs/serving/samples/hello-world/helloworld-python/README.md +++ b/docs/serving/samples/hello-world/helloworld-python/README.md @@ -58,14 +58,14 @@ cd knative-docs/docs/serving/samples/hello-world/helloworld-python details. ```docker - # Use the official Python image. + # Use the official lightweight Python image. # https://hub.docker.com/_/python - FROM python:3.7 + FROM python:3.7-slim # Copy local code to the container image. ENV APP_HOME /app WORKDIR $APP_HOME - COPY . . + COPY . ./ # Install production dependencies. RUN pip install Flask gunicorn diff --git a/docs/serving/samples/hello-world/helloworld-ruby/Dockerfile b/docs/serving/samples/hello-world/helloworld-ruby/Dockerfile index 872152dad7e..cd8e58d721f 100644 --- a/docs/serving/samples/hello-world/helloworld-ruby/Dockerfile +++ b/docs/serving/samples/hello-world/helloworld-ruby/Dockerfile @@ -1,6 +1,6 @@ -# Use the official Ruby image. +# Use the official lightweight Ruby image. # https://hub.docker.com/_/ruby -FROM ruby:2.5 +FROM ruby:2.5-slim # Install production dependencies. WORKDIR /usr/src/app @@ -9,7 +9,7 @@ ENV BUNDLE_FROZEN=true RUN bundle install # Copy local code to the container image. -COPY . . +COPY . ./ # Run the web service on container startup. CMD ["ruby", "./app.rb"] diff --git a/docs/serving/samples/hello-world/helloworld-ruby/README.md b/docs/serving/samples/hello-world/helloworld-ruby/README.md index de9d58e15ab..72b401d94c5 100644 --- a/docs/serving/samples/hello-world/helloworld-ruby/README.md +++ b/docs/serving/samples/hello-world/helloworld-ruby/README.md @@ -53,9 +53,9 @@ cd knative-docs/docs/serving/samples/hello-world/helloworld-ruby details. ```docker - # Use the official Ruby image. + # Use the official lightweight Ruby image. # https://hub.docker.com/_/ruby - FROM ruby:2.5 + FROM ruby:2.5-slim # Install production dependencies. WORKDIR /usr/src/app @@ -64,7 +64,7 @@ cd knative-docs/docs/serving/samples/hello-world/helloworld-ruby RUN bundle install # Copy local code to the container image. - COPY . . + COPY . ./ # Run the web service on container startup. CMD ["ruby", "./app.rb"]