Added Scratch Build

This commit is contained in:
Phil 2021-12-07 18:09:14 +01:00
parent bcfc91226f
commit 78d77e514c
2 changed files with 10 additions and 6 deletions

View file

@ -1,11 +1,15 @@
FROM golang:alpine FROM golang:alpine as builder
WORKDIR /go/src/git.ucode.space/goshortly RUN apk add --no-cache gcc libgo
WORKDIR /go/src/git.ucode.space/goshorly
COPY . . COPY . .
RUN apk add gcc libgo
RUN go get -d -v ./... RUN go get -d -v ./...
RUN go build -o app .
CMD ["go", "run", "main.go"] FROM scratch as production
WORKDIR /goshorly
COPY --from=builder /go/src/git.ucode.space/goshorly/app .
CMD ["./app"]