ygauravyy commited on
Commit
31a6364
1 Parent(s): 0f80afc

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +27 -7
Dockerfile CHANGED
@@ -1,16 +1,36 @@
1
- # Read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
2
- # you will also find guides on how best to write your Dockerfile
3
 
4
- FROM python:3.9
 
 
 
5
 
 
6
  RUN useradd -m -u 1000 user
7
  USER user
8
  ENV PATH="/home/user/.local/bin:$PATH"
9
 
10
  WORKDIR /app
11
 
12
- COPY --chown=user ./requirements.txt requirements.txt
13
- RUN pip install --no-cache-dir --upgrade -r requirements.txt
 
 
 
 
14
 
15
- COPY --chown=user . /app
16
- CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.9-slim
 
2
 
3
+ # Set environment variables
4
+ ENV PYTHONDONTWRITEBYTECODE=1
5
+ ENV PYTHONUNBUFFERED=1
6
+ ENV PORT=7860
7
 
8
+ # Create a non-root user
9
  RUN useradd -m -u 1000 user
10
  USER user
11
  ENV PATH="/home/user/.local/bin:$PATH"
12
 
13
  WORKDIR /app
14
 
15
+ # Install system dependencies
16
+ RUN apt-get update && apt-get install -y \
17
+ build-essential \
18
+ libsndfile1 \
19
+ ffmpeg \
20
+ && rm -rf /var/lib/apt/lists/*
21
 
22
+ # Copy requirements and install Python dependencies
23
+ COPY --chown=user:users requirements.txt /app/requirements.txt
24
+ RUN pip install --no-cache-dir --upgrade pip && pip install --no-cache-dir -r requirements.txt
25
+
26
+ # Copy the rest of the project files
27
+ COPY --chown=user:users . /app
28
+
29
+ # Ensure outputs and temp directories exist
30
+ RUN mkdir -p outputs temp
31
+
32
+ # Expose port 7860
33
+ EXPOSE 7860
34
+
35
+ # Run the application
36
+ CMD ["python", "app.py"]