-
Notifications
You must be signed in to change notification settings - Fork 267
Add Dockerfile #128
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
base: master
Are you sure you want to change the base?
Add Dockerfile #128
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 |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| dist/ | ||
| testpages/* | ||
| tests/test_results.txt | ||
| robots.html | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,24 @@ | ||||||
| FROM alpine:3.10 AS builder | ||||||
|
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.
Suggested change
|
||||||
| LABEL builder=true | ||||||
|
|
||||||
| ENV CGO_ENABLED=0 | ||||||
|
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.
Suggested change
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. Do we need this? 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. It looks nicer and is easier to convert it to an |
||||||
| ENV GOPATH /go | ||||||
|
|
||||||
| RUN apk add --update -t build-deps go git mercurial libc-dev gcc libgcc | ||||||
|
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.
Suggested change
You don't update base image packages unless it is needed for a reason. |
||||||
| RUN go get github.com/ericchiang/pup \ | ||||||
| && cd $GOPATH/src/github.com/ericchiang/pup \ | ||||||
| && go build \ | ||||||
| -a \ | ||||||
| -ldflags '-s -w -extldflags "-static"' \ | ||||||
| -o /bin/pup | ||||||
| RUN adduser -DH user | ||||||
|
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 line is useless
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. It's preparation for the next build step |
||||||
|
|
||||||
| FROM scratch | ||||||
|
|
||||||
| ENTRYPOINT [ "/pup" ] | ||||||
|
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. Did it get
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.
|
||||||
| CMD [ "--help" ] | ||||||
|
|
||||||
| COPY --from=builder /etc/passwd /etc/passwd | ||||||
|
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. not needed, as you create the user again and the copy can be chowned if needed.
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. See above, the user is only created in another build step, here we only apply the minimal change to "create" the user. The user itself is not really necessary, but I consider it a best practice not to run everything as 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. If we use
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. "best practice" refers more to "give future users a chance to make things right by default", so yes, In fact, I don't actually care if the maintainer of 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. I am pretty sure that a windows variant would have at least 10 more problems cause it is windows and you can't consider everything you might maybe need in the future. Also this would be a problem for the windows eco system when they only support half of docker.
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. Yes, you're right and I fully agree. I hope you got my point, though 😉 |
||||||
| USER user | ||||||
|
|
||||||
| COPY --from=builder /bin/pup /pup | ||||||
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.
You are missing
.gitThere 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.
Right. It doesn't have any impact on the final image, though. I'll add a fixup later