Spaces:
Running
Running
Update Dockerfile
Browse files- Dockerfile +18 -2
Dockerfile
CHANGED
@@ -1,13 +1,29 @@
|
|
1 |
-
|
|
|
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Use an official Python runtime as a parent image
|
2 |
+
FROM python:3.9.13
|
3 |
|
4 |
+
# Create a new user with a specific UID and home directory
|
5 |
RUN useradd -m -u 1000 user
|
6 |
+
|
7 |
+
# Set the user for subsequent instructions
|
8 |
USER user
|
9 |
+
|
10 |
+
# Update the PATH environment variable
|
11 |
ENV PATH="/home/user/.local/bin:$PATH"
|
12 |
|
13 |
+
# Set the working directory
|
14 |
WORKDIR /app
|
15 |
|
16 |
+
# Copy the requirements file into the container
|
17 |
COPY --chown=user ./requirements.txt requirements.txt
|
18 |
+
|
19 |
+
# Install any needed packages specified in requirements.txt
|
20 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
21 |
|
22 |
+
# Copy the current directory contents into the container at /app
|
23 |
COPY --chown=user . /app
|
24 |
+
|
25 |
+
# Make sure uvicorn is installed and available in the PATH
|
26 |
+
RUN pip install --user uvicorn
|
27 |
+
|
28 |
+
# Command to run the application using Uvicorn
|
29 |
+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|