From ad27a7a17b8c995ba6de824c831a91938830d7ab Mon Sep 17 00:00:00 2001 From: pbezliapovich Date: Wed, 31 Jul 2024 10:26:56 +0200 Subject: [PATCH] feat: Added info about the used weasyprint docker-image version (#40) * feat: Added info about the used weasyprint docker-image version Refs: #104 * feat: Added info about the used weasyprint docker-image version Refs: #104 --- Dockerfile | 2 ++ README.md | 1 + app/WeasyprintController.py | 4 +++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 3a44264..1f58904 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,6 @@ FROM python:3.12.4-slim@sha256:740d94a19218c8dd584b92f804b1158f85b0d241e5215ea26ed2dcade2b9d138 LABEL maintainer="Team Polarion (CLEW/WZU/POLARION) " +ARG APP_VERSION RUN apt-get update && \ apt-get --yes --no-install-recommends install python3-cffi python3-brotli libpango-1.0-0 libpangoft2-1.0-0 fonts-liberation chromium && \ @@ -9,6 +10,7 @@ RUN apt-get update && \ ENV WORKING_DIR=/opt/weasyprint ENV CHROME_EXECUTABLE_PATH=/usr/bin/chromium +ENV WEASYPRINT_SERVICE_VERSION=$APP_VERSION WORKDIR ${WORKING_DIR} diff --git a/README.md b/README.md index 2edbf1f..875b06b 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ Service providing REST API to use WeasyPrint functionality ```bash docker build \ + --build-arg APP_VERSION=62.3.0 \ --file Dockerfile \ --tag weasyprint-service:62.3.0 . ``` diff --git a/app/WeasyprintController.py b/app/WeasyprintController.py index 924262d..1eb75d4 100644 --- a/app/WeasyprintController.py +++ b/app/WeasyprintController.py @@ -1,4 +1,5 @@ import logging +import os import platform from urllib.parse import unquote @@ -15,7 +16,8 @@ def version(): return { "python": platform.python_version(), - "weasyprint": weasyprint.__version__ + "weasyprint": weasyprint.__version__, + "weasyprintServiceVersion": os.environ.get('WEASYPRINT_SERVICE_VERSION') }