Adedoyinjames commited on
Commit
30f15fa
·
verified ·
1 Parent(s): 1514e88

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +9 -5
Dockerfile CHANGED
@@ -1,13 +1,16 @@
1
  FROM python:3.10-slim
2
 
 
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
@@ -17,10 +20,11 @@ ENV XDG_CACHE_HOME=/app/.cache
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"]
 
1
  FROM python:3.10-slim
2
 
3
+ # Prevent Python from writing .pyc files and buffer outputs
4
  ENV PYTHONDONTWRITEBYTECODE=1
5
  ENV PYTHONUNBUFFERED=1
6
 
7
+ # Working directory
8
  WORKDIR /app
9
+
10
+ # Create cache directory with full permissions
11
  RUN mkdir -p /app/.cache && chmod -R 777 /app/.cache
12
 
13
+ # Environment variables for Hugging Face caching
14
  ENV HF_HOME=/app/.cache
15
  ENV TRANSFORMERS_CACHE=/app/.cache
16
  ENV HF_DATASETS_CACHE=/app/.cache
 
20
  COPY requirements.txt .
21
  RUN pip install --no-cache-dir -r requirements.txt
22
 
23
+ # Copy application code
24
  COPY . .
25
 
26
+ # Expose FastAPI default port
27
  EXPOSE 7860
28
 
29
+ # Command to run the FastAPI app via Uvicorn
30
+ CMD ["python", "app.py"]