astra-parser / Dockerfile
Turhan123's picture
Update Dockerfile
a74f8ab verified
Raw
History Blame Contribute Delete
820 Bytes
FROM python:3.10
RUN apt-get update && apt-get install -y --no-install-recommends build-essential cmake && rm -rf /var/lib/apt/lists/*
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user PATH="/home/user/.local/bin:$PATH"
ENV MODEL_REPO=Turhan123/astra-meal-parser-gguf
ENV MODEL_FILE=astra-meal-parser-1.5b-q4_k_m.gguf
ENV MODEL_DIR=/home/user/models
WORKDIR /app
COPY --chown=user ./requirements.txt requirements.txt
RUN pip install --no-cache-dir --upgrade -r requirements.txt
# Bake the GGUF into the image so cold starts don't re-download
RUN python -c "from huggingface_hub import hf_hub_download; import os; hf_hub_download(os.environ['MODEL_REPO'], os.environ['MODEL_FILE'], local_dir=os.environ['MODEL_DIR'])"
COPY --chown=user . /app
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]