Spaces:
Sleeping
Sleeping
File size: 936 Bytes
8362005 63e6c37 2df52da 0c1b325 63e6c37 8847bf9 2df52da 8362005 63e6c37 0c1b325 8362005 63e6c37 abde073 2df52da b816513 |
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 |
FROM python:3.11-slim
# Create user with ID 1000 (required for HF Spaces)
RUN useradd -m -u 1000 user
# Install dependencies as root
RUN apt update && apt install -y wget curl
# Set up working directory and change ownership
WORKDIR /app
RUN chown -R user:user /app
# Install Python dependencies
COPY --chown=user:user requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt && \
which uvicorn && uvicorn --version
# Copy code and setup with proper ownership
COPY --chown=user:user . .
RUN chmod +x ./setup.sh && ./setup.sh
# Switch to user before creating directories
USER user
# Set up Ollama directories with proper permissions
ENV HOME=/home/user
ENV OLLAMA_MODELS=/home/user/.ollama
RUN mkdir -p /home/user/.ollama
# Set PATH for user's local bin
ENV PATH=/home/user/.local/bin:$PATH
EXPOSE 7860
CMD bash -c "ollama serve & sleep 5 && ollama pull smollm && uvicorn server:app --host 0.0.0.0 --port 7860"
|