Update Dockerfile
Browse files- Dockerfile +25 -12
Dockerfile
CHANGED
@@ -1,20 +1,33 @@
|
|
1 |
-
# Use an official Python runtime as a parent image
|
2 |
FROM python:3.9
|
3 |
|
4 |
-
|
|
|
|
|
|
|
5 |
WORKDIR /app
|
6 |
|
7 |
-
|
8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
|
10 |
-
# Install the dependencies
|
11 |
-
RUN pip install --no-cache-dir -r requirements.txt
|
12 |
|
13 |
-
# Copy the FastAPI app into the container
|
14 |
-
COPY . .
|
15 |
|
16 |
-
# Expose the port the app runs on
|
17 |
-
EXPOSE 8000
|
18 |
|
19 |
-
# Command to run the FastAPI app
|
20 |
-
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000", "--reload"]
|
|
|
|
|
1 |
FROM python:3.9
|
2 |
|
3 |
+
RUN useradd -m -u 1000 user
|
4 |
+
USER user
|
5 |
+
ENV PATH="/home/user/.local/bin:$PATH"
|
6 |
+
|
7 |
WORKDIR /app
|
8 |
|
9 |
+
COPY --chown=user ./requirements.txt requirements.txt
|
10 |
+
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
11 |
+
|
12 |
+
COPY --chown=user . /app
|
13 |
+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
14 |
+
# # Use an official Python runtime as a parent image
|
15 |
+
# FROM python:3.9
|
16 |
+
|
17 |
+
# # Set the working directory in the container
|
18 |
+
# WORKDIR /app
|
19 |
+
|
20 |
+
# # Copy the requirements file into the container
|
21 |
+
# COPY requirements.txt .
|
22 |
|
23 |
+
# # Install the dependencies
|
24 |
+
# RUN pip install --no-cache-dir -r requirements.txt
|
25 |
|
26 |
+
# # Copy the FastAPI app into the container
|
27 |
+
# COPY . .
|
28 |
|
29 |
+
# # Expose the port the app runs on
|
30 |
+
# EXPOSE 8000
|
31 |
|
32 |
+
# # Command to run the FastAPI app
|
33 |
+
# CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000", "--reload"]
|