FROM registry.cn-chengdu.aliyuncs.com/lansexiongdi/build:1.22.2 AS builder

ENV GOCACHE /root/.cache/go-build

COPY . /src
WORKDIR /src

RUN make build

FROM registry.cn-chengdu.aliyuncs.com/lansexiongdi/work:v1

RUN echo 'http://mirrors.ustc.edu.cn/alpine/v3.5/main' > /etc/apk/repositories \
&& echo 'http://mirrors.ustc.edu.cn/alpine/v3.5/community' >>/etc/apk/repositories \
&& apk update && apk add tzdata \
&& ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& echo "Asia/Shanghai" > /etc/timezone

COPY --from=builder /src/bin /app
#删除config文件，线上是通过挂载进来的
#RUN rm -rf /app/configs/config.yaml

WORKDIR /app

RUN mkdir /app/cert

VOLUME /data/conf
ENV ROCKETMQ_GO_LOG_LEVEL=error TZ=Asia/Shanghai

CMD ["./server"]