PreethiCarmelBosco commited on
Commit
c698c9d
·
verified ·
1 Parent(s): 4ce919c
Files changed (1) hide show
  1. Dockerfile +9 -5
Dockerfile CHANGED
@@ -1,17 +1,21 @@
1
  # --- 1. Use the official Ollama pre-built image ---
2
  FROM ollama/ollama
3
 
4
- # --- 2. Install Python & dependencies for our download script ---
5
  # The base image is Debian, so we can use apt-get
6
- RUN apt-get update && apt-get install -y python3 python3-pip
7
- RUN pip install huggingface_hub
8
 
9
- # --- 3. Download the GGUF model ---
10
  WORKDIR /app
11
  COPY download_model.py .
12
  ARG HF_TOKEN
 
 
13
  RUN --mount=type=secret,id=HF_TOKEN \
14
- python3 download_model.py
 
 
 
15
 
16
  # --- 4. Create the Ollama "Modelfile" ---
17
  # This file tells Ollama to use our downloaded GGUF
 
1
  # --- 1. Use the official Ollama pre-built image ---
2
  FROM ollama/ollama
3
 
4
+ # --- 2. Install Python, pip, and the venv package ---
5
  # The base image is Debian, so we can use apt-get
6
+ RUN apt-get update && apt-get install -y python3 python3-pip python3-venv
 
7
 
8
+ # --- 3. Download the GGUF model using a safe venv ---
9
  WORKDIR /app
10
  COPY download_model.py .
11
  ARG HF_TOKEN
12
+ # This command creates a venv, installs hf_hub, downloads the model,
13
+ # and then the venv is discarded, keeping the system clean.
14
  RUN --mount=type=secret,id=HF_TOKEN \
15
+ sh -c 'python3 -m venv /tmp/downloader-venv && \
16
+ . /tmp/downloader-venv/bin/activate && \
17
+ pip install huggingface_hub && \
18
+ python3 download_model.py'
19
 
20
  # --- 4. Create the Ollama "Modelfile" ---
21
  # This file tells Ollama to use our downloaded GGUF