From 286dcc1b14b08922e4caf684707d48c8f2ea0be4 Mon Sep 17 00:00:00 2001 From: ccbkkb <9201575@gmail.com> Date: Sat, 21 Mar 2026 18:36:20 +0800 Subject: [PATCH] Update Dockerfile --- Dockerfile | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3fa1497..373d5cf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,30 @@ +# ========================================== +# 阶段 1:极速编译 MicroSOCKS 引擎 +# ========================================== +FROM alpine:latest AS builder +# 安装 C 语言编译环境 +RUN apk add --no-cache build-base git +# 从官方仓库拉取源码并编译 (只需 2 秒) +RUN git clone https://github.com/rofl0r/microsocks.git /src && \ + cd /src && make + +# ========================================== +# 阶段 2:极净运行环境 +# ========================================== FROM alpine:latest -# 安装内核级 WireGuard 工具、网络控制组件以及纯 C 语言的 microsocks 服务器 -RUN apk add --no-cache wireguard-tools iptables iproute2 wget curl microsocks +# 仅安装必要的内核级 WireGuard 和网络控制工具 +RUN apk add --no-cache wireguard-tools iptables iproute2 wget curl + +# 把刚才编译好的二进制可执行文件“偷”过来 +COPY --from=builder /src/microsocks /usr/local/bin/microsocks WORKDIR /app COPY entrypoint.sh . RUN chmod +x entrypoint.sh -# 暴露 SOCKS5 端口 +# 暴露标准 SOCKS5 端口 EXPOSE 1080 +# 启动引擎 CMD ["./entrypoint.sh"]