From 7360b2bfa421ce6ce65e44734f0ff53ef8092082 Mon Sep 17 00:00:00 2001 From: Cyrille Nofficial Date: Mon, 3 Jan 2022 10:27:46 +0100 Subject: [PATCH] build: exclude binary from git history --- .gitignore | 2 +- build-docker.sh | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index ff68ae6..bda37bb 100644 --- a/.gitignore +++ b/.gitignore @@ -282,4 +282,4 @@ local.properties !.vscode/extensions.json *.code-workspace -/rc-* +build/ diff --git a/build-docker.sh b/build-docker.sh index 56e0960..97ef59e 100755 --- a/build-docker.sh +++ b/build-docker.sh @@ -26,11 +26,12 @@ image_build(){ printf "\n\nBuild go binary %s\n\n" "${BINARY}.${binary_suffix}" - CGO_ENABLED=0 GOOS=${GOOS} GOARCH=${GOARCH} GOARM=${GOARM} go build -mod vendor -a ${GOTAGS} -o "${BINARY}.${binary_suffix}" ./cmd/${BINARY}/ + mkdir -p build + CGO_ENABLED=0 GOOS=${GOOS} GOARCH=${GOARCH} GOARM=${GOARM} go build -mod vendor -a ${GOTAGS} -o "build/${BINARY}.${binary_suffix}" ./cmd/${BINARY}/ buildah --os "$GOOS" --arch "$GOARCH" $VARIANT --name "$containerName" from gcr.io/distroless/static buildah config --user 1234 "$containerName" - buildah copy "$containerName" "${BINARY}.${binary_suffix}" /go/bin/$BINARY + buildah copy "$containerName" "build/${BINARY}.${binary_suffix}" /go/bin/$BINARY buildah config --entrypoint '["/go/bin/'$BINARY'"]' "${containerName}" buildah commit --rm --manifest $IMAGE_NAME "${containerName}" "${containerName}"