thanhkt commited on
Commit
a31ed90
·
verified ·
1 Parent(s): 152d729

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +6 -16
Dockerfile CHANGED
@@ -18,12 +18,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
18
  && rm -rf /var/lib/apt/lists/* \
19
  && which dvisvgm
20
 
21
- # Create a non-root user to run the application
22
- RUN groupadd -r appuser && useradd -r -g appuser -m appuser
23
-
24
  WORKDIR /app
25
 
26
- # Install uv for faster pip operations
27
  ADD https://astral.sh/uv/install.sh /uv-installer.sh
28
  RUN sh /uv-installer.sh && rm /uv-installer.sh
29
  ENV PATH="/root/.local/bin:${PATH}"
@@ -31,21 +27,19 @@ ENV PATH="/root/.local/bin:${PATH}"
31
  # Copy virtual environment and project files
32
  COPY requirements.txt .
33
 
34
- # Create and activate virtual environment, install packages
35
  RUN uv venv /app/manimations \
36
  && . /app/manimations/bin/activate \
37
  && uv pip install --no-cache -r requirements.txt \
38
  && uv pip install --no-cache pycairo pangocffi manim
39
 
40
- # Fix pydub escape sequence issues in the regular expressions
41
- RUN sed -i 's/\\(/\\\\(/g; s/\\)/\\\\)/g' /app/manimations/lib/python3.12/site-packages/pydub/utils.py
42
-
43
  # Add manim to PATH
44
  ENV PATH="/app/manimations/bin:${PATH}"
45
 
46
- COPY *.py /app/
 
 
 
47
 
48
- # Set environment variables (use environment variable instead of .env file)
49
  ENV PYTHONPATH=/app
50
  ENV MPLBACKEND=Agg
51
  ENV GRADIO_SERVER_NAME=0.0.0.0
@@ -53,12 +47,8 @@ ENV GRADIO_SERVER_PORT=7860
53
  ENV TOGETHER_API_KEY=cee1393e4d4e7a94121882052a03f30a1d51f5dbd251140844ec616e17f60e9b
54
 
55
  # Create directory for generated videos with proper permissions
56
- RUN mkdir -p /app/generated_videos \
57
- && mkdir -p /app/media/Tex \
58
- && mkdir -p /app/media/videos \
59
- && chmod -R 777 /app/media \
60
- && chmod -R 777 /app/generated_videos \
61
- && chown -R appuser:appuser /app
62
 
63
  # Switch to non-root user
64
  USER appuser
 
18
  && rm -rf /var/lib/apt/lists/* \
19
  && which dvisvgm
20
 
 
 
 
21
  WORKDIR /app
22
 
 
23
  ADD https://astral.sh/uv/install.sh /uv-installer.sh
24
  RUN sh /uv-installer.sh && rm /uv-installer.sh
25
  ENV PATH="/root/.local/bin:${PATH}"
 
27
  # Copy virtual environment and project files
28
  COPY requirements.txt .
29
 
 
30
  RUN uv venv /app/manimations \
31
  && . /app/manimations/bin/activate \
32
  && uv pip install --no-cache -r requirements.txt \
33
  && uv pip install --no-cache pycairo pangocffi manim
34
 
 
 
 
35
  # Add manim to PATH
36
  ENV PATH="/app/manimations/bin:${PATH}"
37
 
38
+ # Copy requirements and install dependencies
39
+ COPY requirements.txt .
40
+ RUN uv pip install --no-cache -r requirements.txt \
41
+ && uv pip install --no-cache pycairo pangocffi manim
42
 
 
43
  ENV PYTHONPATH=/app
44
  ENV MPLBACKEND=Agg
45
  ENV GRADIO_SERVER_NAME=0.0.0.0
 
47
  ENV TOGETHER_API_KEY=cee1393e4d4e7a94121882052a03f30a1d51f5dbd251140844ec616e17f60e9b
48
 
49
  # Create directory for generated videos with proper permissions
50
+ RUN mkdir -p /app/generated_videos && \
51
+ chown -R appuser:appuser /app
 
 
 
 
52
 
53
  # Switch to non-root user
54
  USER appuser