j-higgins commited on
Commit
a05f004
·
1 Parent(s): 6189d82

Set TRANSFORMERS_CACHE environment variable to a writable directory

Browse files
Files changed (2) hide show
  1. Dockerfile +12 -5
  2. start.sh +10 -0
Dockerfile CHANGED
@@ -1,10 +1,17 @@
1
- FROM python:3.9-slim
2
 
 
 
 
 
 
3
  WORKDIR /app
4
 
5
- COPY requirements.txt .
6
- RUN pip install --no-cache-dir -r requirements.txt
7
 
8
- COPY . .
 
9
 
10
- CMD ["python", "app.py"]
 
 
1
+ FROM python:3.9
2
 
3
+ # Set the TRANSFORMERS_CACHE environment variable
4
+ ENV TRANSFORMERS_CACHE=/app/cache/huggingface/hub
5
+
6
+ # Copy your app code
7
+ COPY . /app
8
  WORKDIR /app
9
 
10
+ # Install dependencies
11
+ RUN pip install -r requirements.txt
12
 
13
+ # Create the cache directory
14
+ RUN mkdir -p /app/cache/huggingface/hub
15
 
16
+ # Start the app
17
+ CMD ["python", "app.py"]
start.sh ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+
3
+ # Create the cache directory if it doesn't exist
4
+ mkdir -p ./cache/huggingface/hub
5
+
6
+ # Set the TRANSFORMERS_CACHE environment variable
7
+ export TRANSFORMERS_CACHE=$(pwd)/cache/huggingface/hub
8
+
9
+ # Start the app
10
+ python app.py