Updated Docker file
Browse files- Dockerfile +18 -10
Dockerfile
CHANGED
@@ -1,17 +1,25 @@
|
|
1 |
-
# Use
|
2 |
-
FROM python:3.9
|
|
|
|
|
|
|
3 |
|
4 |
# Set the working directory
|
5 |
WORKDIR /app
|
6 |
|
7 |
-
# Copy the
|
8 |
-
COPY . /app
|
|
|
|
|
|
|
|
|
|
|
9 |
|
10 |
-
#
|
11 |
-
|
12 |
|
13 |
-
#
|
14 |
-
|
15 |
|
16 |
-
# Run the
|
17 |
-
CMD ["uvicorn", "
|
|
|
1 |
+
# Use Python 3.9 image as the base
|
2 |
+
FROM python:3.9
|
3 |
+
|
4 |
+
# Create a non-root user
|
5 |
+
RUN useradd -m -u 1000 user
|
6 |
|
7 |
# Set the working directory
|
8 |
WORKDIR /app
|
9 |
|
10 |
+
# Copy the requirements file and install dependencies
|
11 |
+
COPY requirements.txt /app/
|
12 |
+
RUN pip install --upgrade pip
|
13 |
+
RUN pip install --no-cache-dir -r /app/requirements.txt
|
14 |
+
|
15 |
+
# Copy the entire application code into the working directory
|
16 |
+
COPY . /app/
|
17 |
|
18 |
+
# Expose the port that Uvicorn will use
|
19 |
+
EXPOSE 8000
|
20 |
|
21 |
+
# Switch to the non-root user
|
22 |
+
USER user
|
23 |
|
24 |
+
# Run the main program with Uvicorn (adjust path to match your actual app structure)
|
25 |
+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
|