You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

13 lines
321 B

1 year ago
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" ]