FROM golang:1.18 AS builder WORKDIR /usr/src/tencent-nlu-parse COPY ./go.mod /usr/src/tencent-nlu-parse/ COPY ./go.sum /usr/src/tencent-nlu-parse/ ENV GOPROXY=http://10.7.83.190:6666,https://proxy.golang.com.cn,direct CGO_ENABLED=0 RUN echo "hosts: files dns" > /etc/nsswitch.conf && \ echo -e "112.19.0.219 goproxy.cn\n157.255.30.117 mirrors.aliyun.com">>/etc/hosts && \ go mod download COPY . /usr/src/tencent-nlu-parse/ RUN go build -o tencent-nlu-parse FROM alpine as runner COPY --from=builder /usr/share/zoneinfo/Asia/Shanghai /etc/localtime COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ COPY --from=builder /usr/src/tencent-nlu-parse/tencent-nlu-parse /tmp/ RUN echo -e "10.7.82.56 e-con-01\n10.7.83.97 m-nlp-03\n10.7.82.133 s-ipd-01\n10.7.80.153 c-gtw-01\n10.7.83.174 s-gtw-01">>/etc/hosts && \ ls /tmp/tencent-nlu-parse && \ chmod +x /tmp/tencent-nlu-parse CMD ["/tmp/tencent-nlu-parse","-config=env/v2,tencent_nlu_parse/conf","-consul=http://e-con-01:8500", "-name=tencent_nlu_parse","-token=c89cb8e1-dc45-b8d2-1b06-c02684e09b21"]