正在显示
1 个修改的文件
包含
31 行增加
和
31 行删除
| 1 | -#FROM golang:latest | ||
| 2 | -#MAINTAINER 陈志颖 <steve.d.chan@qq.com> | ||
| 3 | -#ENV APP_DIR $GOPATH/src/allied-creation-cooperation | ||
| 4 | -#RUN mkdir -p $APP_DIR | ||
| 5 | -#WORKDIR $APP_DIR/ | ||
| 6 | -#COPY ./pkg pkg | ||
| 7 | -#COPY ./config config | ||
| 8 | -#COPY ./go.mod go.mod | ||
| 9 | -#COPY ./go.sum go.sum | ||
| 10 | -#COPY ./main.go main.go | ||
| 11 | -#RUN ["ln","-sf","/usr/share/zoneinfo/Asia/Shanghai","/etc/localtime"] | ||
| 12 | -#ENV GO111MODULE on | ||
| 13 | -#ENV GOPROXY https://goproxy.io | ||
| 14 | -#RUN ["go","mod","tidy"] | ||
| 15 | -#RUN ["ls"] | ||
| 16 | -#RUN ["go","build"] | ||
| 17 | -#ENTRYPOINT ["./allied-creation-cooperation"] | ||
| 18 | - | ||
| 19 | -############################# | ||
| 20 | -## STEP 1 build executable binary | ||
| 21 | -############################# | ||
| 22 | -FROM golang:latest AS builder | 1 | +FROM golang:latest |
| 23 | MAINTAINER 陈志颖 <steve.d.chan@qq.com> | 2 | MAINTAINER 陈志颖 <steve.d.chan@qq.com> |
| 24 | -RUN mkdir /app | ||
| 25 | -WORKDIR /app | ||
| 26 | -COPY . /app | 3 | +ENV APP_DIR $GOPATH/src/allied-creation-cooperation |
| 4 | +RUN mkdir -p $APP_DIR | ||
| 5 | +WORKDIR $APP_DIR/ | ||
| 6 | +COPY ./pkg pkg | ||
| 7 | +COPY ./config config | ||
| 8 | +COPY ./go.mod go.mod | ||
| 9 | +COPY ./go.sum go.sum | ||
| 10 | +COPY ./main.go main.go | ||
| 27 | RUN ["ln","-sf","/usr/share/zoneinfo/Asia/Shanghai","/etc/localtime"] | 11 | RUN ["ln","-sf","/usr/share/zoneinfo/Asia/Shanghai","/etc/localtime"] |
| 28 | -RUN GO111MODULE="on" GOPROXY="https://goproxy.cn" CGO_ENABLED=0 GOOS=linux go build -o allied-creation-cooperation | 12 | +ENV GO111MODULE on |
| 13 | +ENV GOPROXY https://goproxy.io | ||
| 14 | +RUN ["go","mod","tidy"] | ||
| 15 | +RUN ["ls"] | ||
| 16 | +RUN ["go","build"] | ||
| 17 | +ENTRYPOINT ["./allied-creation-cooperation"] | ||
| 29 | 18 | ||
| 19 | +############################## | ||
| 20 | +### STEP 1 build executable binary | ||
| 21 | +############################## | ||
| 22 | +#FROM golang:latest AS builder | ||
| 23 | +#MAINTAINER 陈志颖 <steve.d.chan@qq.com> | ||
| 24 | +#RUN mkdir /app | ||
| 25 | +#WORKDIR /app | ||
| 26 | +#COPY . /app | ||
| 27 | +#RUN ["ln","-sf","/usr/share/zoneinfo/Asia/Shanghai","/etc/localtime"] | ||
| 28 | +#RUN GO111MODULE="on" GOPROXY="https://goproxy.cn" CGO_ENABLED=0 GOOS=linux go build -o allied-creation-cooperation | ||
| 29 | +# | ||
| 30 | +############################## | ||
| 31 | +### STEP 2 build a small image | ||
| 30 | ############################# | 32 | ############################# |
| 31 | -## STEP 2 build a small image | ||
| 32 | -############################ | ||
| 33 | -FROM scratch as final | ||
| 34 | -COPY --from=builder /app/allied-creation-cooperation /app/allied-creation-cooperation | ||
| 35 | -ENTRYPOINT ["./app/allied-creation-cooperation"] | ||
| 33 | +#FROM scratch as final | ||
| 34 | +#COPY --from=builder /app/allied-creation-cooperation /app/allied-creation-cooperation | ||
| 35 | +#ENTRYPOINT ["./app/allied-creation-cooperation"] |
-
请 注册 或 登录 后发表评论