Dockerfile: make the static binary smaller
Signed-off-by: unclejack <unclejack@users.noreply.github.com>
This commit is contained in:
parent
99386c3aa8
commit
6510bf6068
@ -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
|
||||
|
Reference in New Issue
Block a user