Tantawi commited on
Commit
0a347f3
·
verified ·
1 Parent(s): 5b9fe2b

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +17 -11
Dockerfile CHANGED
@@ -1,21 +1,27 @@
1
- # Use a CPU-based Python image compatible with Hugging Face
2
- FROM python:3.8-slim
3
 
4
- # Set the working directory
 
 
 
5
  WORKDIR /app
6
 
7
- # Copy requirements and install dependencies
 
 
 
8
  COPY requirements.txt .
9
  RUN pip install --no-cache-dir -r requirements.txt
10
 
11
- # Manually install TensorFlow CPU version
12
- RUN pip install --no-cache-dir tensorflow==2.10.0
13
-
14
- # Copy the FastAPI application
15
  COPY app/ ./app/
16
 
17
- # Expose the port (Hugging Face expects 7860)
 
 
 
18
  EXPOSE 7860
19
 
20
- # Run the FastAPI app
21
- CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
+ # Use TensorFlow GPU image
2
+ FROM tensorflow/tensorflow:2.10.0-gpu
3
 
4
+ # Manually install TensorFlow CPU version
5
+ RUN pip install --no-cache-dir tensorflow==2.10.0
6
+
7
+ # Set working directory
8
  WORKDIR /app
9
 
10
+ # Ensure /tmp is writable
11
+ RUN chmod -R 777 /tmp
12
+
13
+ # Copy requirements and install
14
  COPY requirements.txt .
15
  RUN pip install --no-cache-dir -r requirements.txt
16
 
17
+ # Copy app source
 
 
 
18
  COPY app/ ./app/
19
 
20
+ # Ensure app directory is readable
21
+ RUN chmod -R 755 /app
22
+
23
+ # Expose port (Hugging Face Spaces expects 7860)
24
  EXPOSE 7860
25
 
26
+ # Run FastAPI app
27
+ CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]