Spaces:
Paused
Paused
Download Dockerfile from coolmanx/man: direct link, hf CLI and curl.
- Browser
- Download file 995 Bytes
-
https://huggingface.co/spaces/coolmanx/man/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/coolmanx/man/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/coolmanx/man/resolve/main/Dockerfile
995 Bytes
| # 使用官方 Python 镜像作为基础镜像 | |
| FROM python:3.9-slim | |
| # 设置工作目录 | |
| WORKDIR /app | |
| # 将当前目录下的所有文件复制到工作目录 | |
| COPY . . | |
| # 安装项目依赖 | |
| RUN pip install Flask python-dotenv huggingface_hub requests gunicorn | |
| # 开放应用程序的端口 | |
| EXPOSE 5000 | |
| # 设置环境变量(可选,如果需要传递 Docker 环境中的环境变量) | |
| RUN --mount=type=secret,id=HF_TOKEN,mode=0444,required=true \ | |
| --mount=type=secret,id=MAN_NAME,mode=0444,required=true \ | |
| --mount=type=secret,id=MAN_PASS,mode=0444,required=true \ | |
| --mount=type=secret,id=API_KEY,mode=0444,required=true \ | |
| USERNAME=$(cat /run/secrets/MAN_NAME) &&\ | |
| PASSWORD=$(cat /run/secrets/MAN_PASS) &&\ | |
| HF_TOKENS=$(cat /run/secrets/HF_TOKEN) &&\ | |
| API_KEY=$(cat /run/secrets/API_KEY) &&\ | |
| echo "USERNAME=$USERNAME\n\ | |
| PASSWORD=$PASSWORD\n\ | |
| HF_TOKENS=$HF_TOKENS\n\ | |
| API_KEY=$API_KEY\n" > .env | |
| #RUN cat .env | |
| # 定义启动命令 | |
| CMD ["gunicorn", "--bind", "0.0.0.0:5000", "app:app"] | |