-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Changes from 6 commits
67e1c0a
e71bbd4
5184e14
75c6d05
775b22f
a92aaf2
9116d65
c068028
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 |
---|---|---|
|
@@ -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 /data && \ | ||
chown -R loki:loki /etc/loki /data | ||
|
||
# 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"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,10 +27,10 @@ schema_config: | |
|
||
storage_config: | ||
boltdb: | ||
directory: /loki/index | ||
directory: /data/loki/index | ||
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. nice, thanks for the consistency! 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. @slim-bean you mentioned something about this ? I think you're good with that change right ? 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 used to be /tmp a long time ago and got changed to /loki /loki is annoying because many operating systems don't easily let you create this directory I don't know if /data makes this any easier? my mac is dead at the moment, can you create /data (or does it exist) on mac? 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. No so it's the same :)
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 would be favor of moving this back to 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. @cyriltovena Did you run that inside the OSX docker hypervisor? By default that directory isn't shared with the host (see https://docs.docker.com/docker-for-mac/#file-sharing) So do you want the consistency with the helm image or 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. We are talking about running locally on mac, not in docker at all. This is useful for us for testing/debugging etc, just run the processes and use the loki-local-config.yaml. This broke however when it was changed to #1833 changed this apparently, however Given the sort of dual use of this file as both the config file for a container and also running outside of containers I'm not sure the best path forward here to be honest I'm inclined to say just leave it as is for now and we should tackle this in a separate issue. 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. Ok, I've removed the config file change |
||
|
||
filesystem: | ||
directory: /loki/chunks | ||
directory: /data/loki/chunks | ||
|
||
limits_config: | ||
enforce_metric_name: false | ||
|
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.