Spaces:
Sleeping
Sleeping
Download Dockerfile from ZHZ1024/open-cwall-api: direct link, hf CLI and curl.
- Browser
- Download file 827 Bytes
-
https://huggingface.co/spaces/ZHZ1024/open-cwall-api/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/ZHZ1024/open-cwall-api/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/ZHZ1024/open-cwall-api/resolve/main/Dockerfile
827 Bytes
| # 使用官方Python镜像作为基础镜像 | |
| FROM python:3.10-slim | |
| # 设置工作目录 | |
| WORKDIR /app | |
| # 复制当前目录内容到容器中 | |
| COPY . /app | |
| # 安装Playwright系统依赖和Python包 | |
| RUN apt-get update && \ | |
| apt-get install -y \ | |
| wget \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # 安装Python依赖 | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| RUN pip install requests | |
| # 设置Playwright缓存目录的环境变量 | |
| ENV PLAYWRIGHT_BROWSERS_PATH=/app/playwright-browsers | |
| # 安装Playwright和浏览器(使用普通用户权限) | |
| RUN pip install playwright && \ | |
| playwright install --with-deps | |
| # 创建非root用户并切换 | |
| RUN useradd -m myuser && chown -R myuser:myuser /app | |
| USER myuser | |
| # 暴露端口 | |
| EXPOSE 8000 | |
| # 运行应用 | |
| CMD ["uvicorn", "api:app", "--host", "0.0.0.0", "--port", "8000"] |