Spaces:
Running
Running
Update Dockerfile
Browse files- Dockerfile +13 -3
Dockerfile
CHANGED
@@ -4,6 +4,13 @@ FROM python:3.11-slim
|
|
4 |
# Set working directory inside the container
|
5 |
WORKDIR /app
|
6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
# Copy requirements.txt to the working directory
|
8 |
COPY requirements.txt .
|
9 |
|
@@ -20,10 +27,13 @@ RUN pip install --no-cache-dir -r requirements.txt
|
|
20 |
# Copy the entire application code and datasets to the container
|
21 |
COPY . .
|
22 |
|
23 |
-
#
|
24 |
-
|
|
|
|
|
|
|
25 |
|
26 |
-
# Expose the port your Flask app will run on
|
27 |
EXPOSE 7860
|
28 |
|
29 |
# Command to run the Flask app
|
|
|
4 |
# Set working directory inside the container
|
5 |
WORKDIR /app
|
6 |
|
7 |
+
# Create a non-root user to match Hugging Face Spaces' setup
|
8 |
+
# UID 1000 is commonly used in Spaces, but this may vary
|
9 |
+
RUN useradd -m -u 1000 appuser
|
10 |
+
|
11 |
+
# Create the saved_models directory and set ownership to appuser
|
12 |
+
RUN mkdir -p /app/saved_models && chown -R appuser:appuser /app
|
13 |
+
|
14 |
# Copy requirements.txt to the working directory
|
15 |
COPY requirements.txt .
|
16 |
|
|
|
27 |
# Copy the entire application code and datasets to the container
|
28 |
COPY . .
|
29 |
|
30 |
+
# Set ownership of all files to appuser
|
31 |
+
RUN chown -R appuser:appuser /app
|
32 |
+
|
33 |
+
# Switch to the non-root user
|
34 |
+
USER appuser
|
35 |
|
36 |
+
# Expose the port your Flask app will run on (7860 as specified in app.py)
|
37 |
EXPOSE 7860
|
38 |
|
39 |
# Command to run the Flask app
|