Genzo1010 commited on
Commit
7c6d7d8
·
verified ·
1 Parent(s): 5901499

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +23 -14
Dockerfile CHANGED
@@ -1,20 +1,29 @@
1
- # Use the official Python image as a base image
2
- FROM python:3.9
3
 
4
- # Set the working directory in the container
5
- WORKDIR /app
6
 
7
- # Copy the requirements file to the container
8
- COPY requirements.txt .
9
 
10
- # Install any necessary dependencies
11
- RUN pip install --no-cache-dir -r requirements.txt
12
 
13
- # Copy the rest of the application code to the container
14
- COPY . .
 
 
 
 
 
 
15
 
16
- # Expose the port that the FastAPI app will run on
17
- EXPOSE 8000
 
 
 
18
 
19
- # Command to run the FastAPI app using Uvicorn
20
- CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]
 
1
+ # Use Python 3.10 for compatibility with newer packages
2
+ FROM python:3.10
3
 
4
+ # Set up a working directory
5
+ WORKDIR /code
6
 
7
+ # Expose port 80
8
+ EXPOSE 80
9
 
10
+ # Install OpenCV and poppler-utils dependencies
11
+ RUN apt-get update && apt-get install -y libgl1-mesa-glx libglib2.0-0 libsm6 poppler-utils
12
 
13
+ # Copy just the requirements file into the working directory
14
+ COPY ./requirements.txt /code/requirements.txt
15
+
16
+ # Install dependencies from the requirements file
17
+ RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
18
+
19
+ # Install PyTorch or TensorFlow
20
+ RUN pip install torch torchvision
21
 
22
+ # Set environment variable to indicate PyTorch usage
23
+ ENV USE_TORCH=1
24
+
25
+ # Copy the rest of the application code into the working directory
26
+ COPY . .
27
 
28
+ # Set the entry point to run the FastAPI app with uvicorn
29
+ CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "80"]