Skip to content

Commit 34220a9

Browse files
PicardParisknative-prow-robot
authored andcommitted
Use smaller images (Node.js, Python, Ruby) (#1749)
1 parent 2c2d37d commit 34220a9

File tree

6 files changed

+17
-17
lines changed

6 files changed

+17
-17
lines changed

docs/serving/samples/hello-world/helloworld-nodejs/Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Use the official Node.js 12 image.
1+
# Use the official lightweight Node.js 12 image.
22
# https://hub.docker.com/_/node
3-
FROM node:12
3+
FROM node:12-slim
44

55
# Create and change to the app directory.
66
WORKDIR /usr/src/app
@@ -14,7 +14,7 @@ COPY package*.json ./
1414
RUN npm install --only=production
1515

1616
# Copy local code to the container image.
17-
COPY . .
17+
COPY . ./
1818

1919
# Run the web service on container startup.
2020
CMD [ "npm", "start" ]

docs/serving/samples/hello-world/helloworld-nodejs/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,9 @@ cd knative-docs/docs/serving/samples/hello-world/helloworld-nodejs
9595
[Dockerizing a Node.js web app](https://nodejs.org/en/docs/guides/nodejs-docker-webapp/).
9696

9797
```Dockerfile
98-
# Use the official Node.js 12 image.
98+
# Use the official lightweight Node.js 12 image.
9999
# https://hub.docker.com/_/node
100-
FROM node:12
100+
FROM node:12-slim
101101

102102
# Create and change to the app directory.
103103
WORKDIR /usr/src/app
@@ -111,7 +111,7 @@ cd knative-docs/docs/serving/samples/hello-world/helloworld-nodejs
111111
RUN npm install --only=production
112112

113113
# Copy local code to the container image.
114-
COPY . .
114+
COPY . ./
115115

116116
# Run the web service on container startup.
117117
CMD [ "npm", "start" ]

docs/serving/samples/hello-world/helloworld-python/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# Use the official Python image.
22
# https://hub.docker.com/_/python
3-
FROM python:3.7
3+
FROM python:3.7-slim
44

55
# Copy local code to the container image.
66
ENV APP_HOME /app
77
WORKDIR $APP_HOME
8-
COPY . .
8+
COPY . ./
99

1010
# Install production dependencies.
1111
RUN pip install Flask gunicorn

docs/serving/samples/hello-world/helloworld-python/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,14 @@ cd knative-docs/docs/serving/samples/hello-world/helloworld-python
5858
details.
5959

6060
```docker
61-
# Use the official Python image.
61+
# Use the official lightweight Python image.
6262
# https://hub.docker.com/_/python
63-
FROM python:3.7
63+
FROM python:3.7-slim
6464
6565
# Copy local code to the container image.
6666
ENV APP_HOME /app
6767
WORKDIR $APP_HOME
68-
COPY . .
68+
COPY . ./
6969
7070
# Install production dependencies.
7171
RUN pip install Flask gunicorn
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Use the official Ruby image.
1+
# Use the official lightweight Ruby image.
22
# https://hub.docker.com/_/ruby
3-
FROM ruby:2.5
3+
FROM ruby:2.5-slim
44

55
# Install production dependencies.
66
WORKDIR /usr/src/app
@@ -9,7 +9,7 @@ ENV BUNDLE_FROZEN=true
99
RUN bundle install
1010

1111
# Copy local code to the container image.
12-
COPY . .
12+
COPY . ./
1313

1414
# Run the web service on container startup.
1515
CMD ["ruby", "./app.rb"]

docs/serving/samples/hello-world/helloworld-ruby/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ cd knative-docs/docs/serving/samples/hello-world/helloworld-ruby
5353
details.
5454

5555
```docker
56-
# Use the official Ruby image.
56+
# Use the official lightweight Ruby image.
5757
# https://hub.docker.com/_/ruby
58-
FROM ruby:2.5
58+
FROM ruby:2.5-slim
5959
6060
# Install production dependencies.
6161
WORKDIR /usr/src/app
@@ -64,7 +64,7 @@ cd knative-docs/docs/serving/samples/hello-world/helloworld-ruby
6464
RUN bundle install
6565
6666
# Copy local code to the container image.
67-
COPY . .
67+
COPY . ./
6868
6969
# Run the web service on container startup.
7070
CMD ["ruby", "./app.rb"]

0 commit comments

Comments
 (0)