From dbb69786d3932b5399515ca30f488a0c6760a9e8 Mon Sep 17 00:00:00 2001 From: Ben Johnson Date: Sat, 17 Apr 2021 09:18:03 -0600 Subject: [PATCH] Add osusergo & netgo tags for static builds --- .github/workflows/release.linux_static.yml | 2 +- Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.linux_static.yml b/.github/workflows/release.linux_static.yml index ed92c9e..99bab93 100644 --- a/.github/workflows/release.linux_static.yml +++ b/.github/workflows/release.linux_static.yml @@ -45,7 +45,7 @@ jobs: run: | rm -rf dist mkdir -p dist - CGO_ENABLED=1 go build -ldflags "-s -w -extldflags "-static" -X 'main.Version=${{ steps.release.outputs.tag_name }}'" -tags sqlite_omit_load_extension -o dist/litestream ./cmd/litestream + CGO_ENABLED=1 go build -ldflags "-s -w -extldflags "-static" -X 'main.Version=${{ steps.release.outputs.tag_name }}'" -tags osusergo,netgo,sqlite_omit_load_extension -o dist/litestream ./cmd/litestream cd dist tar -czvf litestream-${{ steps.release.outputs.tag_name }}-${{ env.GOOS }}-${{ env.GOARCH }}${{ env.GOARM }}-static.tar.gz litestream diff --git a/Dockerfile b/Dockerfile index 58290f2..7efd1a0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,7 @@ WORKDIR /src/litestream COPY . . RUN --mount=type=cache,target=/root/.cache/go-build \ --mount=type=cache,target=/go/pkg \ - go build -ldflags '-s -w -extldflags "-static"' -tags sqlite_omit_load_extension -o /usr/local/bin/litestream ./cmd/litestream + go build -ldflags '-s -w -extldflags "-static"' -tags osusergo,netgo,sqlite_omit_load_extension -o /usr/local/bin/litestream ./cmd/litestream FROM alpine COPY --from=builder /usr/local/bin/litestream /usr/local/bin/litestream