-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Use smaller images (Node.js, Python, Ruby) #1749
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 . ./ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why add the slash after the second period? Is this a syntax preference or do you have a functional goal?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a syntax preference. 2 pros
1 con
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| # Run the web service on container startup. | ||
| CMD [ "npm", "start" ] | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the choice of slim here, as it keeps the container closer to what developers expect.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Many developers are going to copy/paste these samples and adapt/use them in production. The motivation for this PR is to use images that:
For example, with this Node.js change: