diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 94628b3..2b93078 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,15 +18,15 @@ jobs: release: runs-on: ubuntu-latest steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 - id: rp if: github.event_name != 'pull_request' && github.ref_name == 'main' - uses: googleapis/release-please-action@7987652d64b4581673a76e33ad5e98e3dd56832f # v4 + uses: googleapis/release-please-action@7987652d64b4581673a76e33ad5e98e3dd56832f # v4 with: release-type: simple include-v-in-tags: false - name: Log into registry ${{ env.REGISTRY }} - uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3 + uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3 with: registry: ${{ env.REGISTRY }} username: ${{ env.REGISTRY_USERNAME }} @@ -54,16 +54,16 @@ jobs: } >> "$GITHUB_OUTPUT" - name: Docker meta id: meta - uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5 + uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} tags: ${{ steps.tags.outputs.tags }} - name: Set up QEMU - uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3 + uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3 + uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3 - name: Build and push - uses: docker/build-push-action@5176d81f87c23d6fc96624dfdbcd9f3830bbe445 # v6 + uses: docker/build-push-action@5176d81f87c23d6fc96624dfdbcd9f3830bbe445 # v6 with: context: . provenance: false @@ -71,4 +71,4 @@ jobs: tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} platforms: linux/amd64,linux/arm64 - build-args: APP_VERSION=${{ steps.meta.outputs.version }} + build-args: APP_IMAGE_VERSION=${{ steps.meta.outputs.version }} diff --git a/Dockerfile b/Dockerfile index 1f58904..c165b29 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ FROM python:3.12.4-slim@sha256:740d94a19218c8dd584b92f804b1158f85b0d241e5215ea26ed2dcade2b9d138 LABEL maintainer="Team Polarion (CLEW/WZU/POLARION) " -ARG APP_VERSION +ARG APP_IMAGE_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 && \ @@ -10,7 +10,7 @@ RUN apt-get update && \ ENV WORKING_DIR=/opt/weasyprint ENV CHROME_EXECUTABLE_PATH=/usr/bin/chromium -ENV WEASYPRINT_SERVICE_VERSION=$APP_VERSION +ENV WEASYPRINT_SERVICE_VERSION=$APP_IMAGE_VERSION WORKDIR ${WORKING_DIR} diff --git a/README.md b/README.md index 875b06b..37368ea 100644 --- a/README.md +++ b/README.md @@ -5,9 +5,9 @@ Service providing REST API to use WeasyPrint functionality ```bash docker build \ - --build-arg APP_VERSION=62.3.0 \ + --build-arg APP_IMAGE_VERSION=62.4.0 \ --file Dockerfile \ - --tag weasyprint-service:62.3.0 . + --tag weasyprint-service:62.4.0 . ``` ## Start Docker container @@ -16,7 +16,7 @@ Service providing REST API to use WeasyPrint functionality docker run --detach \ --publish 9080:9080 \ --name weasyprint-service \ - weasyprint-service:62.3.0 + weasyprint-service:62.4.0 ``` ## Stop Docker container diff --git a/app/WeasyprintController.py b/app/WeasyprintController.py index 1eb75d4..5de2371 100644 --- a/app/WeasyprintController.py +++ b/app/WeasyprintController.py @@ -17,7 +17,7 @@ def version(): return { "python": platform.python_version(), "weasyprint": weasyprint.__version__, - "weasyprintServiceVersion": os.environ.get('WEASYPRINT_SERVICE_VERSION') + "weasyprintService": os.environ.get('WEASYPRINT_SERVICE_VERSION') } @@ -41,8 +41,9 @@ def convert_html(): response = Response(output_pdf, mimetype="application/pdf", status=200) response.headers.add("Content-Disposition", "attachment; filename=" + file_name) - response.headers.add("Weasyprint-Version", weasyprint.__version__) response.headers.add("Python-Version", platform.python_version()) + response.headers.add("Weasyprint-Version", weasyprint.__version__) + response.headers.add("Weasyprint-Service-Version", os.environ.get('WEASYPRINT_SERVICE_VERSION')) return response except AssertionError as e: