trojan / Dockerfile
lydgs's picture
Update Dockerfile
f9bfa4a verified
Raw
History Blame Contribute Delete
1.17 kB
FROM debian:stable
# 安装必要的依赖
RUN apt-get update && \
apt-get install -y git wget python3 python3-pip unzip && \
rm -rf /var/cache/apt/archives /var/lib/apt/lists/*
RUN mkdir -p /var/log/app
# 克隆项目文件到容器内(这里假设你的文件都已上传)
RUN git clone "https://git.evulid.cc/cyberes/huggingface-proxy.git" /app/huggingface
# 复制配置文件到指定位置
COPY ./rathole-client.toml /app/huggingface/rathole-client.toml
COPY ./server.py /app/huggingface/space/server.py
# 下载并解压 rathole 工具到 /app 目录
RUN wget https://github.com/rapiz1/rathole/releases/download/v0.5.0/rathole-x86_64-unknown-linux-gnu.zip -O /tmp/rathole.zip
RUN unzip /tmp/rathole.zip -d /app
# 安装 Python 依赖
RUN pip install --break-system-packages supervisor requests flask proxy.py "httpx[http2]"
# 创建非 root 用户,提高安全性
RUN adduser --disabled-password --gecos '' --uid 1000 newuser
RUN chown -R newuser:newuser /app
# 声明容器运行时监听的端口
EXPOSE 7860
USER newuser
# 启动 supervisor 守护进程
CMD cd /app && /usr/local/bin/supervisord -c /app/huggingface/space/supervisord.conf