Fred-Rcky commited on
Commit
77980fd
·
verified ·
1 Parent(s): 4fa0613

Upload Dockerfile with huggingface_hub

Browse files
Files changed (1) hide show
  1. Dockerfile +36 -0
Dockerfile ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use an official lightweight Python image.
2
+ FROM python:3.10-slim
3
+
4
+ # Set environment variables
5
+ ENV PYTHONDONTWRITEBYTECODE=1
6
+ ENV PYTHONUNBUFFERED=1
7
+ ENV HOME=/home/user
8
+ ENV PATH=/home/user/.local/bin:$PATH
9
+
10
+ # Create a non-root user for security (Hugging Face requirement)
11
+ RUN useradd -m -u 1000 user
12
+ USER user
13
+ WORKDIR $HOME/app
14
+
15
+ # Install system dependencies as root
16
+ USER root
17
+ RUN apt-get update && apt-get install -y --no-install-recommends \
18
+ libgl1 \
19
+ libglib2.0-0 \
20
+ ffmpeg \
21
+ && rm -rf /var/lib/apt/lists/*
22
+ USER user
23
+
24
+ # Copy requirements and install dependencies
25
+ COPY --chown=user requirements.txt .
26
+ RUN pip install --no-cache-dir --upgrade pip && \
27
+ pip install --no-cache-dir -r requirements.txt
28
+
29
+ # Copy the rest of the application code
30
+ COPY --chown=user . .
31
+
32
+ # Hugging Face Spaces expects the app to run on port 7860
33
+ EXPOSE 7860
34
+
35
+ # Run the application
36
+ CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]