Download Dockerfile from unruffle/STOUTII: direct link, hf CLI and curl.
- Browser
- Download file 1.16 kB
-
https://huggingface.co/spaces/unruffle/STOUTII/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/unruffle/STOUTII/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/unruffle/STOUTII/resolve/main/Dockerfile
1.16 kB
| FROM python:3.10-slim | |
| ENV DEBIAN_FRONTEND=noninteractive \ | |
| PYTHONDONTWRITEBYTECODE=1 \ | |
| PYTHONUNBUFFERED=1 \ | |
| PIP_NO_CACHE_DIR=1 \ | |
| PYSTOW_HOME=/app/cache/pystow \ | |
| PYTHONIOENCODING=UTF-8 \ | |
| PORT=7860 | |
| # 这里在依赖列表中增加了 default-jre-headless | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| curl ca-certificates \ | |
| libstdc++6 libgomp1 \ | |
| libxrender1 libxext6 \ | |
| tini \ | |
| default-jre-headless \ | |
| && rm -rf /var/lib/apt/lists/* | |
| WORKDIR /app | |
| RUN useradd -m -u 1000 user | |
| COPY requirements.txt /app/requirements.txt | |
| RUN pip install --upgrade pip && \ | |
| pip install -r requirements.txt | |
| # 创建缓存目录并赋予权限 | |
| RUN mkdir -p /app/cache/pystow && chown -R user:user /app/cache | |
| COPY --chown=user:user . /app | |
| # 切换到非root用户执行后续操作 | |
| USER user | |
| # 预下载STOUT模型权重和CDK库,避免API首次请求超时 | |
| RUN python -c "from STOUT import translate_forward; print('Pre-loading model...'); translate_forward('C'); print('Complete.')" | |
| EXPOSE $PORT | |
| ENTRYPOINT ["/usr/bin/tini", "--"] | |
| CMD ["sh", "-c", "uvicorn app:app --host 0.0.0.0 --port ${PORT:-7860}"] |