Niansuh commited on
Commit
df10589
·
verified ·
1 Parent(s): a932354

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +16 -14
Dockerfile CHANGED
@@ -1,24 +1,26 @@
1
- # Step 1: Use an official Python image as a base
2
  FROM python:3.11-slim
3
 
4
- # Step 2: Set the working directory in the container
 
 
 
 
5
  WORKDIR /app
6
 
7
- # Step 3: Copy the requirements.txt file to the working directory
8
- COPY requirements.txt /app/
9
 
10
- # Step 4: Install dependencies
 
 
11
  RUN pip install --no-cache-dir -r requirements.txt
12
 
13
- # Step 5: Copy the rest of the application code
14
- COPY . /app/
15
 
16
- # Step 6: Expose the port the app will run on
17
  EXPOSE 7860
18
 
19
- # Step 7: Set environment variable (if you need .env file handling)
20
- # You can optionally copy the .env file if you're using it for environment variables
21
- # COPY .env /app/
22
-
23
- # Step 8: Run the application using uvicorn (FastAPI)
24
- CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
+ # Use the official Python image from the Docker Hub
2
  FROM python:3.11-slim
3
 
4
+ # Set environment variables
5
+ ENV PYTHONDONTWRITEBYTECODE=1
6
+ ENV PYTHONUNBUFFERED=1
7
+
8
+ # Set work directory
9
  WORKDIR /app
10
 
11
+ # Install system dependencies
12
+ RUN apt-get update && apt-get install -y build-essential && rm -rf /var/lib/apt/lists/*
13
 
14
+ # Install Python dependencies
15
+ COPY requirements.txt .
16
+ RUN pip install --upgrade pip
17
  RUN pip install --no-cache-dir -r requirements.txt
18
 
19
+ # Copy the application code
20
+ COPY . .
21
 
22
+ # Expose the port that the app runs on
23
  EXPOSE 7860
24
 
25
+ # Define the default command to run the app
26
+ CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]