Spaces:
Running
Running
File size: 1,118 Bytes
c7980ff d5c9ae8 8c5cbbd 5aaa926 8c5cbbd 5aaa926 e227dd6 5aaa926 d5c9ae8 5aaa926 418f64b 566ab35 5aaa926 a2e3298 29aca70 8c5cbbd d5c9ae8 e227dd6 d5c9ae8 5aaa926 d5c9ae8 5aaa926 8c5cbbd a39d8e8 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | FROM python:3.10-slim
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PORT=7860 \
HF_HOME=/app/cache \
PATH="/home/user/.local/bin:${PATH}"
WORKDIR /app
# 1. Install runtime dependencies
# Added 'libgomp1' here to fix the "libgomp.so.1" error
RUN apt-get update && apt-get install -y \
curl \
libgomp1 \
&& rm -rf /var/lib/apt/lists/*
# 2. Create user and directories
RUN useradd -m -u 1000 user
RUN mkdir -p /app/cache /app/models /app/wheels && chown -R user:user /app
# 3. Install pip
RUN pip install --no-cache-dir --upgrade pip
USER user
# 4. Install the Local Wheel
COPY --chown=user:user ./wheels /app/wheels
RUN pip install --no-cache-dir /app/wheels/llama_cpp_python-*.whl
# 5. Install other dependencies
COPY --chown=user:user requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# 6. Copy ALL Application Code
COPY --chown=user:user . .
EXPOSE 7860
# 7. Start the app
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"] |