Spaces:
Sleeping
Sleeping
Commit
·
e1dcbde
1
Parent(s):
a22287e
update: dockerfile- imagemagick policy
Browse files- Dockerfile +6 -6
Dockerfile
CHANGED
@@ -5,22 +5,22 @@ WORKDIR /app
|
|
5 |
# Give write permissions to the app directory
|
6 |
RUN chmod 777 /app
|
7 |
|
8 |
-
#
|
9 |
RUN apt-get update && apt-get install -y \
|
10 |
ffmpeg \
|
11 |
imagemagick \
|
12 |
&& rm -rf /var/lib/apt/lists/*
|
13 |
|
|
|
|
|
|
|
|
|
14 |
# Copy requirements.txt and install dependencies
|
15 |
COPY requirements.txt ./
|
16 |
|
17 |
RUN pip install --no-cache-dir -r requirements.txt
|
18 |
|
19 |
-
# Copy all
|
20 |
COPY . .
|
21 |
|
22 |
-
# Set the environment variable for ImageMagick (if necessary)
|
23 |
-
# Replace with the correct path if needed, for example:
|
24 |
-
# ENV MAGICK_HOME=/usr/local/ ImageMagick_BINARY=/usr/local/bin/convert
|
25 |
-
|
26 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
5 |
# Give write permissions to the app directory
|
6 |
RUN chmod 777 /app
|
7 |
|
8 |
+
# Install dependencies including ffmpeg and imagemagick
|
9 |
RUN apt-get update && apt-get install -y \
|
10 |
ffmpeg \
|
11 |
imagemagick \
|
12 |
&& rm -rf /var/lib/apt/lists/*
|
13 |
|
14 |
+
# Modify ImageMagick security policy to allow operations in /tmp
|
15 |
+
RUN sed -i '/<policy domain="coder" rights="none" pattern="PDF" \/>' /etc/ImageMagick-6/policy.xml
|
16 |
+
RUN sed -i '/<policy domain="path" rights="none" pattern="\/tmp\/" \/>/a <policy domain="path" rights="read|write" pattern="\/tmp\/" \/>' /etc/ImageMagick-6/policy.xml
|
17 |
+
|
18 |
# Copy requirements.txt and install dependencies
|
19 |
COPY requirements.txt ./
|
20 |
|
21 |
RUN pip install --no-cache-dir -r requirements.txt
|
22 |
|
23 |
+
# Copy all files from the current directory to the container
|
24 |
COPY . .
|
25 |
|
|
|
|
|
|
|
|
|
26 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|