From 358075666a392e1f58885f6340344b761b5a037c Mon Sep 17 00:00:00 2001 From: Felix van Oost Date: Sun, 18 Aug 2024 06:07:56 -0400 Subject: [PATCH] Replace dvisvgm builder with apt package (#1770) --- ci/tasks/update-versions.js | 2 +- docker-bake.hcl | 2 +- server/README.adoc | 6 +- .../{jdk17-jammy => jdk17-noble}/Dockerfile | 90 ++++++------------- 4 files changed, 33 insertions(+), 67 deletions(-) rename server/ops/docker/{jdk17-jammy => jdk17-noble}/Dockerfile (87%) diff --git a/ci/tasks/update-versions.js b/ci/tasks/update-versions.js index 21b87da97..e129438b6 100755 --- a/ci/tasks/update-versions.js +++ b/ci/tasks/update-versions.js @@ -142,7 +142,7 @@ try { diagramLibraryVersions.diagramsnet = [...diagramsnetVersionFound][0].groups.version } - const dockerfileContent = await fs.readFile(ospath.join(rootDir, 'server', 'ops', 'docker', 'jdk17-jammy', 'Dockerfile'), 'utf8') + const dockerfileContent = await fs.readFile(ospath.join(rootDir, 'server', 'ops', 'docker', 'jdk17-noble', 'Dockerfile'), 'utf8') for (const line of dockerfileContent.split('\n')) { const d2VersionFound = line.match(/^ARG D2_VERSION="(?.+)"$/) if (d2VersionFound) { diff --git a/docker-bake.hcl b/docker-bake.hcl index 87fa43729..553437b06 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -25,7 +25,7 @@ target "kroki" { bytefield = "./bytefield" tikz = "./tikz" } - dockerfile = "ops/docker/jdk17-jammy/Dockerfile" + dockerfile = "ops/docker/jdk17-noble/Dockerfile" tags = ["yuzutech/kroki:${TAG}"] inherits = ["oci-labels"] labels = { diff --git a/server/README.adoc b/server/README.adoc index 035b1d4ea..b273c038d 100644 --- a/server/README.adoc +++ b/server/README.adoc @@ -14,7 +14,7 @@ When a new version is available, we need to : . update the fork . run the following workflow: https://github.com/yuzutech/ditaa-mini/actions/workflows/native-image-on-demand.yml -. update the argument variable `ARG DITAA_VERSION="x.y.z"` in `server/ops/docker/jdk17-jammy/Dockerfile` +. update the argument variable `ARG DITAA_VERSION="x.y.z"` in `server/ops/docker/jdk17-noble/Dockerfile` === PlantUML @@ -24,7 +24,7 @@ When a new version is available, we need to: . update the fork . run the following workflow: https://github.com/yuzutech/plantuml/actions/workflows/native-image-on-demand.yml -. update the argument variable `ARG PLANTUML_VERSION="x.y.z"` in `server/ops/docker/jdk17-jammy/Dockerfile` +. update the argument variable `ARG PLANTUML_VERSION="x.y.z"` in `server/ops/docker/jdk17-noble/Dockerfile` === UMLet @@ -34,4 +34,4 @@ When a new version is available, we need to: . update the fork . run the following workflow: https://github.com/yuzutech/umlet/actions/workflows/release.yml -. update the argument variable `ARG UMLET_VERSION="x.y.z"` in `server/ops/docker/jdk17-jammy/Dockerfile` +. update the argument variable `ARG UMLET_VERSION="x.y.z"` in `server/ops/docker/jdk17-noble/Dockerfile` diff --git a/server/ops/docker/jdk17-jammy/Dockerfile b/server/ops/docker/jdk17-noble/Dockerfile similarity index 87% rename from server/ops/docker/jdk17-jammy/Dockerfile rename to server/ops/docker/jdk17-noble/Dockerfile index 9770f1d4b..a97d2ebbe 100644 --- a/server/ops/docker/jdk17-jammy/Dockerfile +++ b/server/ops/docker/jdk17-noble/Dockerfile @@ -1,41 +1,5 @@ # syntax=docker/dockerfile:1.4 -## TikZ -FROM --platform=$BUILDPLATFORM ubuntu:jammy AS kroki-builder-dvisvgm - -RUN apt-get update && apt-get install --no-install-recommends --yes \ - build-essential \ - pkg-config \ - libclipper-dev \ - libfreetype-dev \ - libkpathsea-dev \ - ghostscript \ - libssl-dev \ - zlib1g-dev \ - curl \ - ca-certificates - -ARG DVISVGM_VERSION=3.0.4 - -ARG BUILDARCH -ARG TARGETARCH -RUN curl -LO https://github.com/mgieseki/dvisvgm/releases/download/$DVISVGM_VERSION/dvisvgm-$DVISVGM_VERSION.tar.gz && \ - tar xf dvisvgm-$DVISVGM_VERSION.tar.gz && \ - cd dvisvgm-$DVISVGM_VERSION && \ - case $BUILDARCH in \ - "amd64") MAKE_BUILD_ARCH=x86_64 ;; \ - "arm64") MAKE_BUILD_ARCH=aarch64 ;; \ - *) MAKE_BUILD_ARCH=$TARGETARCH ;; \ - esac && \ - case $TARGETARCH in \ - "amd64") MAKE_TARGET_ARCH=x86_64 ;; \ - "arm64") MAKE_TARGET_ARCH=aarch64 ;; \ - *) MAKE_TARGET_ARCH=$TARGETARCH ;; \ - esac && \ - ./configure --enable-bundled-libs --build $MAKE_BUILD_ARCH-linux-gnu --host $MAKE_TARGET_ARCH-linux-gnu && \ - make && \ - make install - ## Nomnoml FROM --platform=$BUILDPLATFORM node:18.20-bullseye-slim AS kroki-builder-nomnoml @@ -154,36 +118,35 @@ FROM yuzutech/kroki-builder-erd:0.2.1.0 AS kroki-builder-static-erd # --ghc-options="-w" ## Symbolator -FROM ubuntu:jammy AS kroki-builder-static-symbolator +FROM ubuntu:noble AS kroki-builder-static-symbolator # Build from forked source because upstream is broken for the latest python3 versions ARG SYMBOLATOR_VERSION=1.2.2 ARG SYMBOLATOR_SOURCE=git+https://github.com/zebreus/symbolator.git@v$SYMBOLATOR_VERSION RUN apt-get update && apt-get install --no-install-recommends --yes \ + build-essential \ git \ pip \ python3-dev \ patchelf \ python3-gi-cairo \ python3-gi \ - build-essential \ + python3-pip \ + python3-setuptools \ libpango1.0-dev && \ apt-get clean && apt-get autoremove WORKDIR /build -# Install latest pip and setuptools -RUN python3 -m pip install --upgrade pip setuptools -RUN python3 -m pip install --upgrade nuitka -# Install symbolator -RUN python3 -m pip install --upgrade ${SYMBOLATOR_SOURCE} +RUN python3 -m pip install --break-system-packages --upgrade nuitka +RUN python3 -m pip install --break-system-packages --upgrade ${SYMBOLATOR_SOURCE} # Use nuitka to compile a static binary so we dont need python in the final image RUN python3 -m nuitka --onefile `which symbolator` --include-module=gi.overrides.Pango --include-module=gi._gi_cairo ## Pikchr -FROM ubuntu:jammy AS kroki-builder-static-pikchr +FROM ubuntu:noble AS kroki-builder-static-pikchr ARG PIKCHR_VERSION=7269f78c4a3aa2809bd8c278e522c4eac5568ad0fd6ed0a3f807f4a2f6367ef0 @@ -232,18 +195,21 @@ RUN SVGBOB_VERSION=`cat Cargo.toml | grep "svgbob_cli =" | sed -r 's/.*"([^"]+)" # use a pre-built image to reduce build time ## yuzutech/kroki -FROM eclipse-temurin:17.0.10_7-jre-jammy +FROM eclipse-temurin:17.0.12_7-jre-noble +ARG BLOCKDIAG_VERSION="3.1.0" ARG D2_VERSION="0.6.3" +ARG DITAA_VERSION="1.0.3" +ARG DVISVGM_VERSION="3.2.1+ds-1build1" +ARG GRAPHVIZ_VERSION="9.0.0" ARG PLANTUML_VERSION="1.2024.1" ARG UMLET_VERSION="2023-03-20_UMLet_v15.1" -ARG GRAPHVIZ_VERSION="9.0.0" -ARG DITAA_VERSION="1.0.3" -ARG BLOCKDIAG_VERSION="3.1.0" ARG WIREVIZ_VERSION="0.3.3" ARG TARGETARCH -RUN addgroup --gecos 1000 kroki && adduser --disabled-password --ingroup kroki -u 1000 kroki +RUN apt-get update && apt-get install --no-install-recommends --yes \ + adduser && \ + addgroup --gecos 1001 kroki && adduser --disabled-password --ingroup kroki -u 1001 kroki # For TikZ # @@ -255,16 +221,17 @@ RUN addgroup --gecos 1000 kroki && adduser --disabled-password --ingroup kroki - # * texlive-pictures - Provides various graphics packages like "circuitikz" # * texlive-science - Provides various science packages like "siunitx" RUN apt-get update && apt-get install --no-install-recommends --yes \ - libpangocairo-1.0 \ - libgd3 \ - libjpeg9 \ - libpango1.0-0 \ - giflib-tools \ + dvisvgm=$DVISVGM_VERSION \ fonts-freefont-ttf \ - fonts-noto-cjk \ fonts-liberation \ - gsfonts \ + fonts-noto-cjk \ ghostscript \ + giflib-tools \ + gsfonts \ + libgd3 \ + libjpeg9 \ + libpango-1.0-0 \ + libpangocairo-1.0-0 \ poppler-utils \ texlive \ texlive-latex-extra \ @@ -295,16 +262,15 @@ RUN wget "https://github.com/yuzutech/blockdiag/releases/download/v${BLOCKDIAG_V RUN wget "https://github.com/yuzutech/WireViz/releases/download/v${WIREVIZ_VERSION}/wireviz-linux-${TARGETARCH}.bin" -O /usr/bin/wireviz && \ chmod +x /usr/bin/wireviz -COPY --from=kroki-builder-static-svgbob /usr/local/cargo/bin/svgbob_cli /usr/bin/svgbob +COPY --from=kroki-builder-bytefield /app/app.bin /usr/bin/bytefield +COPY --from=kroki-builder-dbml /app/app.bin /usr/bin/dbml +COPY --from=kroki-builder-nomnoml /app/app.bin /usr/bin/nomnoml COPY --from=kroki-builder-static-erd /root/.local/bin/erd /usr/bin/erd COPY --from=kroki-builder-static-pikchr /build/pikchr /usr/bin/pikchr -COPY --from=kroki-builder-nomnoml /app/app.bin /usr/bin/nomnoml +COPY --from=kroki-builder-static-svgbob /usr/local/cargo/bin/svgbob_cli /usr/bin/svgbob +COPY --from=kroki-builder-static-symbolator /build/symbolator.bin /usr/bin/symbolator COPY --from=kroki-builder-vega /app/app.bin /usr/bin/vega -COPY --from=kroki-builder-dbml /app/app.bin /usr/bin/dbml COPY --from=kroki-builder-wavedrom /app/app.bin /usr/bin/wavedrom -COPY --from=kroki-builder-static-symbolator /build/symbolator.bin /usr/bin/symbolator -COPY --from=kroki-builder-bytefield /app/app.bin /usr/bin/bytefield -COPY --from=kroki-builder-dvisvgm /usr/local/bin/dvisvgm /usr/bin/dvisvgm COPY --from=tikz tikz2svg /usr/bin/tikz2svg COPY --chown=kroki:kroki ops/docker/logback.xml /etc/kroki/logback.xml