21 lines
332 B
Docker
21 lines
332 B
Docker
FROM golang:alpine as builder
|
|
|
|
ENV GO111MODULE=on \
|
|
GOPROXY=https://goproxy.cn,direct
|
|
|
|
WORKDIR /builder
|
|
COPY . .
|
|
RUN go mod download && go build -o app
|
|
RUN ls -lh && chmod +x ./app
|
|
|
|
COPY . .
|
|
|
|
RUN GOOS=linux GOARCH=amd64 go build .
|
|
|
|
FROM alpine
|
|
|
|
WORKDIR /app
|
|
COPY --from=builder /builder/app ./app
|
|
CMD ./app
|
|
|
|
ENTRYPOINT ["./app"] |