Spaces:
Running
Running
dock
Browse files- Dockerfile +16 -4
Dockerfile
CHANGED
@@ -1,22 +1,34 @@
|
|
1 |
FROM python:3.10-slim
|
|
|
|
|
2 |
RUN apt update && apt install -y \
|
3 |
git \
|
4 |
libgl1 \
|
5 |
libglib2.0-0 \
|
6 |
&& apt clean
|
|
|
|
|
7 |
WORKDIR /app
|
8 |
|
9 |
-
# Install dependencies
|
10 |
COPY requirements.txt .
|
11 |
RUN pip install --no-cache-dir -r requirements.txt
|
12 |
|
13 |
# Copy the entire project directory
|
14 |
COPY . .
|
15 |
|
16 |
-
# Create tmp
|
17 |
-
RUN mkdir -p /app/tmp
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
|
19 |
-
# Expose the port Hugging Face Spaces
|
20 |
EXPOSE 7860
|
21 |
|
22 |
# Start the FastAPI app
|
|
|
1 |
FROM python:3.10-slim
|
2 |
+
|
3 |
+
# Install required system packages
|
4 |
RUN apt update && apt install -y \
|
5 |
git \
|
6 |
libgl1 \
|
7 |
libglib2.0-0 \
|
8 |
&& apt clean
|
9 |
+
|
10 |
+
# Set working directory
|
11 |
WORKDIR /app
|
12 |
|
13 |
+
# Install Python dependencies
|
14 |
COPY requirements.txt .
|
15 |
RUN pip install --no-cache-dir -r requirements.txt
|
16 |
|
17 |
# Copy the entire project directory
|
18 |
COPY . .
|
19 |
|
20 |
+
# Create tmp and output directories with full permissions
|
21 |
+
RUN mkdir -p /app/tmp /app/output && \
|
22 |
+
chmod 777 /app/tmp /app/output
|
23 |
+
|
24 |
+
# Create a non-root user and set ownership
|
25 |
+
RUN useradd -m -u 1000 appuser && \
|
26 |
+
chown -R appuser:appuser /app
|
27 |
+
|
28 |
+
# Switch to non-root user
|
29 |
+
USER appuser
|
30 |
|
31 |
+
# Expose the port for FastAPI (Hugging Face Spaces)
|
32 |
EXPOSE 7860
|
33 |
|
34 |
# Start the FastAPI app
|