|
| 1 | +FROM --platform=$BUILDPLATFORM registry.redhat.io/ubi9/go-toolset:latest as golang_builder |
| 2 | +ARG BUILDPLATFORM |
| 3 | + |
| 4 | +USER root |
| 5 | + |
| 6 | +ENV CONTROLLER_GEN_VERSION v0.9.2 |
| 7 | + |
| 8 | +RUN curl -L https://get.helm.sh/helm-v3.19.0-linux-$(echo $BUILDPLATFORM | cut -d '/' -f2).tar.gz -o ./helm.tar.gz \ |
| 9 | + && tar -zxvf ./helm.tar.gz \ |
| 10 | + && mv ./linux-$(echo $BUILDPLATFORM | cut -d '/' -f2)/helm /usr/bin/helm |
| 11 | + |
| 12 | +RUN GOFLAGS="-mod=mod" go install sigs.k8s.io/controller-tools/cmd/controller-gen@$CONTROLLER_GEN_VERSION \ |
| 13 | + && GOFLAGS="-mod=mod" go install github.com/mitchellh/ [email protected] \ |
| 14 | + && GOFLAGS="-mod=mod" go install github.com/tcnksm/ [email protected] \ |
| 15 | + && GOFLAGS="-mod=mod" go install github.com/grafana/tanka/cmd/ [email protected] \ |
| 16 | + && GOFLAGS="-mod=mod" go install github.com/jsonnet-bundler/jsonnet-bundler/cmd/ [email protected] \ |
| 17 | + && GOFLAGS="-mod=mod" go install github.com/google/go-jsonnet/cmd/ [email protected] \ |
| 18 | + && GOFLAGS="-mod=mod" go install github.com/golang/protobuf/ [email protected] \ |
| 19 | + && GOFLAGS="-mod=mod" go install github.com/gogo/protobuf/ [email protected] \ |
| 20 | + && GOFLAGS="-mod=mod" go install github.com/gogo/protobuf/gogoproto/ [email protected] \ |
| 21 | + && GOFLAGS="-mod=mod" go install github.com/ahmetb/ [email protected] \ |
| 22 | + && GOFLAGS="-mod=mod" go install github.com/norwoodj/helm-docs/cmd/ [email protected] |
| 23 | + |
| 24 | +RUN yum install -y cmake systemd-devel \ |
| 25 | + && npm install -g yarn \ |
| 26 | + && node -v \ |
| 27 | + && yarn -v |
| 28 | + |
| 29 | +COPY . /src |
| 30 | +WORKDIR /src/alloy/internal/web/ui/ |
| 31 | +RUN yarn --network-timeout=120000000 && yarn run build |
| 32 | + |
| 33 | +WORKDIR /src/alloy |
| 34 | + |
| 35 | +RUN GO_TAGS="builtinassets promtail_journal_enabled" GOOS="linux" GOARCH= GOARM= RELEASE_BUILD=1 make alloy |
| 36 | + |
| 37 | +# Stage 2 |
| 38 | +FROM --platform=$BUILDPLATFORM registry.access.redhat.com/ubi10-minimal:latest |
| 39 | + |
| 40 | +ARG UID="473" |
| 41 | +ARG USERNAME="alloy" |
| 42 | + |
| 43 | +RUN microdnf update -y |
| 44 | + |
| 45 | +RUN microdnf install -y tzdata shadow-utils |
| 46 | + |
| 47 | +COPY --from=golang_builder --chown=${UID}:${UID} /src/alloy/build/alloy /bin/alloy |
| 48 | +COPY --chown=${UID}:${UID} ./alloy/example-config.alloy /etc/alloy/config.alloy |
| 49 | + |
| 50 | +RUN groupadd --gid $UID $USERNAME \ |
| 51 | + && useradd -m -u $UID -g $UID $USERNAME \ |
| 52 | + && mkdir -p /var/lib/alloy/data \ |
| 53 | + && chown -R $USERNAME:$USERNAME /var/lib/alloy \ |
| 54 | + && chmod -R 770 /var/lib/alloy |
| 55 | + |
| 56 | +COPY alloy/LICENSE /licenses/ |
| 57 | + |
| 58 | +# Standard Red Hat labels |
| 59 | +LABEL com.redhat.component="alloy-container" |
| 60 | +LABEL name="alloy" |
| 61 | +LABEL version="v1.10.2" |
| 62 | +LABEL summary="Provides alloy container" |
| 63 | +LABEL io.k8s.display-name="Alloy container" |
| 64 | +LABEL maintainer="Rakshitha Kamath < [email protected]>" |
| 65 | +LABEL description="Grafana Alloy is an open source OpenTelemetry Collector distribution with built-in Prometheus pipelines and support for metrics, logs, traces, and profiles." |
| 66 | +LABEL io.k8s.description="Grafana Alloy is an open source OpenTelemetry Collector distribution with built-in Prometheus pipelines and support for metrics, logs, traces, and profiles." |
| 67 | +LABEL io.openshift.tags="Alloy container" |
| 68 | + |
| 69 | +# The CPE (Common Platform Enumeration) identifier for Ceph. |
| 70 | +LABEL cpe=cpe:/a:redhat:ceph_storage:9::el10 |
| 71 | + |
| 72 | +# Add Creation date label |
| 73 | +LABEL org.opencontainers.image.created="${BUILD_DATE}" |
| 74 | + |
| 75 | +ENTRYPOINT ["/bin/alloy"] |
| 76 | +ENV ALLOY_DEPLOY_MODE=docker |
| 77 | +CMD ["run", "/etc/alloy/config.alloy", "--storage.path=/var/lib/alloy/data"] |
0 commit comments