mgokg commited on
Commit
11c5c8b
·
verified ·
1 Parent(s): 5fc9c4e

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +35 -0
Dockerfile ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use a lightweight Python image with CUDA support if possible
2
+ # For HF Spaces, a standard Python image is often sufficient as they provide the drivers
3
+ FROM python:3.10-slim
4
+
5
+ # Set environment variables
6
+ ENV PYTHONUNBUFFERED=1 \
7
+ PORT=7860
8
+
9
+ # Install system dependencies for audio and building packages
10
+ RUN apt-get update && apt-get install -y \
11
+ ffmpeg \
12
+ libsndfile1 \
13
+ git \
14
+ && rm -rf /var/lib/apt/lists/*
15
+
16
+ # Create a non-root user (Hugging Face requirement for security)
17
+ RUN useradd -m -u 1000 user
18
+ USER user
19
+ ENV HOME=/home/user \
20
+ PATH=/home/user/.local/bin:$PATH
21
+
22
+ WORKDIR $HOME/app
23
+
24
+ # Copy requirements and install
25
+ COPY --chown=user requirements.txt .
26
+ RUN pip install --no-cache-dir -r requirements.txt
27
+
28
+ # Copy the rest of the application
29
+ COPY --chown=user . .
30
+
31
+ # Expose the HF default port
32
+ EXPOSE 7860
33
+
34
+ # Run the application
35
+ CMD ["python", "app.py"]