1 Star 0 Fork 0

ikaiguang/go-snowflake-node-id

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Dockerfile 682 Bytes
一键复制 编辑 原始数据 按行查看 历史
ikaiguang 提交于 2022-09-05 14:36 . feat 添加docker部署相关
ARG WORK_DIR=/www/app
ARG GO_PATH=/www/go
ARG GO_PROXY=https://goproxy.cn,direct
FROM golang:1.18 as builder
ARG WORK_DIR
ARG GO_PATH
ARG GO_PROXY
WORKDIR $WORK_DIR
ENV GOPATH=$GO_PATH
ENV GOPROXY=$GO_PROXY
ENV CGO_ENABLED=0
COPY . .
#RUN ls -al
RUN go build -o ./bin/main ./cmd/main/snowflake-node-id.go
FROM alpine:latest as release
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
RUN apk add -U tzdata && \
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
echo 'Asia/Shanghai' > /etc/timezone
ARG WORK_DIR
WORKDIR $WORK_DIR
COPY --from=builder $WORK_DIR/bin/main $WORK_DIR/main
ENTRYPOINT ["./main"]
EXPOSE 8081 9091
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/ikaiguang/go-snowflake-node-id.git
git@gitee.com:ikaiguang/go-snowflake-node-id.git
ikaiguang
go-snowflake-node-id
go-snowflake-node-id
main

搜索帮助