dev2004v commited on
Commit
fdd0d4b
·
verified ·
1 Parent(s): ae63de2

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +24 -18
Dockerfile CHANGED
@@ -1,18 +1,24 @@
1
- # Use Python slim image
2
- FROM python:3.10-slim
3
-
4
- # Set working directory
5
- WORKDIR /code
6
-
7
- # Install dependencies
8
- COPY requirements.txt .
9
- RUN pip install --no-cache-dir -r requirements.txt
10
-
11
- # Copy app code
12
- COPY ./app ./app
13
-
14
- # Expose port
15
- EXPOSE 7860
16
-
17
- # Run FastAPI app
18
- CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
 
 
 
 
 
 
 
1
+ # Use Python slim image
2
+ FROM python:3.10-slim
3
+
4
+ # Set environment variable to avoid /.cache permission error
5
+ ENV TRANSFORMERS_CACHE=/tmp/hf_cache
6
+
7
+ # Set working directory
8
+ WORKDIR /code
9
+
10
+ # Install dependencies
11
+ COPY requirements.txt .
12
+ RUN pip install --no-cache-dir -r requirements.txt
13
+
14
+ # Pre-download Hugging Face model (optional but recommended)
15
+ RUN python -c "from transformers import pipeline; pipeline('summarization', model='facebook/bart-large-cnn')"
16
+
17
+ # Copy app code
18
+ COPY ./app ./app
19
+
20
+ # Expose port
21
+ EXPOSE 7860
22
+
23
+ # Run FastAPI app
24
+ CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]