Update Dockerfile
Browse files- Dockerfile +28 -16
Dockerfile
CHANGED
@@ -1,16 +1,28 @@
|
|
1 |
-
# Use
|
2 |
-
FROM
|
3 |
-
|
4 |
-
#
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
#
|
15 |
-
|
16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Use an appropriate base image
|
2 |
+
FROM python:3.9
|
3 |
+
|
4 |
+
# Create a user with specific permissions
|
5 |
+
RUN useradd -m -u 1000 user
|
6 |
+
|
7 |
+
# Set working directory
|
8 |
+
WORKDIR /app
|
9 |
+
|
10 |
+
# Copy requirements and install dependencies
|
11 |
+
COPY --chown=user ./requirements.txt requirements.txt
|
12 |
+
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
13 |
+
|
14 |
+
# Copy all project files
|
15 |
+
COPY --chown=user . /app
|
16 |
+
|
17 |
+
# Switch to non-root user
|
18 |
+
USER user
|
19 |
+
|
20 |
+
# Set environment variables
|
21 |
+
ENV HOME=/home/user \
|
22 |
+
PATH=/home/user/.local/bin:$PATH
|
23 |
+
|
24 |
+
# Expose the default Hugging Face Spaces port
|
25 |
+
EXPOSE 7860
|
26 |
+
|
27 |
+
# Default command to run the application
|
28 |
+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|