Spaces:
Running
Running
Update Dockerfile
Browse files- Dockerfile +13 -4
Dockerfile
CHANGED
@@ -10,10 +10,19 @@ COPY . /app
|
|
10 |
# Install any needed packages specified in requirements.txt
|
11 |
RUN pip install --no-cache-dir -r requirements.txt
|
12 |
|
13 |
-
#
|
|
|
14 |
|
15 |
-
#
|
16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
|
18 |
# Start the FastAPI app on port 7860, the default port expected by Spaces
|
19 |
-
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
10 |
# Install any needed packages specified in requirements.txt
|
11 |
RUN pip install --no-cache-dir -r requirements.txt
|
12 |
|
13 |
+
# Create a non-root user
|
14 |
+
RUN useradd -m appuser
|
15 |
|
16 |
+
# Create necessary directories and set permissions
|
17 |
+
RUN mkdir -p /app/data && \
|
18 |
+
chown -R appuser:appuser /app && \
|
19 |
+
chmod -R 755 /app && \
|
20 |
+
mkdir -p /tmp/app-work && \
|
21 |
+
chown -R appuser:appuser /tmp/app-work && \
|
22 |
+
chmod -R 777 /tmp/app-work
|
23 |
+
|
24 |
+
# Switch to the non-root user
|
25 |
+
USER appuser
|
26 |
|
27 |
# Start the FastAPI app on port 7860, the default port expected by Spaces
|
28 |
+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|