blob: 5e60af2d5e3ae9f218bcc2d23ac75681c27ca009 (
plain) (
tree)
|
|
# STEP 1
FROM golang:1.11-stretch as builder
COPY . /srv/app
WORKDIR /srv/app
#get dependancies
RUN go mod download
#build the binary
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -installsuffix cgo -o /go/bin/app
# STEP 2
# start from scratch
FROM scratch
# Copy our static executable
WORKDIR /usr/app
COPY --from=builder /go/bin/app .
ENTRYPOINT ["./app"]
|