Spaces:
Paused
Paused
Update dockerfile
Browse files- dockerfile +19 -22
dockerfile
CHANGED
@@ -1,22 +1,19 @@
|
|
1 |
-
# Use the
|
2 |
-
FROM python:3.9
|
3 |
-
|
4 |
-
#
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
#
|
16 |
-
|
17 |
-
|
18 |
-
# Expose
|
19 |
-
|
20 |
-
|
21 |
-
# Run the FastAPI app
|
22 |
-
CMD ["python", "app.py"]
|
|
|
1 |
+
# Use the Python 3.9 base image
|
2 |
+
FROM python:3.9
|
3 |
+
|
4 |
+
# Create a non-root user
|
5 |
+
RUN useradd -m -u 1000 user
|
6 |
+
USER user
|
7 |
+
ENV PATH="/home/user/.local/bin:$PATH"
|
8 |
+
|
9 |
+
WORKDIR /app
|
10 |
+
|
11 |
+
# Install Python dependencies
|
12 |
+
COPY --chown=user ./requirements.txt requirements.txt
|
13 |
+
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
14 |
+
|
15 |
+
# Copy the application files
|
16 |
+
COPY --chown=user . /app
|
17 |
+
|
18 |
+
# Expose the app on port 7860
|
19 |
+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
|
|