eps2svg / Dockerfile
namelessai's picture
Update Dockerfile
7f15fad verified
FROM python:3.12-slim
# Set working directory
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
ghostscript \
imagemagick \
libmagickwand-dev \
potrace \
inkscape \
&& rm -rf /var/lib/apt/lists/*
# Configure ImageMagick to allow EPS/PS/PDF processing
RUN POLICY_FILE=$(find /etc -name policy.xml 2>/dev/null | head -n 1) && \
if [ -n "$POLICY_FILE" ]; then \
sed -i 's/<policy domain="coder" rights="none" pattern="PS" \/>/<policy domain="coder" rights="read|write" pattern="PS" \/>/g' "$POLICY_FILE" && \
sed -i 's/<policy domain="coder" rights="none" pattern="EPS" \/>/<policy domain="coder" rights="read|write" pattern="EPS" \/>/g' "$POLICY_FILE" && \
sed -i 's/<policy domain="coder" rights="none" pattern="PDF" \/>/<policy domain="coder" rights="read|write" pattern="PDF" \/>/g' "$POLICY_FILE"; \
fi
# Copy requirements file
COPY requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Copy application code
COPY app.py .
# Expose Gradio port
EXPOSE 7860
# Run the application
CMD ["python", "app.py"]