hadokenvskikoken commited on
Commit
3e4e9a0
·
verified ·
1 Parent(s): b26fccc

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +16 -2
Dockerfile CHANGED
@@ -2,20 +2,34 @@ FROM python:3.9-slim
2
 
3
  WORKDIR /app
4
 
5
- # Install system dependencies (for transformers)
6
  RUN apt-get update && apt-get install -y \
7
  git \
8
  gcc \
 
 
9
  && rm -rf /var/lib/apt/lists/*
10
 
 
 
 
 
 
 
 
 
11
  # Install Python dependencies
12
  COPY requirements.txt .
13
  RUN pip install --no-cache-dir -r requirements.txt
14
 
 
 
 
 
15
  # Copy code
16
  COPY . .
17
 
18
- # Expose port (must match Hugging Face's default: 7860)
19
  EXPOSE 7860
20
 
21
  # Run the API
 
2
 
3
  WORKDIR /app
4
 
5
+ # Install system dependencies (for transformers and other requirements)
6
  RUN apt-get update && apt-get install -y \
7
  git \
8
  gcc \
9
+ g++ \
10
+ make \
11
  && rm -rf /var/lib/apt/lists/*
12
 
13
+ # Create cache directory with proper permissions
14
+ RUN mkdir -p /.cache && chmod -R 777 /.cache
15
+
16
+ # Set environment variables for Hugging Face cache
17
+ ENV TRANSFORMERS_CACHE=/.cache
18
+ ENV HF_HOME=/.cache
19
+ ENV HUGGINGFACE_HUB_CACHE=/.cache
20
+
21
  # Install Python dependencies
22
  COPY requirements.txt .
23
  RUN pip install --no-cache-dir -r requirements.txt
24
 
25
+ # Optionally pre-download the tokenizer during build
26
+ # Uncomment if you want to download during build (for smaller models)
27
+ # RUN python -c "from transformers import AutoTokenizer; AutoTokenizer.from_pretrained('codellama/CodeLlama-7b-hf')"
28
+
29
  # Copy code
30
  COPY . .
31
 
32
+ # Expose port
33
  EXPOSE 7860
34
 
35
  # Run the API