-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
50 lines (36 loc) · 945 Bytes
/
Dockerfile
File metadata and controls
50 lines (36 loc) · 945 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# 多阶段构建 - 构建阶段
FROM golang:1.25.3-alpine AS builder
# 安装必要的构建工具
RUN apk add --no-cache \
protobuf-dev \
protoc \
git \
make
WORKDIR /moon
# 复制构建文件
COPY Makefile Makefile
# 初始化环境
RUN make init
# 复制源代码
COPY . .
# RUN git clone https://github.com/aide-family/magicbox.git ../magicbox
# RUN git clone https://github.com/aide-family/kratos.git ../kratos
# 构建应用
RUN make build
# 最终运行阶段 - 使用 Alpine
FROM alpine:latest
# 安装运行时依赖
RUN apk add --no-cache \
ca-certificates \
tzdata \
&& rm -rf /var/cache/apk/*
WORKDIR /moon
# 复制二进制文件
COPY --from=builder /moon/bin/rabbit /usr/local/bin/rabbit
# 设置可执行权限
RUN chmod +x /usr/local/bin/rabbit
# 暴露端口(根据实际配置调整)
EXPOSE 10070 10080 10090
# 运行应用
ENTRYPOINT ["/usr/local/bin/rabbit"]
CMD ["run", "all"]