From 856c9804935e8f22e3adf721c7ca8ff182aa7530 Mon Sep 17 00:00:00 2001 From: Akihiro Suda Date: Mon, 30 Oct 2023 16:37:24 +0900 Subject: [PATCH] release: make binaries static Signed-off-by: Akihiro Suda --- .github/workflows/release.yml | 2 ++ Dockerfile | 2 ++ 2 files changed, 4 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8cf50c9cf..297990cb8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -29,6 +29,8 @@ jobs: if [ "${ARCH_ID}" == "arm-v7" ] ; then BUILD_ARGS="--build-arg=TARGETARCH=arm --build-arg=GOARM=7" fi + # make binaries static + BUILD_ARGS="$BUILD_ARGS --build-arg=CGO_ENABLED=0" TAR_FILE_NAME="stargz-snapshotter-${RELEASE_TAG}-linux-${ARCH_ID}.tar.gz" SHA256SUM_FILE_NAME="${TAR_FILE_NAME}.sha256sum" docker build ${BUILD_ARGS} --target release-binaries -o - . | gzip > "${OUTPUT_DIR}/${TAR_FILE_NAME}" diff --git a/Dockerfile b/Dockerfile index 12036b2f6..3c5ca2d58 100644 --- a/Dockerfile +++ b/Dockerfile @@ -92,6 +92,7 @@ ARG GOARM ARG SNAPSHOTTER_BUILD_FLAGS ARG CTR_REMOTE_BUILD_FLAGS COPY . $GOPATH/src/github.com/containerd/stargz-snapshotter +ARG CGO_ENABLED RUN cd $GOPATH/src/github.com/containerd/stargz-snapshotter && \ PREFIX=/out/ GOARCH=${TARGETARCH:-amd64} GO_BUILD_FLAGS=${SNAPSHOTTER_BUILD_FLAGS} make containerd-stargz-grpc && \ PREFIX=/out/ GOARCH=${TARGETARCH:-amd64} GO_BUILD_FLAGS=${CTR_REMOTE_BUILD_FLAGS} make ctr-remote @@ -103,6 +104,7 @@ ARG GOARM ARG SNAPSHOTTER_BUILD_FLAGS ARG CTR_REMOTE_BUILD_FLAGS COPY . $GOPATH/src/github.com/containerd/stargz-snapshotter +ARG CGO_ENABLED RUN cd $GOPATH/src/github.com/containerd/stargz-snapshotter && \ PREFIX=/out/ GOARCH=${TARGETARCH:-amd64} GO_BUILD_FLAGS=${SNAPSHOTTER_BUILD_FLAGS} make stargz-store