加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Dockerfile 949 Bytes
一键复制 编辑 原始数据 按行查看 历史
Edward 提交于 2020-10-30 18:20 . add a helper
# stage 1, which can go as a basic go build image runtime
FROM alpine:latest AS builder
RUN apk --no-cache add make git go gcc libtool musl-dev
# Configure Go
ENV GOROOT /usr/lib/go
ENV GOPATH /go
ENV PATH /go/bin:$PATH
RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin
COPY go.mod .
COPY go.sum .
# The next line can be removed once the profile go.mod's are merged into master
COPY profile profile
RUN go mod download
COPY . /
RUN make ; rm -rf $GOPATH/pkg/mod
# stage 2,, which can go as a basic runtime
FROM alpine:latest
RUN apk --no-cache add make git go gcc libtool musl-dev
# Configure Go for the micro runtime
ENV GOROOT /usr/lib/go
ENV GOPATH /go
ENV PATH /go/bin:$PATH
RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin
RUN apk --no-cache add ca-certificates && \
rm -rf /var/cache/apk/* /tmp/* && \
[ ! -e /etc/nsswitch.conf ] && echo 'hosts: files dns' > /etc/nsswitch.conf
COPY --from=builder /micro-web /micro-web
ENTRYPOINT [ "/micro-web" ]
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化