turome-learning commited on
Commit
53dcff5
·
verified ·
1 Parent(s): eddf346

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -10
Dockerfile CHANGED
@@ -1,21 +1,22 @@
1
  FROM python:3.10
2
 
3
- # Set the working directory
4
- WORKDIR /app
 
5
 
6
- # Set writable cache for Numba to prevent caching errors
7
- ENV NUMBA_CACHE_DIR=/tmp/numba_cache/
 
8
 
9
- # Install dependencies
10
  COPY requirements.txt .
11
  RUN pip install --no-cache-dir -r requirements.txt
12
 
13
- # Copy application files
14
  COPY . /app/
15
 
16
- # Expose the port FastAPI will run on
17
- EXPOSE 8000
18
 
19
- # Run FastAPI when the container starts
20
- CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
21
 
 
1
  FROM python:3.10
2
 
3
+ # 1. Create a writable cache directory for huggingface_hub
4
+ RUN mkdir -p /tmp/huggingface_cache
5
+ ENV HUGGINGFACE_HUB_CACHE=/tmp/huggingface_cache
6
 
7
+ # 2. Create a writable cache directory for Numba (used by rembg/pymatting)
8
+ RUN mkdir -p /tmp/numba_cache
9
+ ENV NUMBA_CACHE_DIR=/tmp/numba_cache
10
 
11
+ WORKDIR /app
12
  COPY requirements.txt .
13
  RUN pip install --no-cache-dir -r requirements.txt
14
 
 
15
  COPY . /app/
16
 
17
+ # 3. Expose port 7860 for Hugging Face
18
+ EXPOSE 7860
19
 
20
+ # 4. Run your main.py (which calls uvicorn.run inside the __main__ block)
21
+ CMD ["python", "main.py"]
22