Hammad712 commited on
Commit
d714b61
·
verified ·
1 Parent(s): a793b14

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +13 -17
Dockerfile CHANGED
@@ -1,25 +1,21 @@
1
- # Base image using Python 3.9
2
- FROM python:3.9
3
 
4
- # Create a new user to run the app
5
- RUN useradd -m -u 1000 user
6
- USER user
7
 
8
- # Set environment variables
9
- ENV PATH="/home/user/.local/bin:$PATH"
10
-
11
- # Set the working directory
12
  WORKDIR /app
13
 
14
- # Copy the requirements and install dependencies
15
- COPY --chown=user ./requirements.txt requirements.txt
16
- RUN pip install --no-cache-dir --upgrade -r requirements.txt
17
 
18
- # Copy the rest of the application
19
- COPY --chown=user . /app
20
 
21
- # Expose port 7860 for the application
22
  EXPOSE 7860
23
 
24
- # Command to run the FastAPI app using uvicorn
25
- CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
+ # Use an official Python runtime as a parent image.
2
+ FROM python:3.10-slim
3
 
4
+ # Install system dependencies (poppler-utils is required by pdf2image).
5
+ RUN apt-get update && apt-get install -y poppler-utils && rm -rf /var/lib/apt/lists/*
 
6
 
7
+ # Set the working directory.
 
 
 
8
  WORKDIR /app
9
 
10
+ # Copy requirements and install Python dependencies.
11
+ COPY requirements.txt .
12
+ RUN pip install --upgrade pip && pip install -r requirements.txt
13
 
14
+ # Copy the application code.
15
+ COPY main.py .
16
 
17
+ # Expose the port FastAPI will run on.
18
  EXPOSE 7860
19
 
20
+ # Command to run the FastAPI app using uvicorn via the module interface.
21
+ CMD ["python", "-m", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]