MisbahKhan commited on
Commit
526d490
·
verified ·
1 Parent(s): cea3165

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +9 -3
Dockerfile CHANGED
@@ -1,12 +1,18 @@
1
  # Use an official Python runtime as the base image
2
- FROM python:3.9
3
 
4
- # Create a user to avoid running as root (Hugging Face Spaces recommendation)
5
  RUN useradd -m -u 1000 user
6
  USER user
7
  WORKDIR /app
8
  ENV PATH="/home/user/.local/bin:$PATH"
9
 
 
 
 
 
 
 
10
  # Copy requirements.txt and install dependencies
11
  COPY --chown=user ./requirements.txt requirements.txt
12
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
@@ -14,7 +20,7 @@ RUN pip install --no-cache-dir --upgrade -r requirements.txt
14
  # Copy the rest of the application files
15
  COPY --chown=user . /app
16
 
17
- # Expose the port FastAPI will run on (Hugging Face Spaces default is 7860)
18
  EXPOSE 7860
19
 
20
  # Command to run the FastAPI app with Uvicorn
 
1
  # Use an official Python runtime as the base image
2
+ FROM python:3.9-slim
3
 
4
+ # Create a non-root user (Hugging Face Spaces requirement)
5
  RUN useradd -m -u 1000 user
6
  USER user
7
  WORKDIR /app
8
  ENV PATH="/home/user/.local/bin:$PATH"
9
 
10
+ # Install system dependencies (needed for decord and other libraries)
11
+ RUN apt-get update && apt-get install -y \
12
+ libavformat-dev libavcodec-dev libavdevice-dev libavutil-dev \
13
+ libswscale-dev libswresample-dev libavfilter-dev \
14
+ && rm -rf /var/lib/apt/lists/*
15
+
16
  # Copy requirements.txt and install dependencies
17
  COPY --chown=user ./requirements.txt requirements.txt
18
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
 
20
  # Copy the rest of the application files
21
  COPY --chown=user . /app
22
 
23
+ # Expose the port (Hugging Face Spaces default is 7860)
24
  EXPOSE 7860
25
 
26
  # Command to run the FastAPI app with Uvicorn