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

Set build flags to build a static binary #10

Merged
merged 2 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ jobs:
check-latest: true
- name: Build
run: |
go build
make
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
Expand Down
20 changes: 20 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.PHONY: all build build-debug

all: build

GO_FLAGS := -buildvcs=false -ldflags="-extldflags=-static" -tags osusergo,netgo

build:
go build $(GO_FLAGS)

build-debug:
go build dd-opentelemetry-profiler-debug $(GO_FLAGS) -gcflags "all=-N -l"
nsavoire marked this conversation as resolved.
Show resolved Hide resolved

GOLANGCI_LINT_VERSION = "v1.61.0"
nsavoire marked this conversation as resolved.
Show resolved Hide resolved
lint:
go run github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION) version
go run github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION) run
go run checkcopyrights.go

test:
go test -v -race ./...
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ services:
- /var/run/docker.sock:/var/run/docker.sock:ro
secrets:
- dd-api-key
command: ['/bin/sh', '-c', 'export DD_API_KEY=$$(cat /run/secrets/dd-api-key); sudo mount -t debugfs none /sys/kernel/debug && cd /app && go build && sudo -E /app/dd-opentelemetry-profiler -service "${OTEL_PROFILING_AGENT_SERVICE:-dd-opentelemetry-profiler-dev}" -collection-agent "http://datadog-agent:8126" -reporter-interval ${OTEL_PROFILING_AGENT_REPORTER_INTERVAL:-60s} -samples-per-second 20 -save-cpuprofile']
command: ['/bin/sh', '-c', 'export DD_API_KEY=$$(cat /run/secrets/dd-api-key); sudo mount -t debugfs none /sys/kernel/debug && cd /app && make && sudo -E /app/dd-opentelemetry-profiler -service "${OTEL_PROFILING_AGENT_SERVICE:-dd-opentelemetry-profiler-dev}" -collection-agent "http://datadog-agent:8126" -reporter-interval ${OTEL_PROFILING_AGENT_REPORTER_INTERVAL:-60s} -samples-per-second 20 -save-cpuprofile']

datadog-agent:
image: gcr.io/datadoghq/agent:7
Expand Down