File size: 942 Bytes
1f2477d ad068d5 1901180 1f2477d 1901180 1f2477d 1901180 1f2477d 1901180 1f2477d 1901180 1f2477d 1901180 1f2477d ad068d5 | 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 42 43 44 | FROM ubuntu:22.04
# Deps
RUN apt-get update && apt-get install -y \
curl \
ca-certificates \
zstd \
python3 \
python3-pip \
&& rm -rf /var/lib/apt/lists/*
# Install Ollama
RUN curl -fsSL https://ollama.ai/install.sh | sh
# Install Python deps system-wide
COPY requirements.txt /tmp/requirements.txt
RUN pip3 install --no-cache-dir -r /tmp/requirements.txt
# Create non-root user (HF Spaces requires UID 1000)
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH="/home/user/.local/bin:$PATH" \
OLLAMA_HOST=127.0.0.1:11434 \
OLLAMA_MODELS=/home/user/.ollama/models
WORKDIR $HOME/app
COPY --chown=user entrypoint.sh .
COPY --chown=user proxy.py .
RUN chmod +x entrypoint.sh
# Pre-pull model at build time
USER root
RUN OLLAMA_HOST=127.0.0.1:11434 ollama serve & \
sleep 5 && \
ollama pull granite4:350m && \
pkill ollama || true
USER user
EXPOSE 7860
CMD ["./entrypoint.sh"] |