Update Dockerfile
Browse files- Dockerfile +16 -14
Dockerfile
CHANGED
@@ -1,24 +1,26 @@
|
|
1 |
-
#
|
2 |
FROM python:3.11-slim
|
3 |
|
4 |
-
#
|
|
|
|
|
|
|
|
|
5 |
WORKDIR /app
|
6 |
|
7 |
-
#
|
8 |
-
|
9 |
|
10 |
-
#
|
|
|
|
|
11 |
RUN pip install --no-cache-dir -r requirements.txt
|
12 |
|
13 |
-
#
|
14 |
-
COPY .
|
15 |
|
16 |
-
#
|
17 |
EXPOSE 7860
|
18 |
|
19 |
-
#
|
20 |
-
|
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"]
|
|
|
|
|
|
|
|