-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathDockerfile.binary
More file actions
49 lines (39 loc) · 1.27 KB
/
Copy pathDockerfile.binary
File metadata and controls
49 lines (39 loc) · 1.27 KB
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
# 基于 Debian 13 slim 镜像
FROM debian:13-slim
# 声明构建参数
ARG TARGETPLATFORM
# 安装运行时依赖并应用安全更新
RUN apt-get update && \
apt-get install -y \
ca-certificates \
tzdata \
curl \
&& apt-get upgrade -y \
&& rm -rf /var/lib/apt/lists/*
# 创建必要的目录
RUN mkdir -p /opt/msm /var/log/msm
# 复制对应架构的二进制文件
# TARGETPLATFORM 格式: linux/amd64, linux/arm64, linux/arm/v7, linux/arm/v6, linux/386
COPY binaries/${TARGETPLATFORM}/msm /usr/local/bin/msm
RUN chmod +x /usr/local/bin/msm
# 以 root 用户运行以支持透明代理、TUN 设备等高级网络功能
WORKDIR /opt/msm
# 暴露端口
# 7777: MSM Web 管理界面
# 53: DNS (MosDNS) - UDP 和 TCP
# 1053: DNS 备用端口
# 7890: HTTP 代理 (SingBox/Clash)
# 7891: SOCKS5 代理 (SingBox/Clash)
# 7892: 混合代理端口 (SingBox/Clash)
# 6666: 管理端口
EXPOSE 7777 53/tcp 53/udp 1053 7890 7891 7892 6666
# 环境变量
ENV JWT_SECRET="" \
MSM_PORT="7777" \
MSM_CONFIG_DIR="/opt/msm" \
TZ="Asia/Shanghai"
# 健康检查
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD curl -f http://localhost:${MSM_PORT}/ || exit 1
# 启动命令
CMD ["sh", "-c", "msm serve -p ${MSM_PORT} -c ${MSM_CONFIG_DIR}"]