FROM codercom/code-server:latest USER root # 安装基础工具及 Ollama RUN apt-get update && apt-get install -y curl htop git zstd && \ curl -fsSL https://ollama.com/install.sh | sh && \ apt-get clean && rm -rf /var/lib/apt/lists/* # 创建 Ollama 的模型存放目录,并赋予 coder 用户权限 RUN mkdir -p /home/coder/.ollama && chown -R coder:coder /home/coder/.ollama USER coder WORKDIR /home/coder # 复制启动脚本 COPY --chown=coder:coder entrypoint.sh /home/coder/entrypoint.sh RUN chmod +x /home/coder/entrypoint.sh # 暴露 Hugging Face 规定的 7860 端口 EXPOSE 7860 ENTRYPOINT ["/home/coder/entrypoint.sh"]