FROM python:3.8-slim RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential python3-dev pkg-config curl xz-utils ca-certificates \ wkhtmltopdf \ && rm -rf /var/lib/apt/lists/* WORKDIR /app # build exact libs RUN curl -LO https://download.gnome.org/sources/libxml2/2.11/libxml2-2.11.9.tar.xz \ && tar -xf libxml2-2.11.9.tar.xz && cd libxml2-2.11.9 \ && ./configure --prefix=/opt/xml && make -j && make install && cd .. \ && rm -rf libxml2-2.11.9 libxml2-2.11.9.tar.xz \ && curl -LO https://download.gnome.org/sources/libxslt/1.1/libxslt-1.1.39.tar.xz \ && tar -xf libxslt-1.1.39.tar.xz && cd libxslt-1.1.39 \ && PKG_CONFIG_PATH=/opt/xml/lib/pkgconfig ./configure --prefix=/opt/xml \ && make -j && make install && cd .. \ && rm -rf libxslt-1.1.39 libxslt-1.1.39.tar.xz ENV CFLAGS="-I/opt/xml/include" \ LDFLAGS="-L/opt/xml/lib" \ PKG_CONFIG_PATH="/opt/xml/lib/pkgconfig" \ LD_LIBRARY_PATH="/opt/xml/lib" COPY requirements.txt . RUN pip install -U pip setuptools wheel \ && pip install --no-binary lxml -r requirements.txt RUN playwright install --with-deps chromium COPY . .