EGYADMIN commited on
Commit
a0f6119
·
verified ·
1 Parent(s): d579f1e

Update Dockerfile to pre-download model during build

Browse files

Add RUN command to execute download_model.py during container build to pre-cache the Kimi-K2-Instruct model

Files changed (1) hide show
  1. Dockerfile +25 -22
Dockerfile CHANGED
@@ -5,32 +5,35 @@ WORKDIR /app
5
  # Install system dependencies
6
  RUN apt-get update && apt-get install -y \
7
  git \
8
- git-lfs \
9
- build-essential \
10
- && rm -rf /var/lib/apt/lists/*
11
 
12
- # Initialize git-lfs
13
- RUN git lfs install
14
 
15
- # Install Python packages
16
- COPY requirements.txt .
17
- RUN pip install --no-cache-dir --upgrade pip && \
18
- pip install --no-cache-dir -r requirements.txt
19
 
20
- # Copy application files
21
- COPY . .
22
 
23
- # Set up Hugging Face cache directory
24
- ENV HF_HOME=/app/cache
25
- ENV TRANSFORMERS_CACHE=/app/cache
26
- ENV HF_HUB_CACHE=/app/cache
27
 
28
- # Set environment variables for better performance
29
- ENV PYTORCH_CUDA_ALLOC_CONF=max_split_size_mb:512
30
- ENV CUDA_VISIBLE_DEVICES=0,1,2,3
31
 
32
- # Expose port for the application
33
- EXPOSE 7860
34
 
35
- # Run the application
36
- CMD ["python", "app.py"]
 
 
 
 
5
  # Install system dependencies
6
  RUN apt-get update && apt-get install -y \
7
  git \
8
+ git-lfs \
9
+ build-essential \
10
+ && rm -rf /var/lib/apt/lists/*
11
 
12
+ # Initialize git-lfs
13
+ RUN git lfs install
14
 
15
+ # Install Python packages
16
+ COPY requirements.txt .
17
+ RUN pip install --no-cache-dir --upgrade pip && \
18
+ pip install --no-cache-dir -r requirements.txt
19
 
20
+ # Copy application files
21
+ COPY . .
22
 
23
+ # Set up Hugging Face cache directory
24
+ ENV HF_HOME=/app/cache
25
+ ENV TRANSFORMERS_CACHE=/app/cache
26
+ ENV HF_HUB_CACHE=/app/cache
27
 
28
+ # Set environment variables for better performance
29
+ ENV PYTORCH_CUDA_ALLOC_CONF=max_split_size_mb:512
30
+ ENV CUDA_VISIBLE_DEVICES=0,1,2,3
31
 
32
+ # Pre-download model during build
33
+ RUN python download_model.py
34
 
35
+ # Expose port for the application
36
+ EXPOSE 7860
37
+
38
+ # Run the application
39
+ CMD ["python", "app.py"]