Niansuh commited on
Commit
99ff4b8
·
verified ·
1 Parent(s): 011db4b

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -20
Dockerfile CHANGED
@@ -1,30 +1,21 @@
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 dependencies
15
  COPY requirements.txt .
16
- RUN pip install --upgrade pip
17
  RUN pip install --no-cache-dir -r requirements.txt
18
 
19
- # Copy project
20
  COPY . .
21
 
22
- # Expose the port Uvicorn will run on
23
- EXPOSE 8001
24
 
25
- # Set environment variables for Uvicorn
26
- ENV HOST=0.0.0.0
27
- ENV PORT=8001
28
 
29
- # Command to run the application
30
- CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8001", "--workers", "4"]
 
1
+ # Use the official FastAPI image with Python 3.9
2
+ FROM tiangolo/uvicorn-gunicorn-fastapi:python3.9
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
+ # Copy the application code
12
  COPY . .
13
 
14
+ # Set environment variables
15
+ ENV APP_SECRET=your_app_secret_here
16
 
17
+ # Expose the port
18
+ EXPOSE 8001
 
19
 
20
+ # Run the application
21
+ CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8001"]