Skip to content

Commit 3723423

Browse files
authored
Include smart agent bundle in docker image (#241)
1 parent e579e2e commit 3723423

File tree

2 files changed

+25
-4
lines changed

2 files changed

+25
-4
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ delete-tag:
191191
docker-otelcol:
192192
GOOS=linux $(MAKE) otelcol
193193
cp ./bin/otelcol_linux_amd64 ./cmd/otelcol/otelcol
194-
docker build -t otelcol ./cmd/otelcol/
194+
docker build -t otelcol --build-arg SMART_AGENT_RELEASE=$(SMART_AGENT_RELEASE) ./cmd/otelcol/
195195
rm ./cmd/otelcol/otelcol
196196

197197
.PHONY: binaries-all-sys

cmd/otelcol/Dockerfile

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,37 @@
1-
FROM alpine:3.12 as certs
1+
ARG SMART_AGENT_RELEASE=v5.9.1
2+
ARG ALPINE_VERSION=3.12
3+
4+
FROM alpine:${ALPINE_VERSION} as certs
25
RUN apk --update add ca-certificates
36

4-
FROM alpine:3.12 AS otelcol
7+
FROM alpine:${ALPINE_VERSION} AS otelcol
58
COPY otelcol /
69
# Note that this shouldn't be necessary, but in some cases the file seems to be
710
# copied with the execute bit lost (see #1317)
811
RUN chmod 755 /otelcol
912

13+
FROM alpine:${ALPINE_VERSION} AS smartagent
14+
ARG SMART_AGENT_RELEASE
15+
RUN mkdir -p "$(dirname "/usr/lib/splunk-otel-collector/agent-bundle")" && \
16+
SMART_AGENT=signalfx-agent-${SMART_AGENT_RELEASE#v}.tar.gz && \
17+
URL=https://github.com/signalfx/signalfx-agent/releases/download/${SMART_AGENT_RELEASE}/$SMART_AGENT && \
18+
wget "$URL" && tar -xzf $SMART_AGENT && mv signalfx-agent /usr/lib/splunk-otel-collector/agent-bundle && \
19+
# Absolute path of interpreter in smart agent dir is set in dependent binaries
20+
# requiring the interpreter location not to change.
21+
/usr/lib/splunk-otel-collector/agent-bundle/bin/patch-interpreter /usr/lib/splunk-otel-collector/agent-bundle && \
22+
rm -f /usr/lib/splunk-otel-collector/agent-bundle/bin/signalfx-agent \
23+
/usr/lib/splunk-otel-collector/agent-bundle/bin/agent-status \
24+
$SMART_AGENT
25+
1026
FROM scratch
27+
ENV SPLUNK_BUNDLE_DIR=/usr/lib/splunk-otel-collector/agent-bundle
28+
ENV SPLUNK_COLLECTD_DIR=$SIGNALFX_BUNDLE_DIR/run/collectd
1129
COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
1230
COPY --from=otelcol /otelcol /
13-
COPY config/collector/gateway_config.yaml /etc/otel/collector/gateway_config.yaml
31+
# Maintaining interpreter location as required.
32+
COPY --from=smartagent /usr/lib/splunk-otel-collector/agent-bundle /usr/lib/splunk-otel-collector/agent-bundle
33+
COPY config/collector/gateway_config.yaml /etc/otel/collector/gateway_config.yaml
1434
COPY config/collector/otlp_config_linux.yaml /etc/otel/collector/otlp_config_linux.yaml
35+
COPY config/collector/agent_config.yaml /etc/otel/collector/agent_config.yaml
1536
ENTRYPOINT ["/otelcol"]
1637
EXPOSE 13133 14250 14268 55680 4317 6060 7276 8888 9411 9443

0 commit comments

Comments
 (0)