Spaces:
Paused
Paused
Update Dockerfile
Browse files- Dockerfile +6 -3
Dockerfile
CHANGED
@@ -3,15 +3,18 @@ FROM python:3.9
|
|
3 |
|
4 |
# Create a non-root user
|
5 |
RUN useradd -u 1000 user
|
6 |
-
USER user
|
7 |
ENV PATH="/home/user/.local/bin:$PATH"
|
8 |
|
9 |
# Set the working directory inside the container
|
10 |
WORKDIR /app
|
11 |
|
12 |
-
# Copy the dependencies and install them
|
13 |
-
COPY
|
14 |
RUN pip install --no-cache-dir -r requirements.txt
|
15 |
|
|
|
|
|
|
|
|
|
16 |
# Run the FastAPI app with Uvicorn
|
17 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
3 |
|
4 |
# Create a non-root user
|
5 |
RUN useradd -u 1000 user
|
|
|
6 |
ENV PATH="/home/user/.local/bin:$PATH"
|
7 |
|
8 |
# Set the working directory inside the container
|
9 |
WORKDIR /app
|
10 |
|
11 |
+
# Copy the dependencies and install them as root
|
12 |
+
COPY requirements.txt .
|
13 |
RUN pip install --no-cache-dir -r requirements.txt
|
14 |
|
15 |
+
# Switch to the non-root user after installing dependencies
|
16 |
+
USER user
|
17 |
+
COPY . .
|
18 |
+
|
19 |
# Run the FastAPI app with Uvicorn
|
20 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|