Adedoyinjames commited on
Commit
e3e42ae
·
verified ·
1 Parent(s): 49784f7

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +6 -3
Dockerfile CHANGED
@@ -3,21 +3,24 @@ FROM python:3.10-slim
3
  ENV PYTHONDONTWRITEBYTECODE=1
4
  ENV PYTHONUNBUFFERED=1
5
 
 
6
  WORKDIR /app
 
7
 
8
- # create writable cache dir and set env vars
9
- RUN mkdir -p /app/.cache \
10
- && chown -R root:root /app/.cache
11
  ENV HF_HOME=/app/.cache
12
  ENV TRANSFORMERS_CACHE=/app/.cache
13
  ENV HF_DATASETS_CACHE=/app/.cache
14
  ENV XDG_CACHE_HOME=/app/.cache
15
 
 
16
  COPY requirements.txt .
17
  RUN pip install --no-cache-dir -r requirements.txt
18
 
 
19
  COPY . .
20
 
21
  EXPOSE 7860
22
 
 
23
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
3
  ENV PYTHONDONTWRITEBYTECODE=1
4
  ENV PYTHONUNBUFFERED=1
5
 
6
+ # Create working dir and cache dir, grant write access to all users
7
  WORKDIR /app
8
+ RUN mkdir -p /app/.cache && chmod -R 777 /app/.cache
9
 
10
+ # Set environment variables for Hugging Face and Transformers
 
 
11
  ENV HF_HOME=/app/.cache
12
  ENV TRANSFORMERS_CACHE=/app/.cache
13
  ENV HF_DATASETS_CACHE=/app/.cache
14
  ENV XDG_CACHE_HOME=/app/.cache
15
 
16
+ # Copy and install dependencies
17
  COPY requirements.txt .
18
  RUN pip install --no-cache-dir -r requirements.txt
19
 
20
+ # Copy app code
21
  COPY . .
22
 
23
  EXPOSE 7860
24
 
25
+ # Run FastAPI
26
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]