Fix - go build to static binaries

This commit is contained in:
naveen 2021-02-14 14:54:44 -05:00 committed by Naveen
parent fc251d9d42
commit b20e33c24b
2 changed files with 2 additions and 2 deletions

View File

@ -24,7 +24,7 @@ COPY . ./
FROM base AS build
ARG TARGETOS
ARG TARGETARCH
RUN --mount=type=cache,target=/root/.cache/go-build go build -o /out/scorecard .
RUN --mount=type=cache,target=/root/.cache/go-build CGO_ENABLED=0 go build -a -tags netgo -ldflags '-w -extldflags "-static"' -o /out/scorecard .
FROM gcr.io/distroless/base:nonroot
COPY --from=build /out/scorecard /

View File

@ -1,7 +1,7 @@
SHELL := /bin/bash
all: fmt tidy lint test
build:
go build
CGO_ENABLED=0 go build -a -tags netgo -ldflags '-w -extldflags "-static"'
fmt:
go fmt ./...