From aec538cb45253e81fd1231eedd3dd237c854ceba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Maciusiak?= <158472457+pmacius@users.noreply.github.com> Date: Wed, 31 Jul 2024 09:25:49 +0200 Subject: [PATCH] OPSEXP-2725 Add T-Engine LibreOffice image Dockerfile (#12) --- .gitignore | 2 ++ docker-bake.hcl | 30 ++++++++++++++++++++++++++- tengine/libreoffice/Dockerfile | 33 ++++++++++++++++++++++++++++++ tengine/libreoffice/README.md | 20 ++++++++++++++++++ tengine/libreoffice/artifacts.json | 22 ++++++++++++++++++++ tengine/libreoffice/entrypoint.sh | 2 ++ 6 files changed, 108 insertions(+), 1 deletion(-) create mode 100644 tengine/libreoffice/Dockerfile create mode 100644 tengine/libreoffice/README.md create mode 100644 tengine/libreoffice/artifacts.json create mode 100755 tengine/libreoffice/entrypoint.sh diff --git a/.gitignore b/.gitignore index a7a646ee..fa16c20d 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ *.amp dist *.jar +*.rpm +*.gz diff --git a/docker-bake.hcl b/docker-bake.hcl index 2ac24449..f48491e7 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -15,7 +15,7 @@ group "ats" { } group "tengines" { - targets = ["tengine_imagemagick"] + targets = ["tengine_libreoffice", "tengine_imagemagick"] } variable "LABEL_VENDOR" { @@ -304,3 +304,31 @@ target "tengine_imagemagick" { tags = ["localhost/alfresco-imagemagick: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/tengine/libreoffice/Dockerfile b/tengine/libreoffice/Dockerfile new file mode 100644 index 00000000..d493ba41 --- /dev/null +++ b/tengine/libreoffice/Dockerfile @@ -0,0 +1,33 @@ +FROM java_base + +ENV LIBREOFFICE_COMMON_PATH=tengine/libreoffice +ENV JAVA_OPTS_CONTAINER_FLAGS=-XX:MaxRAMPercentage=80 + +EXPOSE 8090 + +ARG ALFRESCO_LIBREOFFICE_GROUP_NAME +ARG ALFRESCO_LIBREOFFICE_GROUP_ID +ARG ALFRESCO_LIBREOFFICE_USER_NAME +ARG ALFRESCO_LIBREOFFICE_USER_ID + +RUN --mount=type=bind,source=${LIBREOFFICE_COMMON_PATH},target=/dist \ + mkdir /tmp/dist && \ + tar xzf /dist/*.gz -C /tmp/dist && \ + yum localinstall -y /tmp/dist/LibreOffice*/RPMS/*.rpm && \ + yum install -y cairo cups-libs libSM libGLU && \ + rm -rf /tmp/dist && \ + yum clean all + +ADD ${LIBREOFFICE_COMMON_PATH}/alfresco-transform-libreoffice*.jar /usr/bin/app.jar + +RUN groupadd -g ${ALFRESCO_LIBREOFFICE_GROUP_ID} ${ALFRESCO_LIBREOFFICE_GROUP_NAME} && \ + useradd -u ${ALFRESCO_LIBREOFFICE_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/README.md b/tengine/libreoffice/README.md new file mode 100644 index 00000000..35c66140 --- /dev/null +++ b/tengine/libreoffice/README.md @@ -0,0 +1,20 @@ +# Runtime variables + +Sets of variables configurable with your docker image + +## libreoffice + +```yaml + +transform-core-libreoffice: + image: localhost/alfresco-libreoffice:YOUR-TAG + environment: + JAVA_OPTS: + ACTIVEMQ_URL: nio://activemq:61616 + FILE_STORE_URL: http://shared-file-store:8099/alfresco/api/-default-/private/sfs/versions/1/file + +``` + +- `JAVA_OPTS` - Additional java options +- `ACTIVEMQ_URL` - The URL for Alfresco ActiveMQ. +- `FILE_STORE_URL` - Alfresco Shared FileStore endpoint. 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