Spaces:
Sleeping
Sleeping
chen commited on
Update Dockerfile
Browse files1212344566787891010111213141516111213141516# Read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker# you will also find guides on how best to write your Dockerfile# 使用輕量級的 Python 3.10 作為基礎映像FROM python:3.10-slim
FROM python:3.9# 將工作目錄設定為 /codeWORKDIR /code
RUN useradd -m -u 1000 userUSER userENV PATH="/home/user/.local/bin:$PATH"# 複製 requirements.txt 並安裝依賴套件COPY ./requirements.txt /code/requirements.txtRUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
WORKDIR /app
COPY --chown=user ./requirements.txt requirements.txtRUN pip install --no-cache-dir --upgrade -r requirements.txt
COPY --chown=user . /appCMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]# 複製你的應用程式程式碼COPY ./app.py /code/app.py
# 設定啟動指令:使用 gunicorn 啟動 app.py 中的 app 物件# 綁定到 0.0.0.0:7860,這是 HF Spaces 預期的端口CMD ["gunicorn", "--workers", "1", "--bind", "0.0.0.0:7860", "app:app"]Dockerfile+12-13