Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +1 -14
Dockerfile
CHANGED
@@ -1,40 +1,27 @@
|
|
1 |
-
# Use an official Python runtime as the base image
|
2 |
FROM python:3.11-slim
|
3 |
|
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 |
|
17 |
-
# Install system dependencies (for faiss, torch, etc.)
|
18 |
RUN apt-get update && apt-get install -y \
|
19 |
build-essential \
|
20 |
libatlas-base-dev \
|
21 |
gfortran \
|
|
|
22 |
&& rm -rf /var/lib/apt/lists/*
|
23 |
|
24 |
-
# Install Python dependencies
|
25 |
RUN pip install --no-cache-dir -r requirements.txt
|
26 |
|
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
|
40 |
CMD ["python", "app.py"]
|
|
|
|
|
1 |
FROM python:3.11-slim
|
2 |
|
|
|
3 |
WORKDIR /app
|
4 |
|
|
|
|
|
5 |
RUN useradd -m -u 1000 appuser
|
|
|
|
|
6 |
RUN mkdir -p /app/saved_models && chown -R appuser:appuser /app
|
7 |
|
|
|
8 |
COPY requirements.txt .
|
9 |
|
|
|
10 |
RUN apt-get update && apt-get install -y \
|
11 |
build-essential \
|
12 |
libatlas-base-dev \
|
13 |
gfortran \
|
14 |
+
swig \
|
15 |
&& rm -rf /var/lib/apt/lists/*
|
16 |
|
|
|
17 |
RUN pip install --no-cache-dir -r requirements.txt
|
18 |
|
|
|
19 |
COPY . .
|
20 |
|
|
|
21 |
RUN chown -R appuser:appuser /app
|
22 |
|
|
|
23 |
USER appuser
|
24 |
|
|
|
25 |
EXPOSE 7860
|
26 |
|
|
|
27 |
CMD ["python", "app.py"]
|