Spaces:
Sleeping
Sleeping
Ammar-Abdelhady-ai
commited on
Commit
•
aeec554
1
Parent(s):
b244901
- Dockerfile +16 -11
Dockerfile
CHANGED
@@ -1,20 +1,25 @@
|
|
1 |
FROM python:3.9
|
2 |
|
3 |
-
|
|
|
|
|
4 |
|
5 |
-
|
|
|
6 |
|
7 |
-
|
|
|
8 |
|
9 |
-
|
|
|
|
|
10 |
|
11 |
-
|
|
|
12 |
|
|
|
13 |
ENV HOME=/home/user \
|
14 |
-
|
15 |
-
|
16 |
-
WORKDIR $HOME/app
|
17 |
-
|
18 |
-
COPY --chown=user . $HOME/app
|
19 |
|
20 |
-
|
|
|
|
1 |
FROM python:3.9
|
2 |
|
3 |
+
# Set up non-root user
|
4 |
+
RUN useradd -m -u 1000 user
|
5 |
+
USER user
|
6 |
|
7 |
+
# Set working directory
|
8 |
+
WORKDIR /home/user/app
|
9 |
|
10 |
+
# Install system dependencies (if any)
|
11 |
+
# RUN apt-get update && apt-get install -y ...
|
12 |
|
13 |
+
# Install Python dependencies
|
14 |
+
COPY ./requirements.txt /home/user/app/requirements.txt
|
15 |
+
RUN pip install --no-cache-dir --upgrade -r /home/user/app/requirements.txt
|
16 |
|
17 |
+
# Copy only necessary files
|
18 |
+
COPY --chown=user . /home/user/app
|
19 |
|
20 |
+
# Set environment variables
|
21 |
ENV HOME=/home/user \
|
22 |
+
PATH=/home/user/.local/bin:$PATH
|
|
|
|
|
|
|
|
|
23 |
|
24 |
+
# Command to run the application
|
25 |
+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|