feat: update Dockerfile.tpl to use new OpenTelemetry Collector version and improve gomplate installation

This commit is contained in:
Simon Larsen
2025-01-22 12:44:22 +00:00
parent 23be5b1736
commit 5494a2244e
3 changed files with 12 additions and 11 deletions

View File

@@ -1,3 +1,7 @@
FROM otel/opentelemetry-collector-contrib:0.118.0
FROM public.ecr.aws/ubuntu/ubuntu:25.04
ENV COLLECTOR_VERSION=0.104.0
@@ -18,11 +22,10 @@ RUN /bin/bash -c 'set -ex && \
curl -o /usr/local/bin/gomplate -sSL https://github.com/hairyhenderson/gomplate/releases/download/v3.11.3/gomplate_Linux-$ARCHITECTURE && \
echo "Downloaded gomplate" && \
chmod 755 /usr/local/bin/gomplate && \
echo "Installed gomplate" && \
wget "https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v${COLLECTOR_VERSION}/otelcol_${COLLECTOR_VERSION}_$(uname -s)_${ARCHITECTURE}.deb" && \
echo "Downloaded otelcol_${COLLECTOR_VERSION}_$(uname -s)_${ARCHITECTURE}.deb" && \
dpkg -i otelcol_${COLLECTOR_VERSION}_$(uname -s)_${ARCHITECTURE}.deb && \
echo "Installed otelcol_${COLLECTOR_VERSION}_$(uname -s)_${ARCHITECTURE}.deb"'
echo "Installed gomplate"'
# Copy Otel Colector Binary from Previous Stage
COPY --from=0 /otelcol-contrib /usr/bin/otelcol
# Copy the configuration template file config.yaml.tpl
COPY ./OTelCollector/otel-collector-config.template.yaml /etc/otel-collector-config.template.yaml

View File

@@ -56,9 +56,11 @@ service:
endpoint: {{ .Env.OPENTELEMETRY_EXPORTER_OTLP_ENDPOINT }}
{{ if .Env.OPENTELEMETRY_EXPORTER_OTLP_HEADERS }}
headers:
{{- $headers := (split "," .Env.OPENTELEMETRY_EXPORTER_OTLP_HEADERS) -}}
# Add new line
{{ "" }}
{{- $headers := (strings.Split "," .Env.OPENTELEMETRY_EXPORTER_OTLP_HEADERS) -}}
{{- range $header := $headers }}
{{- $kv := (split "=" $header) }}
{{- $kv := (strings.Split "=" $header) }}
{{- (index $kv 0) }}: {{ (index $kv 1) }}
{{- end }}
{{ end }}

View File

@@ -284,8 +284,6 @@ services:
extends:
file: ./docker-compose.base.yml
service: probe-1
ports:
- '9655:9229' # Debugging port.
build:
network: host
context: .
@@ -305,8 +303,6 @@ services:
extends:
file: ./docker-compose.base.yml
service: probe-2
ports:
- '9656:9229' # Debugging port.
build:
network: host
context: .