Update Dockerfile
Browse files- Dockerfile +19 -5
Dockerfile
CHANGED
@@ -1,16 +1,30 @@
|
|
|
|
1 |
FROM python:3.10-slim
|
2 |
|
3 |
-
#
|
4 |
-
|
|
|
5 |
|
|
|
6 |
WORKDIR /app
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
COPY requirements.txt .
|
8 |
|
9 |
-
|
10 |
RUN pip install --no-cache-dir -r requirements.txt
|
11 |
|
|
|
12 |
COPY . .
|
13 |
|
14 |
-
|
|
|
15 |
|
16 |
-
|
|
|
|
1 |
+
# Use an official lightweight 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 \
|
13 |
+
gcc \
|
14 |
+
libmagic-dev \
|
15 |
+
&& rm -rf /var/lib/apt/lists/*
|
16 |
+
|
17 |
+
# Copy requirements first and install
|
18 |
COPY requirements.txt .
|
19 |
|
20 |
+
RUN pip install --upgrade pip
|
21 |
RUN pip install --no-cache-dir -r requirements.txt
|
22 |
|
23 |
+
# Copy the rest of the application
|
24 |
COPY . .
|
25 |
|
26 |
+
# Expose port
|
27 |
+
EXPOSE 8000
|
28 |
|
29 |
+
# Command to run the app
|
30 |
+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000", "--timeout-keep-alive", "300"]
|