Changed to CGO_Enabled=0

This commit is contained in:
Phil 2022-01-06 20:03:57 +01:00
parent d96a0006fb
commit 6c69d3aae7

View file

@ -1,6 +1,7 @@
FROM golang:alpine as builder FROM golang:alpine as builder
RUN apk add --no-cache git make build-base RUN apk add --no-cache git make build-base
ENV CGO_ENABLED=0
WORKDIR /go/src/git.ucode.space/goshorly WORKDIR /go/src/git.ucode.space/goshorly
COPY . . COPY . .
@ -12,9 +13,9 @@ RUN go get -d -v ./...
# export I_GitBranch=$(git rev-parse --abbrev-ref HEAD) && \ # export I_GitBranch=$(git rev-parse --abbrev-ref HEAD) && \
# go build -a -installsuffix cgo -ldflags "-X $I_PACKAGE.GitCommitShort=$I_GitCommitShort -X $I_PACKAGE.GitBranch=$I_GitBranch" -o app . # go build -a -installsuffix cgo -ldflags "-X $I_PACKAGE.GitCommitShort=$I_GitCommitShort -X $I_PACKAGE.GitBranch=$I_GitBranch" -o app .
RUN go build -a -o app . RUN go build -a -installsuffix -ldflags="-w -s" -o app .
FROM scratch as production FROM scratch as production
WORKDIR /goshorly WORKDIR /
COPY --from=builder /go/src/git.ucode.space/goshorly/app /goshorly/app COPY --from=builder /go/src/git.ucode.space/goshorly/app /app
CMD ["./app"] ENTRYPOINT [ "/app" ]