加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Dockerfile 1.07 KB
一键复制 编辑 原始数据 按行查看 历史
小菜LC 提交于 2023-04-27 16:38 . 采用openyurt镜像
FROM golang:1.18-alpine AS builder
ENV GO111MODULE=on
ENV GOPROXY=https://goproxy.cn,direct
WORKDIR /build
COPY ./config ./config
COPY ./core ./core
COPY ./driver ./driver
COPY ./driver-config ./driver-config
COPY ./res ./res
COPY ./go.sum ./go.sum
COPY ./go.mod ./go.mod
COPY ./main.go ./main.go
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories && \
apk update && apk add pkgconfig zeromq-dev gcc libc-dev && \
go mod vendor && \
go build -o driver-box .
FROM alpine:latest
WORKDIR /
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories && \
apk update && apk add zeromq-dev curl tzdata && \
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
echo "Asia/Shanghai" > /etc/timezone && \
apk del tzdata && \
rm -rf /var/cache/apk/*
COPY --from=builder /build/app /app
COPY --from=builder /build/res /res
COPY --from=builder /build/driver-box /driver-box
EXPOSE 59999
ENTRYPOINT ["/driver-box"]
CMD ["-cp=consul.http://edgex-core-consul:8500", "--registry", "--confdir=/res"]
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化