Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update collector to build image using ocb #944

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/build-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ jobs:
- file: ./src/loadgenerator/Dockerfile
tag_suffix: loadgenerator
context: ./
- file: ./src/otelcollector/Dockerfile
tag_suffix: otelcollector
context: ./
- file: ./src/paymentservice/Dockerfile
tag_suffix: paymentservice
context: ./
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ release.
([#988](https://github.com/open-telemetry/opentelemetry-demo/pull/988))
* [FraudDetectionService] Updated Kotlin version and OTel dependencies
([#987](https://github.com/open-telemetry/opentelemetry-demo/pull/987))
* [otelcol] Use the collector builder to produce otelcol docker image
([#944](https://github.com/open-telemetry/opentelemetry-demo/pull/944))

## 1.4.0

Expand Down
7 changes: 6 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -645,8 +645,13 @@ services:

# OpenTelemetry Collector
otelcol:
image: otel/opentelemetry-collector-contrib:0.76.1
image: ${IMAGE_NAME}:${IMAGE_VERSION}-otelcol
container_name: otel-col
build:
context: ./
dockerfile: ./src/otelcollector/Dockerfile
cache_from:
- ${IMAGE_NAME}:${IMAGE_VERSION}-otelcol
deploy:
resources:
limits:
Expand Down
31 changes: 31 additions & 0 deletions src/otelcollector/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

FROM golang:latest as build

ARG TARGETARCH=arm64
ARG BUILDER_VERSION=0.81.0

RUN curl -L -o /builder https://github.com/open-telemetry/opentelemetry-collector/releases/download/cmd%2Fbuilder%2Fv${BUILDER_VERSION}/ocb_${BUILDER_VERSION}_linux_${TARGETARCH}
RUN chmod +x /builder
WORKDIR /build
COPY ./src/otelcollector/manifest.yml ./
ENV GOARCH=arm64
ENV CGO_ENABLED=0
RUN /builder --config ./manifest.yml --output-path /build/_build
RUN ls /build/_build

FROM alpine:3.16 as certs
RUN apk --update add ca-certificates

FROM alpine

ARG USER_UID=10001
USER ${USER_UID}

COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=build --chmod=755 /build/_build/otelcol-demo /otelcol-demo
COPY ./src/otelcollector/otelcol-*.yml /etc/otelcol/
ENTRYPOINT ["/otelcol-demo"]
CMD ["--config", "/etc/otelcol/otelcol-config.yml"]
EXPOSE 4317 4318
24 changes: 24 additions & 0 deletions src/otelcollector/manifest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

dist:
module: github.com/open-telemetry/opentelemetry-demo/src/otelcollector
name: otelcol-demo
description: OpenTelemetry Collector for OpenTelemetry Demo
version: 0.81.0
output_path: ./_build
otelcol_version: 0.81.0

receivers:
- gomod: go.opentelemetry.io/collector/receiver/otlpreceiver v0.81.0

exporters:
- gomod: go.opentelemetry.io/collector/exporter/loggingexporter v0.81.0
- gomod: go.opentelemetry.io/collector/exporter/otlpexporter v0.81.0
- gomod: go.opentelemetry.io/collector/exporter/otlphttpexporter v0.81.0
- gomod: github.com/open-telemetry/opentelemetry-collector-contrib/exporter/prometheusexporter v0.81.0
processors:
- gomod: go.opentelemetry.io/collector/processor/batchprocessor v0.81.0
- gomod: github.com/open-telemetry/opentelemetry-collector-contrib/processor/filterprocessor v0.81.0
connectors:
- gomod: github.com/open-telemetry/opentelemetry-collector-contrib/connector/spanmetricsconnector v0.81.0
Loading