Skip to content

Commit

Permalink
reproducible binary builds via trimpath
Browse files Browse the repository at this point in the history
Resolves #10

Signed-off-by: Matt Hamilton <matt@soluble.ai>
  • Loading branch information
Matt Hamilton committed Aug 19, 2020
1 parent 48538de commit eaf6176
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ WORKDIR $GOPATH/src/github.com/soluble-ai/kubetap
COPY . .
RUN apk add --no-cache -U upx && \
go mod download && \
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -o /go/bin/kubectl-tap ./cmd/kubectl-tap && \
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -trimpath -ldflags="-w -s" -o /go/bin/kubectl-tap ./cmd/kubectl-tap && \
upx /go/bin/kubectl-tap

FROM alpine:latest as alpine
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.alpine
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ WORKDIR $GOPATH/src/github.com/soluble-ai/kubetap
COPY . .
RUN apk add --no-cache -U upx && \
go mod download && \
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -o /go/bin/kubectl-tap ./cmd/kubectl-tap && \
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -trimpath -ldflags="-w -s" -o /go/bin/kubectl-tap ./cmd/kubectl-tap && \
upx /go/bin/kubectl-tap

FROM alpine:latest as alpine
Expand Down
2 changes: 1 addition & 1 deletion scripts/build-kubetap.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ source ${script_dir}/_pre.zsh
go mod download

# build and install
go install -v -ldflags="-s -w" ./cmd/kubectl-tap
go install -v -trimpath -ldflags="-s -w" ./cmd/kubectl-tap

source ${script_dir}/_post.zsh
2 changes: 1 addition & 1 deletion scripts/test.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ GO111MODULE=on go get -modfile=ci.mod gotest.tools/gotestsum/@${GOTESTSUM_VERSIO
gotestsum --format=short-verbose --no-summary=skipped --junitfile=coverage.xml -- -count=1 -race -coverprofile=coverage.txt -covermode=atomic ./...

# ensure we can build
go build -v -ldflags="-s -w" -o /dev/null ./cmd/kubectl-tap
go build -v -trimpath -ldflags="-s -w" -o /dev/null ./cmd/kubectl-tap

# tidy modules, in case this is a local build env
go mod tidy
Expand Down

0 comments on commit eaf6176

Please sign in to comment.