Download Dockerfile from Zhepher/Netease: direct link, hf CLI and curl.
- Browser
- Download file 1.02 kB
-
https://huggingface.co/spaces/Zhepher/Netease/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/Zhepher/Netease/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/Zhepher/Netease/resolve/main/Dockerfile
1.02 kB
| FROM python:3.11-slim | |
| # 创建非特权用户 | |
| RUN useradd -m -u 1000 appuser && \ | |
| mkdir -p /tmp/music_downloads /tmp/music_api_logs && \ | |
| chown -R appuser:appuser /tmp/music_downloads /tmp/music_api_logs | |
| # 设置工作目录 | |
| WORKDIR /app | |
| # 安装系统依赖(如需编译部分库)并清理缓存 | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| build-essential \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # 复制并安装 Python 依赖 | |
| COPY requirements.txt requirements.txt | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # 复制项目文件并设置权限 | |
| COPY . . | |
| RUN chown -R appuser:appuser /app | |
| # 切换到非特权用户 | |
| USER appuser | |
| # 时区与环境变量 | |
| ENV TZ=Asia/Shanghai \ | |
| PORT=7860 \ | |
| PYTHONUNBUFFERED=1 \ | |
| DOWNLOADS_DIR=/tmp/music_downloads \ | |
| LOG_LEVEL=INFO | |
| # 暴露端口(Hugging Face Spaces 默认使用 $PORT) | |
| EXPOSE 7860 | |
| # 启动服务(HOST 从 main.py 读取默认 0.0.0.0,PORT 从环境变量读取) | |
| CMD ["python", "-u", "main.py"] |