NanobotzAI commited on
Commit
36d639a
·
verified ·
1 Parent(s): 24a5e73

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +9 -3
Dockerfile CHANGED
@@ -6,7 +6,9 @@ ENV PYTHONUNBUFFERED=1 \
6
  PORT=7860 \
7
  PYTHONPATH=/app \
8
  HOME=/home/chrome \
9
- CHROME_BIN=/usr/bin/google-chrome
 
 
10
 
11
  # Create chrome user
12
  RUN mkdir -p /home/chrome && \
@@ -32,12 +34,16 @@ RUN apt-get update && apt-get install -y \
32
  && chown -R chrome:chrome /usr/bin/google-chrome \
33
  && rm -rf /var/lib/apt/lists/*
34
 
 
 
 
35
  # Copy requirements file
36
  COPY requirements.txt .
37
 
38
- # Install Python dependencies
39
  RUN pip install --no-cache-dir -r requirements.txt \
40
- && pip install --no-cache-dir hypercorn
 
41
 
42
  # Copy the current directory contents into the container
43
  COPY . /app
 
6
  PORT=7860 \
7
  PYTHONPATH=/app \
8
  HOME=/home/chrome \
9
+ CHROME_BIN=/usr/bin/google-chrome \
10
+ TRANSFORMERS_CACHE=/app/.cache \
11
+ HF_HOME=/app/.cache
12
 
13
  # Create chrome user
14
  RUN mkdir -p /home/chrome && \
 
34
  && chown -R chrome:chrome /usr/bin/google-chrome \
35
  && rm -rf /var/lib/apt/lists/*
36
 
37
+ # Create cache directory and set permissions
38
+ RUN mkdir -p /app/.cache && chown -R chrome:chrome /app/.cache
39
+
40
  # Copy requirements file
41
  COPY requirements.txt .
42
 
43
+ # Install Python dependencies and pre-download the model
44
  RUN pip install --no-cache-dir -r requirements.txt \
45
+ && pip install --no-cache-dir hypercorn sentence-transformers \
46
+ && python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('all-MiniLM-L6-v2')"
47
 
48
  # Copy the current directory contents into the container
49
  COPY . /app