diff --git a/Dockerfile b/Dockerfile index 7ac54191..079792af 100644 --- a/Dockerfile +++ b/Dockerfile @@ -44,14 +44,27 @@ FROM ankane/pgvector:v0.5.1 AS runtime # Overridable Node.js version with --build-arg NODE_VERSION ARG NODE_VERSION=22 -RUN apt-get update && \ +# Allow overriding the OpenTelemetry Collector version and let Docker inject TARGETARCH during build +ARG OTEL_VERSION=0.96.0 +ARG TARGETARCH + +RUN set -eux; \ + # Map TARGETARCH to the naming used by otel release assets + case "${TARGETARCH:-amd64}" in \ + arm64|aarch64) OTEL_ARCH=arm64 ;; \ + amd64|x86_64|x64) OTEL_ARCH=amd64 ;; \ + *) OTEL_ARCH=amd64 ;; \ + esac; \ + apt-get update && \ # Install curl, Python, and PostgreSQL client libraries apt-get install -y curl python3 python3-venv libpq-dev && \ # Install Node.js curl -fsSL https://deb.nodesource.com/setup_${NODE_VERSION}.x | bash - && \ apt-get install -y nodejs && \ - # Install OpenTelemetry Collector - curl -L https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v0.96.0/otelcol-contrib_0.96.0_linux_amd64.tar.gz -o /tmp/otel-collector.tar.gz && \ + # Download and install OpenTelemetry Collector for the target architecture + OTEL_FILENAME="otelcol-contrib_${OTEL_VERSION}_linux_${OTEL_ARCH}.tar.gz"; \ + echo "Downloading https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v${OTEL_VERSION}/${OTEL_FILENAME}"; \ + curl -L "https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v${OTEL_VERSION}/${OTEL_FILENAME}" -o /tmp/otel-collector.tar.gz && \ tar xzf /tmp/otel-collector.tar.gz -C /usr/local/bin && \ rm /tmp/otel-collector.tar.gz && \ mkdir -p /etc/otel && \