md2png / Dockerfile
broadfield-dev's picture
Update Dockerfile
d47aaad verified
FROM python:3.10-slim
# Set the DEBIAN_FRONTEND to noninteractive
ENV DEBIAN_FRONTEND=noninteractive
# 1. Install all base dependencies, including those for xvfb.
RUN apt-get update && apt-get install -y --no-install-recommends \
wget \
ca-certificates \
fontconfig \
libxext6 \
libxrender1 \
xfonts-75dpi \
xfonts-base \
xvfb \
xauth \
&& rm -rf /var/lib/apt/lists/*
# 2. Download and install the required legacy dependencies.
RUN set -ex; \
wget http://archive.debian.org/debian/pool/main/libj/libjpeg-turbo/libjpeg62-turbo_1.5.2-2+deb10u1_amd64.deb && \
wget http://security.debian.org/debian-security/pool/updates/main/o/openssl/libssl1.1_1.1.1w-0+deb11u4_amd64.deb && \
apt-get install -y ./*.deb && \
rm ./*.deb
# 3. With all dependencies satisfied, download and install wkhtmltox.
RUN wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.buster_amd64.deb && \
apt-get install -y --no-install-recommends ./wkhtmltox_0.12.6-1.buster_amd64.deb && \
rm ./wkhtmltox_0.12.6-1.buster_amd64.deb && \
rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
# Ensure the temp directory is writable
RUN mkdir -p /app/temp && chmod -R 777 /app/temp
ENV PORT=7860
CMD ["python", "app.py"]