Spaces:
Paused
Paused
File size: 2,509 Bytes
96a2353 | 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 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | # 使用官方服务器镜像
FROM ghcr.io/ggml-org/llama.cpp:server
# 切换到 root 安装必要工具
USER root
RUN apt-get update && apt-get install -y python3 python3-pip nginx unzip && pip install huggingface_hub uv
# 创建工作目录并赋权 (Space 官方要求非 root 运行)
WORKDIR /app
RUN chmod 777 /app
# 使用 python 脚本下载模型,这样最稳,不需要处理复杂的 curl 参数
#RUN python3 -c "from huggingface_hub import hf_hub_download; \
# hf_hub_download(repo_id='Qwen/Qwen3-VL-8B-Instruct-GGUF', filename='Qwen3VL-8B-Instruct-Q4_K_M.gguf', local_dir='/app'); \
# hf_hub_download(repo_id='Qwen/Qwen3-VL-8B-Instruct-GGUF', filename='mmproj-Qwen3VL-8B-Instruct-Q8_0.gguf', local_dir='/app')"
# 下载草稿模型 (建议用 Qwen2.5-1.5B-Instruct-GGUF 的 Q4_K_M 版本)
#RUN python3 -c "from huggingface_hub import hf_hub_download; \
# hf_hub_download(repo_id='Qwen/Qwen3-VL-4B-Instruct-GGUF', \
# filename='Qwen3VL-4B-Instruct-Q4_K_M.gguf', local_dir='/app')"
# 下载草稿模型 (建议用 Qwen2.5-1.5B-Instruct-GGUF 的 Q4_K_M 版本)
#RUN python3 -c "from huggingface_hub import hf_hub_download; \
# hf_hub_download(repo_id='Qwen/Qwen3-VL-2B-Instruct-GGUF', \
# filename='Qwen3VL-2B-Instruct-Q4_K_M.gguf', local_dir='/app')"
# 下载草稿模型 (建议用 Qwen2.5-1.5B-Instruct-GGUF 的 Q4_K_M 版本)
#RUN python3 -c "from huggingface_hub import hf_hub_download; \
# hf_hub_download(repo_id='unsloth/gpt-oss-20b-GGUF', \
# filename='gpt-oss-20b-Q4_K_M.gguf', local_dir='/app')"
# 拷贝脚本并赋权
COPY entrypoint.sh /app/entrypoint.sh
#COPY setup_proxy.sh /app/setup_proxy.sh
COPY nginx.conf /etc/nginx/nginx.conf
#COPY config.json /app/config.json
COPY start_gost.sh /app/start_gost.sh
#RUN curl -Iv 149.154.166.110
# 权限处理
RUN chmod +x /app/entrypoint.sh && \
touch /tmp/nginx.pid && \
chown -R 1000:1000 /app /etc/nginx /var/log/nginx /var/lib/nginx /tmp
RUN useradd -m -u 1000 user &&chown -R 1000:1000 /home/user
# 切换回 user (Space 默认用户 ID 通常是 1000)
#USER 1000
#RUN export HOME=/home/$(whoami)
RUN python3 -m site --user-base
#RUN chown -R $USER:$USER $HOME/.local $HOME/.cache
#RUN echo 'export PATH=$PATH:$HOME/.local/bin' >> ~/.bashrc && . ~/.bashrc
ENV PATH ~/.local/bin:$PATH
RUN uv tool install nanobot-ai
#USER 1000
#"-m", "/app/Qwen3VL-8B-Instruct-Q4_K_M.gguf", \
#"--mmproj", "/app/mmproj-Qwen3VL-8B-Instruct-Q8_0.gguf", \
ENTRYPOINT ["/bin/bash", "/app/entrypoint.sh"]
|