parthraninga commited on
Commit
ad9d5c0
·
verified ·
1 Parent(s): 41554b8

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +28 -19
Dockerfile CHANGED
@@ -7,25 +7,18 @@ WORKDIR /code
7
  # Set environment variable to prevent interactive prompts during package installation
8
  ENV DEBIAN_FRONTEND=noninteractive
9
 
10
- # Install all potential system-level dependencies for a full Manim installation
11
- # This "kitchen sink" approach helps prevent future build errors.
 
 
 
 
12
  RUN apt-get update && apt-get install -y --no-install-recommends \
13
- # --- Core Build Tools ---
14
- build-essential \
15
- pkg-config \
16
- # --- Manim Dependencies ---
17
  ffmpeg \
18
- texlive-full \
19
- libcairo2-dev \
20
- libpango1.0-dev \
21
- # --- Extra Dependencies for Optional Features (e.g., manim-voiceover) ---
22
- libgl1-mesa-glx \
23
- libglib2.0-0 \
24
- libsm6 \
25
- libxext6 \
26
- libxrender1 \
27
- espeak \
28
- sox \
29
  && apt-get clean \
30
  && rm -rf /var/lib/apt/lists/*
31
 
@@ -35,11 +28,27 @@ COPY requirements.txt .
35
  # Install Python packages specified in requirements.txt
36
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
37
 
38
- # Copy all the application files (app.py, proof.py, etc.) into the container
39
  COPY . .
40
 
41
  # Expose the port Gradio runs on (7860)
42
  EXPOSE 7860
43
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
  # The command to run when the container starts: launch the Gradio app
45
- CMD ["gradio", "app.py"]
 
7
  # Set environment variable to prevent interactive prompts during package installation
8
  ENV DEBIAN_FRONTEND=noninteractive
9
 
10
+ # Install system-level dependencies:
11
+ # - git: for version control (good practice)
12
+ # - ffmpeg: required by manim for video processing
13
+ # - texlive-latex-base: basic LaTeX for math rendering (lighter than texlive-full)
14
+ # - texlive-fonts-recommended: additional fonts
15
+ # - cm-super: fonts for better rendering
16
  RUN apt-get update && apt-get install -y --no-install-recommends \
17
+ git \
 
 
 
18
  ffmpeg \
19
+ texlive-latex-base \
20
+ texlive-fonts-recommended \
21
+ cm-super \
 
 
 
 
 
 
 
 
22
  && apt-get clean \
23
  && rm -rf /var/lib/apt/lists/*
24
 
 
28
  # Install Python packages specified in requirements.txt
29
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
30
 
31
+ # Copy all the application files into the container
32
  COPY . .
33
 
34
  # Expose the port Gradio runs on (7860)
35
  EXPOSE 7860
36
 
37
+ # Set the user to avoid permission issues (recommended for Hugging Face)
38
+ RUN useradd -m -u 1000 user
39
+ USER user
40
+ ENV HOME=/home/user \
41
+ PATH=/home/user/.local/bin:$PATH
42
+
43
+ # Set working directory to user home
44
+ WORKDIR $HOME/app
45
+
46
+ # Copy application files to user directory with proper ownership
47
+ COPY --chown=user . $HOME/app
48
+
49
+ # Create media directories in user space with proper permissions
50
+ RUN mkdir -p $HOME/app/media $HOME/app/tmp_media && \
51
+ chmod 755 $HOME/app/media $HOME/app/tmp_media
52
+
53
  # The command to run when the container starts: launch the Gradio app
54
+ CMD ["python", "app.py"]