diff --git a/loki/Dockerfile b/loki/Dockerfile index a34ee72..1b61bb2 100644 --- a/loki/Dockerfile +++ b/loki/Dockerfile @@ -1,29 +1,32 @@ # https://github.com/hassio-addons/addon-base/releases ARG BUILD_FROM=ghcr.io/hassio-addons/base/amd64:9.1.5 -# hadolint ignore=DL3006 -FROM $BUILD_FROM - # https://github.com/grafana/loki/releases +FROM alpine:3.13.4 as build ENV LOKI_VERSION 2.2.0 -# Add Loki RUN set -eux; \ + apk update; \ + apk add --no-cache --virtual .build-deps \ + unzip=6.0-r8 \ + curl=7.74.0-r1 \ + ; \ APKARCH="$(apk --print-arch)"; \ case "$APKARCH" in \ - x86_64) BINARCH='amd64' ;; \ - armhf) BINARCH='arm' ;; \ - armv7) BINARCH='arm' ;; \ - aarch64) BINARCH='arm64' ;; \ - *) echo >&2 "error: unsupported architecture ($APKARCH)"; exit 1 ;; \ + x86_64) BINARCH='amd64' ;; \ + armhf) BINARCH='arm' ;; \ + armv7) BINARCH='arm' ;; \ + aarch64) BINARCH='arm64' ;; \ + *) echo >&2 "error: unsupported architecture ($APKARCH)"; exit 1 ;; \ esac; \ - \ curl -J -L -o /tmp/loki.zip "https://github.com/grafana/loki/releases/download/v${LOKI_VERSION}/loki-linux-${BINARCH}.zip"; \ unzip /tmp/loki.zip -d /usr/bin; \ mv /usr/bin/loki-linux-${BINARCH} /usr/bin/loki; \ - chmod a+x /usr/bin/loki; \ - loki -version; \ - rm -f /tmp/loki.zip; + chmod a+x /usr/bin/loki; + + +# hadolint ignore=DL3006 +FROM $BUILD_FROM # add Nginx # hadolint ignore=DL3009 @@ -46,12 +49,16 @@ RUN set -eux; \ # See https://github.com/grafana/loki/issues/1928 RUN [ ! -e /etc/nsswitch.conf ] && echo 'hosts: files dns' > /etc/nsswitch.conf -COPY rootfs / +# Add Loki +COPY --from=build /usr/bin/loki /usr/bin/loki + +WORKDIR /data/loki RUN set -eux; \ - mkdir -p /data/loki; \ + loki --version; \ addgroup -S abc; \ adduser -u 12345 -h /data/loki -D -S abc -G abc; -WORKDIR /data/loki + +COPY rootfs / # Build arguments ARG BUILD_ARCH