parthraninga commited on
Commit
9849f83
·
verified ·
1 Parent(s): ad9d5c0

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +58 -20
Dockerfile CHANGED
@@ -8,17 +8,59 @@ WORKDIR /code
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,27 +70,23 @@ COPY requirements.txt .
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"]
 
8
  ENV DEBIAN_FRONTEND=noninteractive
9
 
10
  # Install system-level dependencies:
11
+ # Core build tools
12
+ # - build-essential: C compiler (gcc) and build tools for Python packages
13
+ # - gcc: GNU Compiler Collection
14
+ # - g++: C++ compiler
15
+ # - make: Build automation tool
16
+ # - pkg-config: Package configuration tool
17
+ # Media and graphics
18
+ # - ffmpeg: Required by manim for video processing
19
+ # - libcairo2-dev: Cairo graphics library development files
20
+ # - libgirepository1.0-dev: GObject introspection development files
21
+ # - libpango1.0-dev: Pango text rendering library
22
+ # - libgdk-pixbuf2.0-dev: Image loading library
23
+ # - libatk1.0-dev: Accessibility toolkit
24
+ # - libgtk-3-dev: GTK+ 3 development files
25
+ # LaTeX and fonts
26
+ # - texlive-latex-base: Basic LaTeX for math rendering
27
+ # - texlive-latex-extra: Additional LaTeX packages
28
+ # - texlive-fonts-recommended: Additional fonts
29
+ # - texlive-fonts-extra: Extra fonts for better rendering
30
+ # - cm-super: Computer Modern fonts
31
+ # - dvipng: DVI to PNG converter for LaTeX
32
+ # Development tools
33
+ # - python3-dev: Python development headers
34
+ # - python3-pip: Python package installer
35
+ # - git: Version control (good practice)
36
+ # - curl: HTTP client
37
+ # - wget: File downloader
38
+ # - unzip: Archive extraction
39
  RUN apt-get update && apt-get install -y --no-install-recommends \
40
+ build-essential \
41
+ gcc \
42
+ g++ \
43
+ make \
44
+ pkg-config \
45
  ffmpeg \
46
+ libcairo2-dev \
47
+ libgirepository1.0-dev \
48
+ libpango1.0-dev \
49
+ libgdk-pixbuf2.0-dev \
50
+ libatk1.0-dev \
51
+ libgtk-3-dev \
52
  texlive-latex-base \
53
+ texlive-latex-extra \
54
  texlive-fonts-recommended \
55
+ texlive-fonts-extra \
56
  cm-super \
57
+ dvipng \
58
+ python3-dev \
59
+ python3-pip \
60
+ git \
61
+ curl \
62
+ wget \
63
+ unzip \
64
  && apt-get clean \
65
  && rm -rf /var/lib/apt/lists/*
66
 
 
70
  # Install Python packages specified in requirements.txt
71
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
72
 
 
 
 
 
 
 
73
  # Set the user to avoid permission issues (recommended for Hugging Face)
74
  RUN useradd -m -u 1000 user
75
+
76
+ # Create media directories with proper permissions before switching user
77
+ RUN mkdir -p /code/media /code/tmp_media && \
78
+ chown -R user:user /code
79
+
80
+ # Switch to the user
81
  USER user
82
  ENV HOME=/home/user \
83
  PATH=/home/user/.local/bin:$PATH
84
 
85
+ # Copy application files with proper ownership
86
+ COPY --chown=user . .
 
 
 
87
 
88
+ # Expose the port Gradio runs on (7860)
89
+ EXPOSE 7860
 
90
 
91
  # The command to run when the container starts: launch the Gradio app
92
  CMD ["python", "app.py"]