-
Notifications
You must be signed in to change notification settings - Fork 256
Harden Docker container #2153
base: master
Are you sure you want to change the base?
Harden Docker container #2153
Changes from 2 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,8 +1,8 @@ | ||
| FROM alpine | ||
| MAINTAINER Kolide Developers <engineering@kolide.co> | ||
|
|
||
| RUN apk --update add ca-certificates | ||
| FROM gcr.io/distroless/base-debian10:nonroot | ||
| LABEL author Kolide Developers <engineering@kolide.co> | ||
| USER nonroot | ||
|
|
||
| COPY ./build/binary-bundle/linux/fleet ./build/binary-bundle/linux/fleetctl /usr/bin/ | ||
|
|
||
| CMD ["fleet", "serve"] | ||
| EXPOSE 8080 | ||
| CMD ["/usr/bin/fleet", "serve"] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -107,10 +107,10 @@ endif | |
| build: fleet fleetctl | ||
|
|
||
| fleet: .prefix .pre-build .pre-fleet | ||
| go build -i -o build/${OUTPUT} -ldflags ${KIT_VERSION} ./cmd/fleet | ||
| go build -i -o build/${OUTPUT} -ldflags ${KIT_VERSION} -ldflags "-w -s -extldflags '-static'" ./cmd/fleet | ||
|
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. Is this change necessary when using
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. Exactly right, I've changed it to
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. Sorry it wasn't clear, but my preferred strategy would be to leave the build the same while using the
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. @zwass care to share your relationale behind that? Since distroless does not have an update policy, there is no guarantee when they pull in new glibc versions so it would make more sense to me to package that in during compilation. GoogleContainerTools/distroless#326
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. My rationale is that we are changing the build flags for all the binaries produced by this Makefile, not just those being placed in the Docker container. Maybe we can refactor the Makefile in such a way to enable the fully static build for the binary used in the container while leaving other binary builds unchanged?
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. I think it would make more sense to build fleet in a multi-stage container, what do you think? So we can move
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. I am on board with that strategy. It will likely require running |
||
|
|
||
| fleetctl: .prefix .pre-build .pre-fleetctl | ||
| go build -i -o build/fleetctl -ldflags ${KIT_VERSION} ./cmd/fleetctl | ||
| go build -i -o build/fleetctl -ldflags ${KIT_VERSION} -ldflags "-w -s -extldflags '-static'" ./cmd/fleetctl | ||
|
|
||
| lint-js: | ||
| yarn run eslint frontend --ext .js,.jsx | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.