You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Setup the OpenTelemetry Collector and its dependenciesFROM golang:1-bookworm AS oteld-build
# mdatagen cannot be installed via go install, see: https://github.com/open-telemetry/opentelemetry-collector/issues/9281# RUN go install github.com/open-telemetry/opentelemetry-collector/cmd/mdatagen@latestARG OTELCOL_VERSION=v0.118.0
RUN git clone --branch ${OTELCOL_VERSION} --depth 1 https://github.com/open-telemetry/opentelemetry-collector.git && \
cd opentelemetry-collector/cmd/mdatagen && \
go install .
# Install dependenciesRUN go install go.opentelemetry.io/collector/cmd/builder@${OTELCOL_VERSION} && \
// other dependencies
WORKDIR /otel
# Copy the source codeCOPY src ./
# Download go modulesRUN go mod download
# Generate metadataRUN cd exporters/customreceiver && go mod download && go generate
RUN cd /otel/exporters/customreceiver && mdatagen metadata.yaml
# Build the OpenTelemetry CollectorRUN builder --config builder-config.yaml
# Build the final imageFROM debian:bookworm-slim AS oteld-final
COPY --chmod=755 --from=otel-build /otel/otelcol-dev/otel /otel
# /config.yaml should be mounted by the userENTRYPOINT ["/otel", "--config", "/config.yaml"]
Even though I expect go mod download to download most dependencies, the RUN builder ... step is excruciatingly slow with even a small change to the custom receiver.
It gets stuck at Compiling... sometimes around 5 mins or so. Iterative building using Docker makes this a bad experience.
Anything I could do to improve the build time? Maybe mount the go module path? Would appreciate suggestions.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
My Dockerfile looks something like below:
Even though I expect
go mod download
to download most dependencies, theRUN builder ...
step is excruciatingly slow with even a small change to the custom receiver.It gets stuck at
Compiling...
sometimes around 5 mins or so. Iterative building using Docker makes this a bad experience.Anything I could do to improve the build time? Maybe mount the go module path? Would appreciate suggestions.
Beta Was this translation helpful? Give feedback.
All reactions