Skip to content

Commit

Permalink
integrations: build with -trimpath option (#45094)
Browse files Browse the repository at this point in the history
  • Loading branch information
zmb3 authored Aug 6, 2024
1 parent 0348505 commit e1e28b0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
12 changes: 6 additions & 6 deletions integrations/operator/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ ENV GOPATH="/go" \
# Install protoc.
ARG PROTOC_VERSION # eg, "3.20.2"
RUN VERSION="$PROTOC_VERSION" && \
PB_REL='https://github.com/protocolbuffers/protobuf/releases' && \
PB_FILE="$(mktemp protoc-XXXXXX.zip)" && \
curl -fsSL -o "$PB_FILE" "$PB_REL/download/v$VERSION/protoc-$VERSION-linux-$(if [ "$BUILDARCH" = "amd64" ]; then echo "x86_64"; else echo "aarch_64"; fi).zip" && \
unzip "$PB_FILE" -d /usr/local && \
rm -f "$PB_FILE"
PB_REL='https://github.com/protocolbuffers/protobuf/releases' && \
PB_FILE="$(mktemp protoc-XXXXXX.zip)" && \
curl -fsSL -o "$PB_FILE" "$PB_REL/download/v$VERSION/protoc-$VERSION-linux-$(if [ "$BUILDARCH" = "amd64" ]; then echo "x86_64"; else echo "aarch_64"; fi).zip" && \
unzip "$PB_FILE" -d /usr/local && \
rm -f "$PB_FILE"

## Build the operator

Expand Down Expand Up @@ -75,7 +75,7 @@ ARG TARGETARCH
# CGO is required for github.com/gravitational/teleport/lib/system
RUN echo "Targeting $TARGETOS/$TARGETARCH with CC=$COMPILER_NAME" && \
CGO_ENABLED=1 CC=$COMPILER_NAME GOOS=$TARGETOS GOARCH=$TARGETARCH \
go build -a -o /go/bin/teleport-operator github.com/gravitational/teleport/integrations/operator
go build -trimpath -a -o /go/bin/teleport-operator github.com/gravitational/teleport/integrations/operator

# Create the image with the build operator on the $TARGETPLATFORM
# TARGETPLATFORM is provided by Docker/buildx
Expand Down
2 changes: 1 addition & 1 deletion integrations/operator/Dockerfile.gha
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ RUN case "$TARGETARCH" in \
esac; \
echo "Targeting $TARGETOS/$TARGETARCH with CC=$COMPILER_NAME" && \
CGO_ENABLED=1 CC=$COMPILER_NAME GOOS=$TARGETOS GOARCH=$TARGETARCH \
go build -a -o /go/bin/teleport-operator github.com/gravitational/teleport/integrations/operator
go build -trimpath -a -o /go/bin/teleport-operator github.com/gravitational/teleport/integrations/operator

# Create the image with the build operator on the $TARGETPLATFORM
# TARGETPLATFORM is provided by Docker/buildx
Expand Down
3 changes: 2 additions & 1 deletion integrations/operator/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ crdgen-test: ## Run crdgen tests.

.PHONY: build
build: generate fmt vet ## Build manager binary.
go build -o bin/manager main.go namespace.go
go build -trimpath -o bin/manager main.go namespace.go


.PHONY: run
run: manifests generate fmt vet ## Run a controller from your host.
Expand Down

0 comments on commit e1e28b0

Please sign in to comment.