FROM ghcr.io/abetlen/llama-cpp-python:latest USER root RUN useradd -m -u 1000 user WORKDIR /home/user/app RUN chown -R user:user /home/user/app USER user ENV PATH="/home/user/.local/bin:$PATH" # 必要なツール(FastAPIなど)を追加で入れる RUN pip install --no-cache-dir huggingface_hub fastapi uvicorn # さっき作ったapp.pyをHugging Faceのサーバー内にコピーする COPY --chown=user:user app.py /home/user/app/app.py EXPOSE 7860 # 1. モデルダウンロード 2. ポンコツサーバーを捨てて、自作のapp.pyを起動する! CMD python3 -c "from huggingface_hub import hf_hub_download; hf_hub_download(repo_id='Qwen/Qwen2.5-Coder-1.5B-Instruct-GGUF', filename='qwen2.5-coder-1.5b-instruct-q4_k_m.gguf', local_dir='./model')" && \ python3 app.py