From 0f928553224370e12defcc5af1e70a2c73a2fa2f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 1 Feb 2025 22:13:19 +0000 Subject: [PATCH 1/6] build(deps): bump ubuntu from 22.04 to 24.04 Dependabot couldn't find the original pull request head commit, f0907ef462cf254887f1e533356ed15394759e73. --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 49535e1..cb99468 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:22.04 +FROM ubuntu:24.04 LABEL org.opencontainers.image.authors="https://github.com/riedde" LABEL org.opencontainers.image.authors="https://github.com/bwbohl" From a28f12bba27799cc9a4f466bf1ef1768223da055 Mon Sep 17 00:00:00 2001 From: musicEnfanthen Date: Sat, 1 Feb 2025 23:15:09 +0100 Subject: [PATCH 2/6] ci: update ubuntu version --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index cb99468..62283ba 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,7 +10,7 @@ ARG JAVA_VERSION=17 ARG PRINCE_VERSION=15.3 ARG SAXON_VERSION=SaxonHE12-5 ARG SCHEMATRON_VERSION=8.0.0 -ARG UBUNTU_VERSION=22.04 +ARG UBUNTU_VERSION=24.04 ARG XERCES_VERSION=26.1.0.1 ARG TARGETARCH From c5848c8879717128433d85d7a48df2ff70432526 Mon Sep 17 00:00:00 2001 From: musicEnfanthen Date: Sat, 1 Feb 2025 23:15:40 +0100 Subject: [PATCH 3/6] ci: update Prince --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 62283ba..e1b5e89 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,7 @@ LABEL org.opencontainers.image.source="https://github.com/music-encoding/docker- LABEL org.opencontainers.image.revision="v0.0.1" ARG JAVA_VERSION=17 -ARG PRINCE_VERSION=15.3 +ARG PRINCE_VERSION=15.4.1 ARG SAXON_VERSION=SaxonHE12-5 ARG SCHEMATRON_VERSION=8.0.0 ARG UBUNTU_VERSION=24.04 From 27c7d463649dd4585edc132c7cd390e12ff48756 Mon Sep 17 00:00:00 2001 From: musicEnfanthen Date: Sat, 1 Feb 2025 23:40:08 +0100 Subject: [PATCH 4/6] ci: update saxon arg name --- Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index e1b5e89..1633202 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,7 +8,7 @@ LABEL org.opencontainers.image.revision="v0.0.1" ARG JAVA_VERSION=17 ARG PRINCE_VERSION=15.4.1 -ARG SAXON_VERSION=SaxonHE12-5 +ARG SAXON_EDITION_VERSION=SaxonHE12-5 ARG SCHEMATRON_VERSION=8.0.0 ARG UBUNTU_VERSION=24.04 ARG XERCES_VERSION=26.1.0.1 @@ -27,7 +27,7 @@ ENV NODE_ENV=production USER root ADD https://downloads.apache.org/ant/binaries/apache-ant-${ANT_VERSION}-bin.tar.gz \ - https://github.com/Saxonica/Saxon-HE/releases/download/${SAXON_VERSION}/${SAXON_VERSION}J.zip \ + https://github.com/Saxonica/Saxon-HE/releases/download/${SAXON_EDITION_VERSION}/${SAXON_EDITION_VERSION}J.zip \ https://www.oxygenxml.com/maven/com/oxygenxml/oxygen-patched-xerces/${XERCES_VERSION}/oxygen-patched-xerces-${XERCES_VERSION}.jar \ https://repo1.maven.org/maven2/com/helger/schematron/ph-schematron-ant-task/${SCHEMATRON_VERSION}/ph-schematron-ant-task-${SCHEMATRON_VERSION}-jar-with-dependencies.jar \ /tmp/ @@ -51,7 +51,7 @@ RUN apt-get update && apt-get full-upgrade -y && \ # setup ant tar -xvf /tmp/apache-ant-${ANT_VERSION}-bin.tar.gz -C /opt && \ # setup saxon - unzip /tmp/${SAXON_VERSION}J.zip -d ${ANT_HOME}/lib && \ + unzip /tmp/${SAXON_EDITION_VERSION}J.zip -d ${ANT_HOME}/lib && \ # setup xerces cp /tmp/oxygen-patched-xerces-${XERCES_VERSION}.jar ${ANT_HOME}/lib && \ # setup schematron From 9bdfedb98bff96eadf491079bebf55d77ede2c87 Mon Sep 17 00:00:00 2001 From: musicEnfanthen Date: Tue, 4 Feb 2025 12:57:32 +0100 Subject: [PATCH 5/6] ci: move to multistage docker --- Dockerfile | 151 ++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 110 insertions(+), 41 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1633202..5323800 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,53 +1,94 @@ -FROM ubuntu:24.04 +# Global args +ARG JAVA_VERSION=17 -LABEL org.opencontainers.image.authors="https://github.com/riedde" -LABEL org.opencontainers.image.authors="https://github.com/bwbohl" -LABEL org.opencontainers.image.authors="https://github.com/kepper" -LABEL org.opencontainers.image.source="https://github.com/music-encoding/docker-mei" -LABEL org.opencontainers.image.revision="v0.0.1" +# Alias for Eclipse Temurin Java image +FROM eclipse-temurin:${JAVA_VERSION} AS temurin -ARG JAVA_VERSION=17 + +################# +# Stage 1: BASE # +################# +FROM ubuntu:24.10 AS base + +ARG ANT_VERSION=1.10.14 +ARG NODE_VERSION=22 ARG PRINCE_VERSION=15.4.1 ARG SAXON_EDITION_VERSION=SaxonHE12-5 ARG SCHEMATRON_VERSION=8.0.0 ARG UBUNTU_VERSION=24.04 ARG XERCES_VERSION=26.1.0.1 - ARG TARGETARCH -ARG DEBIAN_FRONTEND=noninteractive -ARG DEB_FILE=prince_${PRINCE_VERSION}-1_ubuntu${UBUNTU_VERSION}_${TARGETARCH}.deb ENV TZ=Europe/Berlin -ENV ANT_VERSION=1.10.14 - -ENV ANT_HOME=/opt/apache-ant-${ANT_VERSION} -ENV PATH=${PATH}:${ANT_HOME}/bin -ENV NODE_ENV=production USER root -ADD https://downloads.apache.org/ant/binaries/apache-ant-${ANT_VERSION}-bin.tar.gz \ - https://github.com/Saxonica/Saxon-HE/releases/download/${SAXON_EDITION_VERSION}/${SAXON_EDITION_VERSION}J.zip \ - https://www.oxygenxml.com/maven/com/oxygenxml/oxygen-patched-xerces/${XERCES_VERSION}/oxygen-patched-xerces-${XERCES_VERSION}.jar \ - https://repo1.maven.org/maven2/com/helger/schematron/ph-schematron-ant-task/${SCHEMATRON_VERSION}/ph-schematron-ant-task-${SCHEMATRON_VERSION}-jar-with-dependencies.jar \ - /tmp/ +RUN echo 'APT::Install-Suggests "0";' >> /etc/apt/apt.conf.d/00-docker +RUN echo 'APT::Install-Recommends "0";' >> /etc/apt/apt.conf.d/00-docker +RUN DEBIAN_FRONTEND=noninteractive \ + # update and install common dependencies + apt-get update && apt-get full-upgrade -y && \ + apt-get install -y --no-install-recommends apt-utils ca-certificates curl unzip + + +################ +# Stage 2: GIT # +################ +FROM base AS git-build + +RUN DEBIAN_FRONTEND=noninteractive \ + apt-get install -y --no-install-recommends git + + +################# +# Stage 3: NODE # +################# +FROM base AS node-build + +ENV NODE_ENV=production COPY ["index.js", "package.json", "package-lock.json*", "/opt/docker-mei/"] -# Configure the Eclipse Adoptium apt repository -RUN apt-get update && apt-get full-upgrade -y && \ - apt-get install -y --no-install-recommends wget apt-transport-https curl ca-certificates && \ - mkdir -p /etc/apt/keyrings && \ - wget -O - https://packages.adoptium.net/artifactory/api/gpg/key/public | tee /etc/apt/keyrings/adoptium.asc && \ - echo "deb [signed-by=/etc/apt/keyrings/adoptium.asc] https://packages.adoptium.net/artifactory/deb $(awk -F= '/^VERSION_CODENAME/{print$2}' /etc/os-release) main" | tee /etc/apt/sources.list.d/adoptium.list && \ +RUN DEBIAN_FRONTEND=noninteractive \ # install nodejs - curl -fsSL https://deb.nodesource.com/setup_18.x -o nodesource_setup.sh && \ + curl -fsSL https://deb.nodesource.com/setup_${NODE_VERSION}.x -o nodesource_setup.sh && \ bash nodesource_setup.sh && \ + apt-get install -y --no-install-recommends nodejs && \ + # setup node app for rendering MEI files to SVG using Verovio Toolkit + cd /opt/docker-mei && \ + npm install --omit=dev + + +################### +# Stage 4: PRINCE # +################### +FROM base AS prince-build + +ARG PRINCE_DEB_FILE=prince_${PRINCE_VERSION}-1_ubuntu${UBUNTU_VERSION}_${TARGETARCH}.deb + +RUN DEBIAN_FRONTEND=noninteractive \ # install prince - curl --proto '=https' --tlsv1.2 -LO https://www.princexml.com/download/${DEB_FILE} && \ - apt-get install -y --no-install-recommends apt-utils python3-pip temurin-${JAVA_VERSION}-jdk nodejs unzip git libc6 aptitude libaom-dev fonts-stix ./${DEB_FILE} && \ + curl --proto '=https' --tlsv1.2 -LO https://www.princexml.com/download/${PRINCE_DEB_FILE} && \ + apt-get install -y --no-install-recommends libc6 libaom-dev fonts-stix ./${PRINCE_DEB_FILE} && \ # link ca-certificates - ln -sf /etc/ssl/certs/ca-certificates.crt /usr/lib/prince/etc/curl-ca-bundle.crt && \ + ln -sf /etc/ssl/certs/ca-certificates.crt /usr/lib/prince/etc/curl-ca-bundle.crt + + +################ +# Stage 5: ANT # +################ +FROM base AS ant-build + +ENV ANT_HOME=/opt/apache-ant-${ANT_VERSION} +ENV PATH=${PATH}:${ANT_HOME}/bin + +ADD https://downloads.apache.org/ant/binaries/apache-ant-${ANT_VERSION}-bin.tar.gz \ + https://github.com/Saxonica/Saxon-HE/releases/download/${SAXON_EDITION_VERSION}/${SAXON_EDITION_VERSION}J.zip \ + https://www.oxygenxml.com/maven/com/oxygenxml/oxygen-patched-xerces/${XERCES_VERSION}/oxygen-patched-xerces-${XERCES_VERSION}.jar \ + https://repo1.maven.org/maven2/com/helger/schematron/ph-schematron-ant-task/${SCHEMATRON_VERSION}/ph-schematron-ant-task-${SCHEMATRON_VERSION}-jar-with-dependencies.jar \ + /tmp/ + +RUN DEBIAN_FRONTEND=noninteractive \ # setup ant tar -xvf /tmp/apache-ant-${ANT_VERSION}-bin.tar.gz -C /opt && \ # setup saxon @@ -55,16 +96,44 @@ RUN apt-get update && apt-get full-upgrade -y && \ # setup xerces cp /tmp/oxygen-patched-xerces-${XERCES_VERSION}.jar ${ANT_HOME}/lib && \ # setup schematron - cp /tmp/ph-schematron-ant-task-${SCHEMATRON_VERSION}-jar-with-dependencies.jar ${ANT_HOME}/lib && \ - # cleanup - apt-get purge -y aptitude apt-utils && \ - apt-get autoremove -y && apt-get clean && \ - apt-get clean && \ - rm ${DEB_FILE} nodesource_setup.sh && \ - cd /opt/docker-mei && \ - # setup node app for rendering MEI files to SVG using Verovio Toolkit - npm install --omit=dev && \ - # clean temporary folders - rm -rfv /tmp/* /root/.npm* + cp /tmp/ph-schematron-ant-task-${SCHEMATRON_VERSION}-jar-with-dependencies.jar ${ANT_HOME}/lib + + +#################### +# Stage 6: Runtime # +#################### +FROM ubuntu:24.10 + +LABEL org.opencontainers.image.authors="https://github.com/riedde" \ + org.opencontainers.image.authors="https://github.com/bwbohl" \ + org.opencontainers.image.authors="https://github.com/kepper" \ + org.opencontainers.image.authors="https://github.com/musicEnfanthen" \ + org.opencontainers.image.source="https://github.com/music-encoding/docker-mei" \ + org.opencontainers.image.revision="v0.0.1" + +ENV TZ=Europe/Berlin +ENV ANT_HOME=/opt/apache-ant-1.10.14 +ENV JAVA_HOME=/opt/java/openjdk + +# Java & Ant (including Saxon, Schematron and Xerces) +COPY --from=temurin $JAVA_HOME $JAVA_HOME +COPY --from=ant-build $ANT_HOME $ANT_HOME +# Git +COPY --from=git-build /usr/bin/git /usr/bin/git +COPY --from=git-build /usr/lib/git-core /usr/lib/git-core +COPY --from=git-build /usr/share/git-core /usr/share/git-core +# Node +COPY --from=node-build /usr/bin/node /usr/bin/node +COPY --from=node-build /usr/lib/node_modules /usr/lib/node_modules +COPY --from=node-build /opt/docker-mei /opt/docker-mei +# Prince +COPY --from=prince-build /usr/bin/prince /usr/bin/prince +COPY --from=prince-build /usr/lib/prince /usr/lib/prince +COPY --from=prince-build /etc/fonts /etc/fonts +COPY --from=prince-build /usr/share/fonts /usr/share/fonts +COPY --from=prince-build /usr/lib/x86_64-linux-gnu/lib* /usr/lib/x86_64-linux-gnu/ + +# Set path +ENV PATH=${PATH}:${ANT_HOME}/bin:${JAVA_HOME}/bin:/usr/local/bin WORKDIR /opt/docker-mei From f5357416dd989b262d21fe880b34961ce40bd284 Mon Sep 17 00:00:00 2001 From: musicEnfanthen Date: Wed, 5 Feb 2025 00:19:31 +0100 Subject: [PATCH 6/6] ci: move prince to base image to get correct targetarch --- Dockerfile | 36 ++++++++++++------------------------ 1 file changed, 12 insertions(+), 24 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5323800..40baf39 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,7 +17,9 @@ ARG SAXON_EDITION_VERSION=SaxonHE12-5 ARG SCHEMATRON_VERSION=8.0.0 ARG UBUNTU_VERSION=24.04 ARG XERCES_VERSION=26.1.0.1 + ARG TARGETARCH +ARG PRINCE_DEB_FILE=prince_${PRINCE_VERSION}-1_ubuntu${UBUNTU_VERSION}_${TARGETARCH}.deb ENV TZ=Europe/Berlin @@ -28,7 +30,12 @@ RUN echo 'APT::Install-Recommends "0";' >> /etc/apt/apt.conf.d/00-docker RUN DEBIAN_FRONTEND=noninteractive \ # update and install common dependencies apt-get update && apt-get full-upgrade -y && \ - apt-get install -y --no-install-recommends apt-utils ca-certificates curl unzip + apt-get install -y --no-install-recommends apt-utils ca-certificates curl unzip && \ + # install prince + curl --proto '=https' --tlsv1.2 -LO https://www.princexml.com/download/${PRINCE_DEB_FILE} && \ + apt-get install -y --no-install-recommends libc6 libaom-dev fonts-stix ./${PRINCE_DEB_FILE} && \ + # link ca-certificates + ln -sf /etc/ssl/certs/ca-certificates.crt /usr/lib/prince/etc/curl-ca-bundle.crt ################ @@ -59,23 +66,8 @@ RUN DEBIAN_FRONTEND=noninteractive \ npm install --omit=dev -################### -# Stage 4: PRINCE # -################### -FROM base AS prince-build - -ARG PRINCE_DEB_FILE=prince_${PRINCE_VERSION}-1_ubuntu${UBUNTU_VERSION}_${TARGETARCH}.deb - -RUN DEBIAN_FRONTEND=noninteractive \ - # install prince - curl --proto '=https' --tlsv1.2 -LO https://www.princexml.com/download/${PRINCE_DEB_FILE} && \ - apt-get install -y --no-install-recommends libc6 libaom-dev fonts-stix ./${PRINCE_DEB_FILE} && \ - # link ca-certificates - ln -sf /etc/ssl/certs/ca-certificates.crt /usr/lib/prince/etc/curl-ca-bundle.crt - - ################ -# Stage 5: ANT # +# Stage 4: ANT # ################ FROM base AS ant-build @@ -102,7 +94,7 @@ RUN DEBIAN_FRONTEND=noninteractive \ #################### # Stage 6: Runtime # #################### -FROM ubuntu:24.10 +FROM base AS runtime LABEL org.opencontainers.image.authors="https://github.com/riedde" \ org.opencontainers.image.authors="https://github.com/bwbohl" \ @@ -125,13 +117,9 @@ COPY --from=git-build /usr/share/git-core /usr/share/git-core # Node COPY --from=node-build /usr/bin/node /usr/bin/node COPY --from=node-build /usr/lib/node_modules /usr/lib/node_modules + +# Main directory COPY --from=node-build /opt/docker-mei /opt/docker-mei -# Prince -COPY --from=prince-build /usr/bin/prince /usr/bin/prince -COPY --from=prince-build /usr/lib/prince /usr/lib/prince -COPY --from=prince-build /etc/fonts /etc/fonts -COPY --from=prince-build /usr/share/fonts /usr/share/fonts -COPY --from=prince-build /usr/lib/x86_64-linux-gnu/lib* /usr/lib/x86_64-linux-gnu/ # Set path ENV PATH=${PATH}:${ANT_HOME}/bin:${JAVA_HOME}/bin:/usr/local/bin