mgbam commited on
Commit
6db1678
·
verified ·
1 Parent(s): 1c41bb9

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +4 -13
Dockerfile CHANGED
@@ -7,7 +7,6 @@ ENV PYTHONDONTWRITEBYTECODE 1
7
  ENV PIP_NO_CACHE_DIR off
8
  ENV PIP_DISABLE_PIP_VERSION_CHECK 1
9
  ENV DEBIAN_FRONTEND=noninteractive
10
- # Set a UTF-8 locale to prevent potential encoding issues with filenames or text processing
11
  ENV LANG C.UTF-8
12
  ENV LC_ALL C.UTF-8
13
 
@@ -15,11 +14,6 @@ ENV LC_ALL C.UTF-8
15
  WORKDIR /app
16
 
17
  # Install system dependencies
18
- # - ffmpeg for MoviePy audio/video processing
19
- # - imagemagick for MoviePy TextClip and other image operations (ensure it's v6 or v7 compatible with policy fix)
20
- # - git for pip requirements from git
21
- # - fonts-dejavu-core, fonts-liberation for general font availability
22
- # - libgl1-mesa-glx, libglib2.0-0 often needed for CV/GUI libraries, though maybe not strictly for this app yet
23
  RUN apt-get update && apt-get install -y --no-install-recommends \
24
  ffmpeg \
25
  imagemagick \
@@ -31,16 +25,15 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
31
  && rm -rf /var/lib/apt/lists/*
32
 
33
  # Modify ImageMagick policy.xml to allow operations needed by MoviePy
34
- # This is critical for TextClip and other ImageMagick-dependent features in MoviePy
35
  RUN if [ -f /etc/ImageMagick-6/policy.xml ]; then \
36
  XML_FILE="/etc/ImageMagick-6/policy.xml"; \
37
- logger -s "INFO: Modifying ImageMagick policy at $XML_FILE (v6) for MoviePy compatibility." ; \
38
  elif [ -f /etc/ImageMagick-7/policy.xml ]; then \
39
  XML_FILE="/etc/ImageMagick-7/policy.xml"; \
40
- logger -s "INFO: Modifying ImageMagick policy at $XML_FILE (v7) for MoviePy compatibility." ; \
41
  else \
42
  XML_FILE=""; \
43
- logger -s "WARNING: ImageMagick policy.xml not found in /etc/ImageMagick-[67]/. MoviePy TextClip might fail." ; \
44
  fi && \
45
  if [ -n "$XML_FILE" ] && [ -f "$XML_FILE" ]; then \
46
  sed -i 's/<policy domain="path" rights="none" pattern="@\*"\/>/<!-- <policy domain="path" rights="none" pattern="@\*" \/> -->/' "$XML_FILE" && \
@@ -50,7 +43,7 @@ RUN if [ -f /etc/ImageMagick-6/policy.xml ]; then \
50
  sed -i 's/<policy domain="coder" rights="none" pattern="MSL"\/>/<!-- <policy domain="coder" rights="none" pattern="MSL" \/> -->/' "$XML_FILE" && \
51
  sed -i 's/<policy domain="coder" rights="none" pattern="HTTPS"\/>/<!-- <policy domain="coder" rights="none" pattern="HTTPS" \/> -->/' "$XML_FILE" && \
52
  sed -i 's/<policy domain="coder" rights="none" pattern="HTTP"\/>/<!-- <policy domain="coder" rights="none" pattern="HTTP" \/> -->/' "$XML_FILE" && \
53
- logger -s "INFO: ImageMagick policy modifications applied to $XML_FILE." ; \
54
  fi
55
 
56
  # Create a non-root user and group
@@ -75,7 +68,6 @@ COPY --chown=appuser:appgroup . .
75
  USER appuser # Switch back to appuser
76
 
77
  # Create the output directory for media and ensure it's writable by appuser
78
- # This should already be under /app which is owned by appuser now.
79
  RUN mkdir -p /app/temp_cinegen_media
80
  # The assets directory also needs to be accessible
81
  RUN mkdir -p /app/assets/fonts
@@ -84,5 +76,4 @@ RUN mkdir -p /app/assets/fonts
84
  EXPOSE 8501
85
 
86
  # Define the command to run the application
87
- # Use 0.0.0.0 to make the app accessible from outside the container
88
  CMD ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0", "--global.sharingMode=off", "--client.gatherUsageStats=false"]
 
7
  ENV PIP_NO_CACHE_DIR off
8
  ENV PIP_DISABLE_PIP_VERSION_CHECK 1
9
  ENV DEBIAN_FRONTEND=noninteractive
 
10
  ENV LANG C.UTF-8
11
  ENV LC_ALL C.UTF-8
12
 
 
14
  WORKDIR /app
15
 
16
  # Install system dependencies
 
 
 
 
 
17
  RUN apt-get update && apt-get install -y --no-install-recommends \
18
  ffmpeg \
19
  imagemagick \
 
25
  && rm -rf /var/lib/apt/lists/*
26
 
27
  # Modify ImageMagick policy.xml to allow operations needed by MoviePy
 
28
  RUN if [ -f /etc/ImageMagick-6/policy.xml ]; then \
29
  XML_FILE="/etc/ImageMagick-6/policy.xml"; \
30
+ echo "INFO: Modifying ImageMagick policy at $XML_FILE (v6) for MoviePy compatibility." ; \
31
  elif [ -f /etc/ImageMagick-7/policy.xml ]; then \
32
  XML_FILE="/etc/ImageMagick-7/policy.xml"; \
33
+ echo "INFO: Modifying ImageMagick policy at $XML_FILE (v7) for MoviePy compatibility." ; \
34
  else \
35
  XML_FILE=""; \
36
+ echo "WARNING: ImageMagick policy.xml not found in /etc/ImageMagick-[67]/. MoviePy TextClip might fail." ; \
37
  fi && \
38
  if [ -n "$XML_FILE" ] && [ -f "$XML_FILE" ]; then \
39
  sed -i 's/<policy domain="path" rights="none" pattern="@\*"\/>/<!-- <policy domain="path" rights="none" pattern="@\*" \/> -->/' "$XML_FILE" && \
 
43
  sed -i 's/<policy domain="coder" rights="none" pattern="MSL"\/>/<!-- <policy domain="coder" rights="none" pattern="MSL" \/> -->/' "$XML_FILE" && \
44
  sed -i 's/<policy domain="coder" rights="none" pattern="HTTPS"\/>/<!-- <policy domain="coder" rights="none" pattern="HTTPS" \/> -->/' "$XML_FILE" && \
45
  sed -i 's/<policy domain="coder" rights="none" pattern="HTTP"\/>/<!-- <policy domain="coder" rights="none" pattern="HTTP" \/> -->/' "$XML_FILE" && \
46
+ echo "INFO: ImageMagick policy modifications applied to $XML_FILE." ; \
47
  fi
48
 
49
  # Create a non-root user and group
 
68
  USER appuser # Switch back to appuser
69
 
70
  # Create the output directory for media and ensure it's writable by appuser
 
71
  RUN mkdir -p /app/temp_cinegen_media
72
  # The assets directory also needs to be accessible
73
  RUN mkdir -p /app/assets/fonts
 
76
  EXPOSE 8501
77
 
78
  # Define the command to run the application
 
79
  CMD ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0", "--global.sharingMode=off", "--client.gatherUsageStats=false"]