From 395e0a6518d6a6ad31aa39e0a49f600fb8385bd1 Mon Sep 17 00:00:00 2001 From: pmacius Date: Mon, 29 Jul 2024 14:49:45 +0200 Subject: [PATCH] OPSEXP-2725 Add T-Engine LibreOffice image Dockerfile --- docker-bake.hcl | 34 +++++++++++++++++++++++++++++- scripts/fetch-artifact.sh | 2 +- tengine/libreoffice/Dockerfile | 32 ++++++++++++++++++++++++++++ tengine/libreoffice/artifacts.json | 22 +++++++++++++++++++ tengine/libreoffice/entrypoint.sh | 2 ++ 5 files changed, 90 insertions(+), 2 deletions(-) create mode 100644 tengine/libreoffice/Dockerfile create mode 100644 tengine/libreoffice/artifacts.json create mode 100755 tengine/libreoffice/entrypoint.sh diff --git a/docker-bake.hcl b/docker-bake.hcl index 146b2ee0..2fcd2f44 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -1,5 +1,5 @@ group "default" { - targets = ["content_service", "enterprise-search", "ats"] + targets = ["content_service", "enterprise-search", "ats", "tengines"] } group "content_service" { @@ -14,6 +14,10 @@ group "ats" { targets = ["ats_trouter", "ats_sfs"] } +group "tengines" { + targets = ["tengine_libreoffice"] +} + variable "LABEL_VENDOR" { default = "Hyland Software, Inc." } @@ -272,3 +276,31 @@ target "ats_sfs" { tags = ["localhost/alfresco-shared-file-store:latest"] output = ["type=docker"] } + +variable "ALFRESCO_LIBREOFFICE_USER_NAME" { + default = "libreoffice" +} + +variable "ALFRESCO_LIBREOFFICE_USER_ID" { + default = "33002" +} + +target "tengine_libreoffice" { + dockerfile = "./tengine/libreoffice/Dockerfile" + inherits = ["java_base"] + contexts = { + java_base = "target:java_base" + } + args = { + ALFRESCO_LIBREOFFICE_GROUP_NAME = "${ALFRESCO_GROUP_NAME}" + ALFRESCO_LIBREOFFICE_GROUP_ID = "${ALFRESCO_GROUP_ID}" + ALFRESCO_LIBREOFFICE_USER_NAME = "${ALFRESCO_LIBREOFFICE_USER_NAME}" + ALFRESCO_LIBREOFFICE_USER_ID = "${ALFRESCO_LIBREOFFICE_USER_ID}" + } + labels = { + "org.opencontainers.image.title" = "${PRODUCT_LINE} Transform Engine LibreOffice" + "org.opencontainers.image.description" = "Alfresco Transform Engine LibreOffice" + } + tags = ["localhost/alfresco-libreoffice:latest"] + output = ["type=docker"] +} diff --git a/scripts/fetch-artifact.sh b/scripts/fetch-artifact.sh index bdd062e7..9d8f783f 100755 --- a/scripts/fetch-artifact.sh +++ b/scripts/fetch-artifact.sh @@ -16,7 +16,7 @@ for i in $(find . -name artifacts.json -mindepth 2); do ARTIFACT_EXT=$(jq -r ".artifacts.acs${INDEX_KEY}[$j].classifier" $i) ARTIFACT_GROUP=$(jq -r ".artifacts.acs${INDEX_KEY}[$j].group" $i) ARTIFACT_PATH=$(jq -r ".artifacts.acs${INDEX_KEY}[$j].path" $i) - ARTIFACT_BASEURL="https://nexus.alfresco.com/nexus/service/local/repositories/${ARTIFACT_REPO}" + ARTIFACT_BASEURL="https://nexus.alfresco.com/nexus/service/local/repository/${ARTIFACT_REPO}" echo "Downloading $ARTIFACT_GROUP:$ARTIFACT_NAME $ARTIFACT_VERSION from $ARTIFACT_BASEURL" wget "${ARTIFACT_BASEURL}/${ARTIFACT_GROUP//\./\/}/${ARTIFACT_NAME}/${ARTIFACT_VERSION}/${ARTIFACT_NAME}-${ARTIFACT_VERSION}${ARTIFACT_EXT}" \ -O ${ARTIFACT_PATH}/${ARTIFACT_NAME}-${ARTIFACT_VERSION}${ARTIFACT_EXT} diff --git a/tengine/libreoffice/Dockerfile b/tengine/libreoffice/Dockerfile new file mode 100644 index 00000000..f7a287de --- /dev/null +++ b/tengine/libreoffice/Dockerfile @@ -0,0 +1,32 @@ +FROM java_base + +EXPOSE 8090 + +ENV JAVA_OPTS_CONTAINER_FLAGS=-XX:MaxRAMPercentage=80 +ENV LIBREOFFICE_COMMON_PATH=tengine/libreoffice + +ARG ALFRESCO_LIBREOFFICE_GROUP_NAME +ARG ALFRESCO_LIBREOFFICE_GROUP_ID +ARG ALFRESCO_LIBREOFFICE_USER_NAME +ARG ALFRESCO_LIBREOFFICE_USER_ID + +ADD ${LIBREOFFICE_COMMON_PATH}/alfresco-transform-libreoffice*.jar /usr/bin/app.jar +ADD ${LIBREOFFICE_COMMON_PATH}/libreoffice-dist*.gz libreoffice-dist.gz + +RUN yum install -y cairo cups-libs libSM libGLU && \ + tar xzf libreoffice-dist-linux.gz && \ + yum localinstall -y LibreOffice*/RPMS/*.rpm && \ + rm -rf libreoffice-dist-linux.gz LibreOffice_*_Linux_x86-64_rpm; \ + yum clean all + +RUN groupadd -g ${ALFRESCO_LIBREOFFICE_GROUP_ID} ${ALFRESCO_LIBREOFFICE_GROUP_NAME} && \ + useradd -u ${ALFRESCO_IMAGEMAGICK_USER_ID} -g ${ALFRESCO_LIBREOFFICE_GROUP_NAME} ${ALFRESCO_LIBREOFFICE_USER_NAME} && \ + chgrp ${ALFRESCO_LIBREOFFICE_GROUP_NAME} /usr/bin/app.jar + +USER ${ALFRESCO_LIBREOFFICE_USER_NAME} + +HEALTHCHECK --interval=20s --timeout=10s --retries=3 --start-period=30s \ + CMD curl -f http://localhost:8090/live || exit 1 + +COPY ${LIBREOFFICE_COMMON_PATH}/entrypoint.sh /entrypoint.sh +CMD ["/entrypoint.sh"] diff --git a/tengine/libreoffice/artifacts.json b/tengine/libreoffice/artifacts.json new file mode 100644 index 00000000..a1beec4d --- /dev/null +++ b/tengine/libreoffice/artifacts.json @@ -0,0 +1,22 @@ +{ + "artifacts": { + "acs23": [ + { + "name": "libreoffice-dist", + "version": "7.2.5", + "path": "tengine/libreoffice", + "classifier": "-linux.gz", + "repository": "thirdparty", + "group": "org.libreoffice" + }, + { + "name": "alfresco-transform-libreoffice", + "version": "5.1.3", + "path": "tengine/libreoffice", + "classifier": ".jar", + "repository": "releases", + "group": "org.alfresco" + } + ] + } +} diff --git a/tengine/libreoffice/entrypoint.sh b/tengine/libreoffice/entrypoint.sh new file mode 100755 index 00000000..158a2a1e --- /dev/null +++ b/tengine/libreoffice/entrypoint.sh @@ -0,0 +1,2 @@ +#!/bin/bash +exec java $JAVA_OPTS $JAVA_OPTS_CONTAINER_FLAGS -jar /opt/app.jar