Merge pull request #430 from unclejack/smaller_static_binary

Dockerfile: make the static binary smaller
This commit is contained in:
Andrea Luzzardi 2021-05-07 13:42:06 -07:00 committed by GitHub
commit 2767d5e821
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,7 +5,8 @@ WORKDIR /src
RUN apk add --no-cache file
ENV GOMODCACHE /root/.cache/gocache
RUN --mount=target=. --mount=target=/root/.cache,type=cache \
CGO_ENABLED=0 go build -o /out/dagger ./cmd/dagger && file /out/dagger | grep "statically linked"
CGO_ENABLED=0 go build -o /out/dagger -ldflags '-s -d -w' ./cmd/dagger; \
file /out/dagger | grep "statically linked"
FROM scratch
COPY --from=build /out/dagger /bin/dagger