FROM golang:alpine as build RUN apk add upx WORKDIR /build COPY . . ENV GO111MODULE=on ENV GOPROXY=https://goproxy.cn,direct RUN go mod download && go build -o app && upx -9 app RUN ls -lh && chmod +x ./app FROM alpine COPY --from=build /build/app /bin COPY --from=build /template/* /template/ RUN ls -al /bin/ | grep 'app' ENTRYPOINT ["/bin/app"]