nurfarah57 commited on
Commit
7450245
·
verified ·
1 Parent(s): a36ee13

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +10 -10
Dockerfile CHANGED
@@ -1,22 +1,22 @@
1
- # Use an official Python image
2
  FROM python:3.10
3
 
4
- # Set environment variables
5
- ENV TRANSFORMERS_CACHE=/data/.cache
6
- ENV HF_HOME=/data/.cache
7
 
8
- # Install dependencies
 
 
 
9
  RUN pip install --upgrade pip
10
- RUN pip install fastapi uvicorn transformers torch
11
 
12
- # Create app directory
13
  WORKDIR /app
14
 
15
- # Copy code
 
 
16
  COPY main.py .
17
 
18
- # Expose port
19
  EXPOSE 7860
20
 
21
- # Start FastAPI
22
  CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
+ # Use official Python image
2
  FROM python:3.10
3
 
4
+ # Create a writable cache directory
5
+ RUN mkdir -p /cache && chmod -R 777 /cache
 
6
 
7
+ # Set environment variable
8
+ ENV HF_HOME=/cache
9
+
10
+ # Upgrade pip
11
  RUN pip install --upgrade pip
 
12
 
 
13
  WORKDIR /app
14
 
15
+ COPY requirements.txt .
16
+ RUN pip install -r requirements.txt
17
+
18
  COPY main.py .
19
 
 
20
  EXPOSE 7860
21
 
 
22
  CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]