navpan2 commited on
Commit
82b01f1
·
verified ·
1 Parent(s): ebf86ab

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -6
Dockerfile CHANGED
@@ -1,17 +1,22 @@
1
- # Use the official Python image as a base
2
  FROM python:3.12
3
 
4
- # Set the working directory
5
  WORKDIR /app
6
 
7
- # Install the required packages
8
  RUN pip install tensorflow==2.16.2 fastapi uvicorn requests pillow python-multipart
9
 
 
 
 
10
  # Copy the FastAPI application code into the container
11
  COPY . .
12
 
13
- # Expose the required port for FastAPI (you may choose any available port, e.g., 7860 for compatibility with Hugging Face Spaces)
 
 
 
14
  EXPOSE 7860
15
 
16
- # Run the FastAPI application with uvicorn
17
- CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
 
 
1
  FROM python:3.12
2
 
3
+ # Set a working directory inside the container
4
  WORKDIR /app
5
 
6
+ # Install required packages
7
  RUN pip install tensorflow==2.16.2 fastapi uvicorn requests pillow python-multipart
8
 
9
+ # Ensure the application has a writable temp directory
10
+ RUN mkdir -p /app/temp && chmod 777 /app/temp
11
+
12
  # Copy the FastAPI application code into the container
13
  COPY . .
14
 
15
+ # Set environment variable for temporary files
16
+ ENV TMP_DIR=/app/temp
17
+
18
+ # Expose port for FastAPI
19
  EXPOSE 7860
20
 
21
+ # Run the FastAPI application
22
+ CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]