Nhantv commited on
Commit
13f50e7
·
verified ·
1 Parent(s): b9ec1bf

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +15 -7
Dockerfile CHANGED
@@ -1,17 +1,25 @@
1
- FROM python:3.10
 
2
 
3
- # Set working directory
 
 
 
 
4
  WORKDIR /app
5
 
6
- # Copy requirements and install
 
 
 
7
  COPY requirements.txt .
8
  RUN pip install --no-cache-dir -r requirements.txt
9
 
10
- # Copy app files
11
- COPY . .
12
 
13
- # Expose port
14
  EXPOSE 7860
15
 
16
- # Run FastAPI with uvicorn
17
  CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
+ # Use official Python image
2
+ FROM python:3.10-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
13
+
14
+ # Install Python dependencies
15
  COPY requirements.txt .
16
  RUN pip install --no-cache-dir -r requirements.txt
17
 
18
+ # Copy app code
19
+ COPY main.py .
20
 
21
+ # Expose the port FastAPI will run on
22
  EXPOSE 7860
23
 
24
+ # Run the FastAPI app
25
  CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]