ai_chat_api / Dockerfile
Soumik Bose
ok
a243ca8
raw
history blame contribute delete
929 Bytes
FROM python:3.10-slim
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PORT=7860 \
HF_HOME=/app/cache \
PATH="/home/user/.local/bin:${PATH}"
WORKDIR /app
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
curl \
libgomp1 \
&& rm -rf /var/lib/apt/lists/*
RUN useradd -m -u 1000 user \
&& mkdir -p /app/cache /app/models /app/wheels \
&& chown -R user:user /app
RUN pip install --no-cache-dir --upgrade pip
USER user
COPY --chown=user:user ./wheels /app/wheels
RUN pip install --no-cache-dir /app/wheels/llama_cpp_python-*.whl
COPY --chown=user:user requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY --chown=user:user . .
EXPOSE 7860
CMD ["bash", "-c", \
"while true; do curl -s https://xce009-ai-chat-api.hf.space/ping > /dev/null || true; sleep 300; done & \
python -m uvicorn main:app --host 0.0.0.0 --port 7860"]