Update Dockerfile
Browse files- Dockerfile +22 -3
Dockerfile
CHANGED
@@ -1,11 +1,30 @@
|
|
1 |
-
|
|
|
2 |
|
|
|
|
|
|
|
|
|
|
|
3 |
WORKDIR /app
|
4 |
|
5 |
-
|
|
|
6 |
|
|
|
|
|
|
|
7 |
RUN pip install --no-cache-dir -r requirements.txt
|
8 |
|
|
|
9 |
COPY . .
|
10 |
|
11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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"]
|