Skip to content

Commit f2f2282

Browse files
authored
Use -trimpath and ldflags -s -w build flags (actions#1880)
1 parent a3a8017 commit f2f2282

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ ARG TARGETPLATFORM TARGETOS TARGETARCH TARGETVARIANT VERSION=dev
3030
# to avoid https://github.com/moby/buildkit/issues/2334
3131
# We can use docker layer cache so the build is fast enogh anyway
3232
# We also use per-platform GOCACHE for the same reason.
33-
env GOCACHE /build/${TARGETPLATFORM}/root/.cache/go-build
33+
ENV GOCACHE /build/${TARGETPLATFORM}/root/.cache/go-build
3434

3535
# Build
3636
RUN --mount=target=. \
3737
--mount=type=cache,mode=0777,target=${GOCACHE} \
3838
export GOOS=${TARGETOS} GOARCH=${TARGETARCH} GOARM=${TARGETVARIANT#v} && \
39-
go build -ldflags="-X 'github.com/actions-runner-controller/actions-runner-controller/build.Version=${VERSION}'" -o /out/manager main.go && \
40-
go build -o /out/github-webhook-server ./cmd/githubwebhookserver
39+
go build -trimpath -ldflags="-s -w -X 'github.com/actions-runner-controller/actions-runner-controller/build.Version=${VERSION}'" -o /out/manager main.go && \
40+
go build -trimpath -ldflags="-s -w" -o /out/github-webhook-server ./cmd/githubwebhookserver
4141

4242
# Use distroless as minimal base image to package the manager binary
4343
# Refer to https://github.com/GoogleContainerTools/distroless for more details

0 commit comments

Comments
 (0)