cometapii commited on
Commit
1901180
·
verified ·
1 Parent(s): 2ec1eb7

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +10 -4
Dockerfile CHANGED
@@ -5,29 +5,35 @@ RUN apt-get update && apt-get install -y \
5
  curl \
6
  ca-certificates \
7
  zstd \
 
 
8
  && rm -rf /var/lib/apt/lists/*
9
 
10
  # Install Ollama
11
  RUN curl -fsSL https://ollama.ai/install.sh | sh
12
 
 
 
 
 
13
  # Create non-root user (HF Spaces requires UID 1000)
14
  RUN useradd -m -u 1000 user
15
  USER user
16
 
17
  ENV HOME=/home/user \
18
  PATH="/home/user/.local/bin:$PATH" \
19
- OLLAMA_HOST=0.0.0.0:7860 \
20
  OLLAMA_MODELS=/home/user/.ollama/models
21
 
22
  WORKDIR $HOME/app
23
 
24
  COPY --chown=user entrypoint.sh .
 
25
  RUN chmod +x entrypoint.sh
26
 
27
- # Pre-pull model at build time so first request is instant
28
- # HF Spaces build layer caches this
29
  USER root
30
- RUN ollama serve & \
31
  sleep 5 && \
32
  ollama pull granite4:350m && \
33
  pkill ollama || true
 
5
  curl \
6
  ca-certificates \
7
  zstd \
8
+ python3 \
9
+ python3-pip \
10
  && rm -rf /var/lib/apt/lists/*
11
 
12
  # Install Ollama
13
  RUN curl -fsSL https://ollama.ai/install.sh | sh
14
 
15
+ # Install Python deps system-wide
16
+ COPY requirements.txt /tmp/requirements.txt
17
+ RUN pip3 install --no-cache-dir -r /tmp/requirements.txt
18
+
19
  # Create non-root user (HF Spaces requires UID 1000)
20
  RUN useradd -m -u 1000 user
21
  USER user
22
 
23
  ENV HOME=/home/user \
24
  PATH="/home/user/.local/bin:$PATH" \
25
+ OLLAMA_HOST=127.0.0.1:11434 \
26
  OLLAMA_MODELS=/home/user/.ollama/models
27
 
28
  WORKDIR $HOME/app
29
 
30
  COPY --chown=user entrypoint.sh .
31
+ COPY --chown=user proxy.py .
32
  RUN chmod +x entrypoint.sh
33
 
34
+ # Pre-pull model at build time
 
35
  USER root
36
+ RUN OLLAMA_HOST=127.0.0.1:11434 ollama serve & \
37
  sleep 5 && \
38
  ollama pull granite4:350m && \
39
  pkill ollama || true