← Back to team overview

ubuntu-docker-images team mailing list archive

[RFC/RFA] Loki Dockerfile

 

Hi,

I have just finished putting together the first version of the Grafana
Loki Dockerfile.  It is heavily based on our other snap-based
Dockerfiles, specifically the one for Prometheus.

I haven't written any documentation/tests for it yet; I intend to start
doing that next week.  The Loki snap is already available, which means
that this Dockerfile should work out of the box.

Let me know what you think.  Thanks.

--8<---------------cut here---------------start------------->8---
FROM ubuntu:jammy AS snap-installer

RUN set -eux; \
	apt-get update; \
	DEBIAN_FRONTEND=noninteractive apt-get full-upgrade -y; \
	DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
		jq curl ca-certificates squashfs-tools; \
# taken from https://snapcraft.io/docs/build-on-docker
# Alternatively, we can install snapd, and issue `snap download loki`
	curl -L -H 'Snap-CDN: none' $(curl -H 'X-Ubuntu-Series: 16'  -H "X-Ubuntu-Architecture: $(dpkg --print-architecture)" 'https://api.snapcraft.io/api/v1/snaps/details/loki?channel=rock/edge' | jq '.download_url' -r) --output loki.snap; \
	mkdir -p /snap; \
	unsquashfs -d /snap/loki loki.snap; \
# The configuration file present in the snap makes use of
# snap-specific variables, so we have to remove them here.
	sed -i 's/\${SNAP_COMMON}\(.*\)/\1/' /snap/loki/etc/loki/loki.yaml

FROM ubuntu:jammy

ENV TZ UTC

RUN set -eux; \
	apt-get update; \
	DEBIAN_FRONTEND=noninteractive apt-get full-upgrade -y; \
	DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
		tzdata ca-certificates; \
	rm -rf /var/lib/apt/lists/*; \
	mkdir -p /loki; \
	mkdir -p /usr/share/rocks; \
# create deb manifest
	(echo "# os-release" && cat /etc/os-release && echo "# dpkg-query" && dpkg-query -f '${db:Status-Abbrev},${binary:Package},${Version},${source:Package},${Source:Version}\n' -W) > /usr/share/rocks/dpkg.query

COPY --from=snap-installer /snap/loki/bin/loki /usr/bin/loki
COPY --from=snap-installer /snap/loki/bin/promtail /usr/bin/promtail
COPY --from=snap-installer /snap/loki/bin/logcli /usr/bin/logcli
COPY --from=snap-installer /snap/loki/etc/loki/loki.yaml /etc/loki/loki.yaml

# Copy the manifest files from the snap
COPY --from=snap-installer /snap/loki/snap/snapcraft.yaml /usr/share/rocks/
COPY --from=snap-installer /snap/loki/snap/manifest.yaml /usr/share/rocks/

# Expose port, configure volume and define the entrypoint
EXPOSE     3100
VOLUME     [ "/loki" ]
WORKDIR    /loki
ENTRYPOINT [ "/usr/bin/loki" ]
CMD        [ "-config.file=/etc/loki/loki.yaml" ]
--8<---------------cut here---------------end--------------->8---

-- 
Sergio
GPG key ID: E92F D0B3 6B14 F1F4 D8E0  EB2F 106D A1C8 C3CB BF14


Follow ups