1FROM golang:1.16.2 as build 2# TOUCH_PROTOS signifies if we should touch the compiled proto files and thus not regenerate them. 3# This is helpful when file system timestamps can't be trusted with make 4ARG TOUCH_PROTOS 5COPY . /src/loki 6WORKDIR /src/loki 7RUN make clean && (if [ "${TOUCH_PROTOS}" ]; then make touch-protos; fi) && make BUILD_IN_CONTAINER=false loki 8 9FROM alpine:3.13 10 11RUN apk add --no-cache ca-certificates libcap 12 13COPY --from=build /src/loki/cmd/loki/loki /usr/bin/loki 14COPY cmd/loki/loki-docker-config.yaml /etc/loki/local-config.yaml 15 16RUN addgroup -g 10001 -S loki && \ 17 adduser -u 10001 -S loki -G loki 18RUN mkdir -p /loki/rules && \ 19 mkdir -p /loki/rules-temp && \ 20 chown -R loki:loki /etc/loki /loki 21 22# See https://github.com/grafana/loki/issues/1928 23RUN [ ! -e /etc/nsswitch.conf ] && echo 'hosts: files dns' > /etc/nsswitch.conf 24 25USER loki 26EXPOSE 3100 27ENTRYPOINT [ "/usr/bin/loki" ] 28CMD ["-config.file=/etc/loki/local-config.yaml"] 29