33 lines
943 B
Docker
33 lines
943 B
Docker
FROM golang:1.20.1 AS builder
|
||
|
||
COPY . /src
|
||
WORKDIR /src
|
||
|
||
RUN GOPROXY=https://goproxy.cn make build
|
||
|
||
FROM debian:stable-slim
|
||
|
||
RUN cp -pv /etc/apt/sources.list /etc/apt/sources.list.bak && \
|
||
sed -i -e 's/deb.debian.org/mirrors.aliyun.com/g' -e 's/security.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list && \
|
||
apt-get update && apt-get install -y --no-install-recommends \
|
||
ca-certificates \
|
||
netbase \
|
||
&& rm -rf /var/lib/apt/lists/ \
|
||
&& apt-get autoremove -y && apt-get autoclean -y
|
||
|
||
COPY --from=builder /src/bin /app
|
||
#正式环境不要打包 configs,本身也不会使用
|
||
COPY --from=builder /src/configs_prod/ /app/configs/
|
||
|
||
#删除config文件,防止读取到非线上配置文件,线上是通过挂载进来的
|
||
RUN rm -rf /app/configs/config.yaml
|
||
|
||
WORKDIR /app
|
||
|
||
EXPOSE 9000
|
||
VOLUME /data/conf
|
||
ENV ROCKETMQ_GO_LOG_LEVEL=error TZ=Asia/Shanghai
|
||
|
||
|
||
CMD ["./server", "-conf", "./configs"]
|