blumeops/containers/alloy/Dockerfile
Erich Blume 613f05dfde
All checks were successful
Build Container (Nix) / detect (push) Successful in 2s
Build Container / detect (push) Successful in 2s
Build Container (Nix) / build (alloy) (push) Successful in 9s
Build Container (Nix) / build (cv) (push) Successful in 2s
Build Container (Nix) / build (devpi) (push) Successful in 2s
Build Container (Nix) / build (grafana) (push) Successful in 2s
Build Container / build (cv) (push) Successful in 20s
Build Container (Nix) / build (grafana-sidecar) (push) Successful in 2s
Build Container (Nix) / build (homepage) (push) Successful in 2s
Build Container (Nix) / build (kiwix-serve) (push) Successful in 2s
Build Container (Nix) / build (kubectl) (push) Successful in 3s
Build Container (Nix) / build (loki) (push) Successful in 2s
Build Container / build (alloy) (push) Successful in 40s
Build Container (Nix) / build (mealie) (push) Successful in 1s
Build Container (Nix) / build (miniflux) (push) Successful in 2s
Build Container (Nix) / build (navidrome) (push) Successful in 2s
Build Container / build (devpi) (push) Successful in 41s
Build Container (Nix) / build (nettest) (push) Successful in 15s
Build Container / build (grafana-sidecar) (push) Successful in 1m27s
Build Container / build (grafana) (push) Successful in 3m23s
Build Container (Nix) / build (ntfy) (push) Successful in 3m19s
Build Container (Nix) / build (prometheus) (push) Successful in 1s
Build Container (Nix) / build (quartz) (push) Successful in 1s
Build Container (Nix) / build (runner-job-image) (push) Successful in 1s
Build Container (Nix) / build (teslamate) (push) Successful in 2s
Build Container (Nix) / build (transmission) (push) Successful in 2s
Build Container (Nix) / build (transmission-exporter) (push) Successful in 1s
Build Container (Nix) / build (unpoller) (push) Successful in 1s
Build Container / build (kiwix-serve) (push) Successful in 1m17s
Build Container / build (kubectl) (push) Successful in 41s
Build Container / build (homepage) (push) Successful in 8m21s
Build Container / build (mealie) (push) Successful in 1m1s
Build Container / build (loki) (push) Successful in 8m21s
Build Container / build (miniflux) (push) Successful in 2m24s
Build Container / build (nettest) (push) Successful in 14s
Build Container / build (ntfy) (push) Successful in 8m33s
Build Container / build (prometheus) (push) Successful in 37s
Build Container / build (quartz) (push) Successful in 19s
Build Container / build (navidrome) (push) Successful in 10m36s
Build Container / build (runner-job-image) (push) Successful in 3m18s
Build Container / build (transmission) (push) Successful in 20s
Build Container / build (transmission-exporter) (push) Successful in 21s
Build Container / build (unpoller) (push) Successful in 11s
Build Container / build (teslamate) (push) Successful in 4m42s
Add consistent OCI labels to all container Dockerfiles
Every container now carries title, description, version, source, and
vendor labels per the OCI image spec. Version is derived from the
existing CONTAINER_APP_VERSION ARG at build time.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 20:42:00 -07:00

68 lines
2.1 KiB
Docker

# Grafana Alloy telemetry collector
# Three-stage build: Web UI (Node), server (Go), runtime (Alpine)
ARG CONTAINER_APP_VERSION=1.14.0
ARG ALLOY_VERSION=v${CONTAINER_APP_VERSION}
ARG ALLOY_COMMIT=626a738319812d58ebc25ca6d71651f4925b8b18
FROM node:22-alpine AS ui-build
ARG ALLOY_COMMIT
RUN apk add --no-cache git
RUN mkdir /app && cd /app \
&& git init \
&& git remote add origin https://forge.ops.eblu.me/mirrors/alloy.git \
&& git fetch --depth 1 origin ${ALLOY_COMMIT} \
&& git checkout FETCH_HEAD
WORKDIR /app/internal/web/ui
RUN npm ci
RUN npx tsc -b && npx vite build
FROM golang:1.25-alpine3.22 AS build
ARG ALLOY_VERSION
ARG ALLOY_COMMIT
RUN apk add --no-cache build-base git
RUN mkdir /app && cd /app \
&& git init \
&& git remote add origin https://forge.ops.eblu.me/mirrors/alloy.git \
&& git fetch --depth 1 origin ${ALLOY_COMMIT} \
&& git checkout FETCH_HEAD
WORKDIR /app
# Copy pre-built web UI assets
COPY --from=ui-build /app/internal/web/ui/dist /app/internal/web/ui/dist
ENV CGO_ENABLED=1
# promtail_journal_enabled omitted: requires systemd headers (libsystemd-dev)
# and our k8s deployments read pod logs from the filesystem, not journald
RUN RELEASE_BUILD=1 VERSION=${ALLOY_VERSION} \
GO_TAGS="netgo embedalloyui" \
SKIP_UI_BUILD=1 \
make alloy
FROM alpine:3.22
ARG CONTAINER_APP_VERSION
LABEL org.opencontainers.image.title="Alloy"
LABEL org.opencontainers.image.description="Grafana Alloy is an OpenTelemetry Collector distribution"
LABEL org.opencontainers.image.version="${CONTAINER_APP_VERSION}"
LABEL org.opencontainers.image.source="https://forge.eblu.me/eblume/blumeops"
LABEL org.opencontainers.image.vendor="blumeops"
RUN apk --no-cache add ca-certificates tzdata \
&& addgroup -g 473 alloy \
&& adduser -D -u 473 -G alloy alloy \
&& mkdir -p /var/lib/alloy/data \
&& chown -R alloy:alloy /var/lib/alloy
COPY --from=build --chown=473:473 /app/build/alloy /bin/alloy
ENTRYPOINT ["/bin/alloy"]
ENV ALLOY_DEPLOY_MODE=docker
CMD ["run", "/etc/alloy/config.alloy", "--storage.path=/var/lib/alloy/data"]