# https://github.com/hassio-addons/addon-debian-base/releases # hadolint ignore=DL3006 ARG BUILD_FROM FROM ${BUILD_FROM} # https://github.com/mikefarah/yq/releases ARG YQ_VERSION=4.44.3 ARG PROMTAIL_VERSION=3.2.1 ARG BUILD_ARCH COPY rootfs / # Add yq and tzdata (required for the timestamp stage) RUN set -eux; \ apk update; \ \ apk add --no-cache --virtual .build-deps \ tar; RUN apk add --no-cache \ ca-certificates; RUN update-ca-certificates; RUN case "${BUILD_ARCH}" in \ amd64) BINARCH='amd64' ;; \ armhf) BINARCH='arm' ;; \ armv7) BINARCH='arm' ;; \ aarch64) BINARCH='arm64' ;; \ *) echo >&2 "error: unsupported architecture (${APKARCH})"; exit 1 ;; \ esac; \ curl -s -J -L -o /tmp/yq.tar.gz \ "https://github.com/mikefarah/yq/releases/download/v${YQ_VERSION}/yq_linux_${BINARCH}.tar.gz"; \ tar -xf /tmp/yq.tar.gz -C /usr/bin; \ mv /usr/bin/yq_linux_${BINARCH} /usr/bin/yq; \ chmod a+x /usr/bin/yq; \ rm /tmp/yq.tar.gz; \ yq --version; \ \ rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*; \ chmod +x /etc/cont-init.d/promtail_setup.sh; \ chmod +x /etc/services.d/promtail/*; # Install dependencies for building Promtail RUN apk add --no-cache go git build-base # Download the Promtail source code RUN git clone --branch "v${PROMTAIL_VERSION}" https://github.com/grafana/loki.git /promtail-src # Build Promtail WORKDIR /promtail-src/clients/cmd/promtail RUN go build -o /usr/bin/promtail # Clean up source and unnecessary packages RUN apk del go git build-base && \ rm -rf /promtail-src # Verify the installation RUN /usr/bin/promtail -version WORKDIR /data/promtail # Build arguments ARG BUILD_DATE ARG BUILD_DESCRIPTION ARG BUILD_NAME ARG BUILD_REF ARG BUILD_REPOSITORY ARG BUILD_VERSION # Labels LABEL \ io.hass.name="${BUILD_NAME}" \ io.hass.description="${BUILD_DESCRIPTION}" \ io.hass.arch="${BUILD_ARCH}" \ io.hass.type="addon" \ io.hass.version=${BUILD_VERSION} \ maintainer="Feres" \ org.opencontainers.image.title="${BUILD_NAME}" \ org.opencontainers.image.description="${BUILD_DESCRIPTION}" \ org.opencontainers.image.vendor="Ferfes's Home Assistant Add-ons" \ org.opencontainers.image.authors="Feres" \ org.opencontainers.image.licenses="MIT" \ org.opencontainers.image.url="https://github.com/mdegat01/hassio-addons" \ org.opencontainers.image.source="https://github.com/${BUILD_REPOSITORY}" \ org.opencontainers.image.documentation="https://github.com/${BUILD_REPOSITORY}/blob/main/README.md" \ org.opencontainers.image.created=${BUILD_DATE} \ org.opencontainers.image.revision=${BUILD_REF} \ org.opencontainers.image.version=${BUILD_VERSION}