Commit 3b86473f authored by Christophe Benz's avatar Christophe Benz

Fix Dockerfile and PDF generation

parent a05ae766
......@@ -6,25 +6,23 @@ EXPOSE 5000
RUN pip install --no-cache-dir gunicorn==19.9.0
RUN apt-get update && \
apt-get install --yes chromium=73.0.3683.75-1~deb9u1
apt-get install --yes --no-install-recommends chromium=73.0.3683.75-1~deb9u1
ARG user=jenkins
ARG group=jenkins
ARG uid=1000
ARG gid=1000
RUN groupadd -g ${gid} ${group} && \
useradd -u ${uid} -g ${gid} --no-create-home --shell /bin/bash ${user}
RUN groupadd -g ${gid} validata && \
useradd -u ${uid} -g ${gid} --create-home --shell /bin/bash validata
WORKDIR /app
# Cf https://bugs.chromium.org/p/chromium/issues/detail?id=638180 and https://blog.ineat-conseil.fr/2018/08/executer-karma-avec-chromeheadless-dans-un-conteneur-docker/
USER validata
COPY requirements.txt .
RUN pip install --no-cache-dir --requirement requirements.txt
WORKDIR /app
COPY . .
RUN pip install --no-cache-dir --editable .
COPY --chown=validata:validata requirements.txt .
RUN pip install --no-cache-dir --user --requirement requirements.txt --no-warn-script-location
# Cf https://bugs.chromium.org/p/chromium/issues/detail?id=638180
USER ${user}
COPY --chown=validata:validata . .
RUN pip install --no-cache-dir --user --editable .
CMD gunicorn --bind 0.0.0.0:5000 validata_ui:app
\ No newline at end of file
CMD gunicorn --workers 4 --bind 0.0.0.0:5000 validata_ui:app
......@@ -478,7 +478,7 @@ def pdf_report():
tmp_pdf_report = Path(tmpfile.name)
# Use chromium headless to generate PDF from validation report page
cmd = ['chromium', '--headless', '--disable-gpu',
cmd = ['chromium', '--headless', '--no-sandbox',
'--print-to-pdf={}'.format(str(tmp_pdf_report)), validation_url]
result = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
if result.returncode != 0:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment