Download Dockerfile from zeeeeef/Competitive_Analysis_AI_Version: direct link, hf CLI and curl.
- Browser
- Download file 1.45 kB
-
https://huggingface.co/spaces/zeeeeef/Competitive_Analysis_AI_Version/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/zeeeeef/Competitive_Analysis_AI_Version/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/zeeeeef/Competitive_Analysis_AI_Version/resolve/main/Dockerfile
1.45 kB
| FROM python:3.12-slim | |
| WORKDIR /app | |
| # 系统依赖:删除 software-properties-common;加上 --no-install-recommends 精简镜像 | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| build-essential \ | |
| curl \ | |
| git \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # 先复制 requirements 以利用缓存层 | |
| COPY requirements.txt ./ | |
| # 安装 Python 依赖 | |
| RUN pip3 install --no-cache-dir -r requirements.txt | |
| # 再复制应用代码 | |
| COPY app.py ./ | |
| # 创建目录(你原先就有),保持不改你的路径与权限设定 | |
| RUN mkdir -p /tmp/.streamlit && chmod 777 /tmp/.streamlit && \ | |
| mkdir -p /app/.streamlit && chmod 777 /app/.streamlit && \ | |
| mkdir -p /.streamlit && chmod 777 /.streamlit && \ | |
| mkdir -p /app/extracted_images && chmod 777 /app/extracted_images && \ | |
| mkdir -p /tmp/streamlit_temp && chmod 777 /tmp/streamlit_temp && \ | |
| mkdir -p /root/.streamlit && chmod 777 /root/.streamlit && \ | |
| chmod 777 /app | |
| # 环境变量 | |
| ENV STREAMLIT_SERVER_HEADLESS=true \ | |
| STREAMLIT_SERVER_ENABLE_CORS=false \ | |
| STREAMLIT_SERVER_PORT=8501 \ | |
| STREAMLIT_CONFIG_DIR=/tmp/.streamlit \ | |
| STREAMLIT_BROWSER_GATHER_USAGE_STATS=false | |
| EXPOSE 8501 | |
| # 健康检查 | |
| HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health | |
| # 启动 | |
| CMD ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0", "--server.enableXsrfProtection=false", "--server.enableWebsocketCompression=false"] | |