-
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
Conversation
|
Hi @PicardParis. Thanks for your PR. I'm waiting for a knative member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
docs/serving/samples/hello-world/helloworld-csharp/helloworld-csharp.csproj
Outdated
Show resolved
Hide resolved
|
|
||
| # Copy local code to the container image. | ||
| COPY . . | ||
| COPY . ./ |
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.
Why add the slash after the second period? Is this a syntax preference or do you have a functional goal?
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.
This is a syntax preference.
2 pros
- All destination folders end with a slash (doc consistency).
- This will prevent some developers from falling into this dockerfile syntax trap where
COPY file1 .works butCOPY file1 file2 .fails. Additionally, the sample patternCOPY *.ext .(without/) will eventually bite (only works if there's exactly 1.extfile). This is used with*.csprojin the C# sample. UsingCOPY *.ext ./also prevents this kind of issues from appearing indirectly.
1 con
COPY . .looks nicer thanCOPY . ./.
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.
| # Use the official lightweight Node.js 12 image. | ||
| # https://hub.docker.com/_/node | ||
| FROM node:12 | ||
| FROM node:12-slim |
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:
- are smaller (x5-10)
- have less known vulnerabilities
For example, with this Node.js change:
- Image is x6 smaller (334 → 54.7 MB)
- There are x7 less detected CVEs (674 → 91)
|
/ok-to-test |
docs/serving/samples/hello-world/helloworld-csharp/helloworld-csharp.csproj
Outdated
Show resolved
Hide resolved
docs/serving/samples/hello-world/helloworld-csharp/helloworld-csharp.csproj
Outdated
Show resolved
Hide resolved
docs/serving/samples/hello-world/helloworld-csharp/helloworld-csharp.csproj
Outdated
Show resolved
Hide resolved
docs/serving/samples/hello-world/helloworld-csharp/helloworld-csharp.csproj
Outdated
Show resolved
Hide resolved
|
/assign @mattmoor |
mattmoor
left a comment
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.
/lgtm
/approve
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mattmoor, PicardParis The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
No description provided.