portfolio-website / Dockerfile
Ayush Rai
Fix HF cache and persist dir to use /tmp
b94a64d
raw
history blame contribute delete
964 Bytes
FROM python:3.10-slim
# install OS deps needed by PyMuPDF / some packages
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential libgl1 git curl \
&& rm -rf /var/lib/apt/lists/*
# create a non-root user
RUN useradd -m -u 1000 appuser
USER appuser
ENV PATH="/home/appuser/.local/bin:$PATH"
WORKDIR /home/appuser/app
# copy requirements and install
COPY --chown=appuser:appuser requirements.txt /home/appuser/app/requirements.txt
RUN python -m pip install --upgrade pip
RUN pip install --no-cache-dir -r /home/appuser/app/requirements.txt
# copy project files
COPY --chown=appuser:appuser . /home/appuser/app
# ensure HF cache + persistence go to /tmp
ENV HF_HOME=/tmp/.huggingface
ENV PERSIST_DIR=/tmp/chroma_db
ENV RESUME_PATH=/home/appuser/app/media/resume/resume-ayush.pdf
EXPOSE 7860
# use uvicorn to serve FastAPI (HF will call this)
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]