Skip to content

Commit

Permalink
switch to rpm package
Browse files Browse the repository at this point in the history
  • Loading branch information
zyclonite committed Jan 14, 2024
1 parent eed3ca3 commit 236064b
Showing 1 changed file with 25 additions and 24 deletions.
49 changes: 25 additions & 24 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
FROM registry.fedoraproject.org/fedora-minimal:38 as build

ARG VERSION=0.32.1

WORKDIR /src

RUN microdnf -y --nodocs install hostname make protobuf-devel golang git \
golang-github-gogo-protobuf systemd-devel which npm
RUN git clone --depth 1 --branch v${VERSION} https://github.com/grafana/agent.git /src
RUN npm install -g yarn && make generate-ui
RUN rm /src/go.sum && go get
RUN RELEASE_BUILD=1 VERSION=${VERSION} \
GO_TAGS="builtinassets promtail_journal_enabled" \
make agent

FROM registry.fedoraproject.org/fedora-minimal:38

RUN microdnf -y --nodocs install systemd-libs && microdnf clean all && rm -rf /var/lib/dnf /var/cache/*

ENV ASSUME_NO_MOVING_GC_UNSAFE_RISK_IT_WITH=go1.18

COPY --from=build /src/build/grafana-agent /usr/bin/grafana-agent
COPY --from=build /src/cmd/grafana-agent/agent-local-config.yaml /etc/agent/agent.yml
FROM registry.fedoraproject.org/fedora-minimal:39

ARG VERSION=0.39.0

RUN microdnf -y --nodocs install shadow-utils && \
case "$(arch)" in \
aarch64|arm64|arm64e) \
ARCHITECTURE='arm64'; \
;; \
x86_64|amd64|i386) \
ARCHITECTURE='amd64'; \
;; \
*) \
echo "Unsupported architecture"; \
exit 1; \
;; \
esac; \
curl -LfsSo /tmp/gpg.key https://rpm.grafana.com/gpg.key && \
rpm --import /tmp/gpg.key && \
curl -LfsSo /tmp/grafana-agent.rpm https://github.com/grafana/agent/releases/download/v${VERSION}/grafana-agent-${VERSION}-1.${ARCHITECTURE}.rpm && \
rpm -i /tmp/grafana-agent.rpm && \
microdnf -y remove shadow-utils && \
microdnf clean all && \
rm -rf /var/lib/dnf /var/cache/* /tmp/grafana-agent.rpm /tmp/gpg.key

ENTRYPOINT ["/usr/bin/grafana-agent"]

CMD ["--config.file=/etc/agent/agent.yml", "--metrics.wal-directory=/etc/agent/data"]
CMD ["--config.file=/etc/grafana-agent.yaml"]

0 comments on commit 236064b

Please sign in to comment.