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

Add a slim Docker image for testing #1630

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion .github/workflows/e2e/k8s/sample-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ spec:
- name: auto-instrumentation
image: otel-go-instrumentation
imagePullPolicy: IfNotPresent
command: ["/otel-go-instrumentation", "-global-impl", "-log-level=debug"]
args: ["-global-impl", "-log-level=debug"]
env:
- name: OTEL_GO_AUTO_TARGET_EXE
value: /usr/local/bin/app
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/kind.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ jobs:
steps:
- name: Checkout Repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Install build dependencies
run: sudo apt-get install -y clang llvm libbpf-dev
MrAlias marked this conversation as resolved.
Show resolved Hide resolved
- name: Build auto-instrumentation
run: |
IMG=otel-go-instrumentation:latest make docker-build
IMG=otel-go-instrumentation:latest make docker-build-test
docker save otel-go-instrumentation:latest -o otel-go-instrumentation.tar
- name: Upload Docker image artifact
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4
Expand Down
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@ docker-build:
docker-build-base:
docker buildx build -t $(IMG_NAME_BASE) --target base .

.PHONY: docker-build-test
docker-build-test: generate
docker buildx build -t $(IMG_NAME) -f test.Dockerfile .

.PHONY: sample-app/nethttp sample-app/gin sample-app/databasesql sample-app/nethttp-custom sample-app/otelglobal sample-app/autosdk sample-app/kafka-go
sample-app/%: LIBRARY=$*
sample-app/%:
Expand Down Expand Up @@ -178,7 +182,7 @@ fixture-otelglobal: fixtures/otelglobal
fixture-autosdk: fixtures/autosdk
fixture-kafka-go: fixtures/kafka-go
fixtures/%: LIBRARY=$*
fixtures/%: docker-build sample-app/%
fixtures/%: docker-build-test sample-app/%
kind create cluster
kind load docker-image otel-go-instrumentation sample-app
helm repo add open-telemetry https://open-telemetry.github.io/opentelemetry-helm-charts
Expand Down
20 changes: 20 additions & 0 deletions test.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM golang:1.23.4-bookworm@sha256:e4906bc13f563c90ea22151e831cda45d58838f2bee18823f0bcc717464ccfe5

WORKDIR /usr/src/go.opentelemetry.io/auto/

COPY go.mod go.sum ./
RUN --mount=type=cache,target=/go/pkg go mod download && go mod verify

COPY . .

ARG CGO_ENABLED=0

# TARGETARCH is an automatic platform ARG enabled by Docker BuildKit.
ARG TARGETARCH

RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg \
CGO_ENABLED=$CGO_ENABLED \
go build -o /usr/local/bin/otel-go-instrumentation ./cli/...

ENTRYPOINT ["/usr/local/bin/otel-go-instrumentation"]
20 changes: 20 additions & 0 deletions test.Dockerfile.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

# Ignore everything by default.
*

# Copyright requirements.
!/LICENSE
!/LICENSES

# Go
!/go.sum
!/go.mod
!/*.go

# Packages
!/cli
!/sdk
!/internal/include/
!/internal/pkg/
Loading