S-Vetrivel commited on
Commit
1f25e74
·
1 Parent(s): 5516b13

Configure Dockerfile for Hugging Face Spaces

Browse files
Files changed (1) hide show
  1. Dockerfile +14 -13
Dockerfile CHANGED
@@ -1,28 +1,29 @@
1
  # Use official Python image
2
  FROM python:3.11-slim
3
 
4
- # Install system dependencies (ffmpeg is required for audio processing)
5
  RUN apt-get update && apt-get install -y \
6
  ffmpeg \
7
  libsndfile1 \
8
  && rm -rf /var/lib/apt/lists/*
9
 
10
- # Set working directory
11
- WORKDIR /code
 
 
12
 
13
- # Copy requirements and install
14
- COPY requirements.txt .
15
- RUN pip install --no-cache-dir -r requirements.txt
16
 
17
- # Copy the application code
18
- COPY ./app ./app
 
19
 
20
- # Create a dummy model folder if needed (though we download from HF via code)
21
- RUN mkdir -p /code/model
22
 
23
- # Set environment variables
24
- # HF Spaces uses port 7860 by default
25
  ENV PORT=7860
 
26
 
27
- # Command to run the API
28
  CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
  # Use official Python image
2
  FROM python:3.11-slim
3
 
4
+ # Install system dependencies
5
  RUN apt-get update && apt-get install -y \
6
  ffmpeg \
7
  libsndfile1 \
8
  && rm -rf /var/lib/apt/lists/*
9
 
10
+ # Setup user for Hugging Face (Required ID 1000)
11
+ RUN useradd -m -u 1000 user
12
+ USER user
13
+ ENV PATH="/home/user/.local/bin:$PATH"
14
 
15
+ WORKDIR /app
 
 
16
 
17
+ # Copy and install requirements
18
+ COPY --chown=user requirements.txt .
19
+ RUN pip install --no-cache-dir -r requirements.txt
20
 
21
+ # Copy application code
22
+ COPY --chown=user ./app ./app
23
 
24
+ # Set port
 
25
  ENV PORT=7860
26
+ EXPOSE 7860
27
 
28
+ # Command to run API
29
  CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]