blog/Dockerfile

13 lines
321 B
Docker
Raw Permalink Normal View History

2023-08-15 14:28:07 +08:00
FROM golang:1.19 as builder
WORKDIR /workdir
ADD go.mod go.mod
ADD go.sum go.sum
ENV GOPROXY=https://goproxy.cn,direct GO111MODULE=on
RUN go mod download
ADD main.go main.go
ADD pkg pkg
RUN GOOS=linux GOARCH=amd64 go build -o /appname main.go
FROM scratch
COPY --from=builder /workdir/appname /
ENTRYPOINT [ "/appname" ]