diff --git a/Dockerfile b/Dockerfile index 9cc6545d..79ddc813 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,7 @@ WORKDIR /go/src/mikefarah/yq COPY . . -RUN CGO_ENABLED=0 go build . +RUN CGO_ENABLED=0 go build -ldflags "-s -w" . # RUN ./scripts/test.sh -- this too often times out in the github pipeline. RUN ./scripts/acceptance.sh diff --git a/Makefile.variables b/Makefile.variables index b1968ba8..f9669c16 100644 --- a/Makefile.variables +++ b/Makefile.variables @@ -7,6 +7,7 @@ export GIT_DESCRIBE = $(shell git describe --tags --always) LDFLAGS := LDFLAGS += -X main.GitCommit=${GIT_COMMIT}${GIT_DIRTY} LDFLAGS += -X main.GitDescribe=${GIT_DESCRIBE} +LDFLAGS += -w -s GITHUB_TOKEN ?= diff --git a/scripts/build-small-yq.sh b/scripts/build-small-yq.sh new file mode 100755 index 00000000..81c78c11 --- /dev/null +++ b/scripts/build-small-yq.sh @@ -0,0 +1,2 @@ +#!/bin/bash +go build -tags yq_notoml -tags yq_noxml -tags yq_nojson -ldflags "-s -w" . \ No newline at end of file diff --git a/scripts/xcompile.sh b/scripts/xcompile.sh index cc22b7ef..2b259167 100755 --- a/scripts/xcompile.sh +++ b/scripts/xcompile.sh @@ -2,7 +2,7 @@ set -e # you may need to go install github.com/mitchellh/gox@v1.0.1 first echo $VERSION -CGO_ENABLED=0 gox -ldflags "${LDFLAGS}" -output="build/yq_{{.OS}}_{{.Arch}}" --osarch="darwin/amd64 darwin/arm64 freebsd/386 freebsd/amd64 freebsd/arm linux/386 linux/amd64 linux/arm linux/arm64 linux/mips linux/mips64 linux/mips64le linux/mipsle linux/ppc64 linux/ppc64le linux/s390x netbsd/386 netbsd/amd64 netbsd/arm openbsd/386 openbsd/amd64 windows/386 windows/amd64" +CGO_ENABLED=0 gox -ldflags "-s -w ${LDFLAGS}" -output="build/yq_{{.OS}}_{{.Arch}}" --osarch="darwin/amd64 darwin/arm64 freebsd/386 freebsd/amd64 freebsd/arm linux/386 linux/amd64 linux/arm linux/arm64 linux/mips linux/mips64 linux/mips64le linux/mipsle linux/ppc64 linux/ppc64le linux/s390x netbsd/386 netbsd/amd64 netbsd/arm openbsd/386 openbsd/amd64 windows/386 windows/amd64" cd build