-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
[Loki]: Cleanup dockerfile #1949
Merged
cyriltovena
merged 8 commits into
grafana:master
from
SerialVelocity:feature/cleanup-dockerfile
Apr 23, 2020
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
67e1c0a
Reduce the amount of layers and data in the Dockerfile
SerialVelocity e71bbd4
Change the loki user and data directory to match the default helm con…
SerialVelocity 5184e14
Add an nsswitch.conf to stop localhost DNS requests
SerialVelocity 75c6d05
Copy changes to Dockerfile.cross except setep
SerialVelocity 775b22f
Install ca-certificates earlier and split creating user and creating …
SerialVelocity a92aaf2
Install libcap earlier and don't bother deleting it as it doesn't mak…
SerialVelocity 9116d65
Revert config changes
SerialVelocity c068028
Revert the dockerfile changes needed for the config revert
SerialVelocity File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,9 +13,21 @@ WORKDIR /src/loki | |
RUN make clean && GOARCH=$(cat /goarch) GOARM=$(cat /goarm) make BUILD_IN_CONTAINER=false loki | ||
|
||
FROM alpine:3.9 | ||
RUN apk add --update --no-cache ca-certificates | ||
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 this should remain earlier in the file for caching benefits. 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. Moved back to the top |
||
|
||
RUN apk add --no-cache ca-certificates | ||
|
||
COPY --from=build /src/loki/cmd/loki/loki /usr/bin/loki | ||
COPY cmd/loki/loki-local-config.yaml /etc/loki/local-config.yaml | ||
EXPOSE 80 | ||
|
||
RUN addgroup -g 10001 -S loki && \ | ||
adduser -u 10001 -S loki -G loki | ||
RUN mkdir -p /loki && \ | ||
chown -R loki:loki /etc/loki /loki | ||
|
||
# See https://github.com/grafana/loki/issues/1928 | ||
RUN [ ! -e /etc/nsswitch.conf ] && echo 'hosts: files dns' > /etc/nsswitch.conf | ||
|
||
USER loki | ||
EXPOSE 3100 | ||
ENTRYPOINT [ "/usr/bin/loki" ] | ||
CMD ["-config.file=/etc/loki/local-config.yaml"] |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 think there's a tradeoff here of caching vs layer reduction and I'm inclined to think that caching is a bit more preferrable although I'm biased by building this regularly. That being said, I don't think it's a huge deal either way.
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.
sry deleted my last message, didn't read closely enough
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 think I'd like to leave this as is, same as the changes below for 2 reasons:
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.
Could you elaborate on what you spent a lot of time testing? Adding a new package should be as simple as adding an
apk add --no-cache <pkgname>
.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.
All the cap stuff was new and we tried several combinations of where to install
libcap
as well as removing it and where to remove it to keep the resulting image size as small as possible as well as make sure it still works.