I am trying to deploy a flask (python) app that uses wkhtmltopdf.
Everything works perfectly when it is run in a debug environment, however when I run it using docker, it stops showing footers and headers.
I suspect it has something to do with the way Docker installs wkhtmltopdf.
Here is my Dockerfile
# set base image (host OS)
FROM python:3.9
RUN apt-get update && \
apt-get install -y locales && \
sed -i -e 's/# es_ES.UTF-8 UTF-8/es_ES.UTF-8 UTF-8/' /etc/locale.gen && \
dpkg-reconfigure --frontend=noninteractive locales
ENV LC_TIME es_ES.UTF-8
# I BELIEVE I AM MISSING SOMETHING HERE
RUN apt-get install wkhtmltopdf -y
# set the working directory in the container
WORKDIR /app
ENV PYTHONPATH "${PYTHONPATH}:/app/src"
# copy the dependencies file to the working directory
COPY requirements.txt .
# install dependencies
RUN pip install -r requirements.txt
# copy the content of the local src directory to the working directory
COPY . .
# command to run on container start
CMD [ "gunicorn", "src.wsgi:app","--bind","0.0.0.0:5000" ]
Here are the relevante python requirements in case they might be useful.
PyPDF2==1.26.0
pdfkit==0.6.1
Any help will be much appreciated. Thanks!
from --footer not showing when using wkhtmltopdf within a docker container
No comments:
Post a Comment