From 70af9c12fc460b6c502ff28380429bb95d2eda95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Maciusiak?= <158472457+pmacius@users.noreply.github.com> Date: Mon, 5 Aug 2024 15:08:43 +0200 Subject: [PATCH] OPSEXP-2726 Add T-Engine Tika image Dockerfile (#18) --- .github/workflows/build_and_test.yml | 6 ++++++ .gitignore | 2 +- docker-bake.hcl | 32 ++++++++++++++++++++++++++-- tengine/imagemagick/Dockerfile | 4 ++-- tengine/imagemagick/entrypoint.sh | 2 +- tengine/libreoffice/Dockerfile | 4 ++-- tengine/tika/Dockerfile | 30 ++++++++++++++++++++++++++ tengine/tika/README.md | 22 +++++++++++++++++++ tengine/tika/artifacts.json | 14 ++++++++++++ tengine/tika/entrypoint.sh | 2 ++ test/helm/test-overrides.yaml | 13 ++++++----- 11 files changed, 118 insertions(+), 13 deletions(-) create mode 100644 tengine/tika/Dockerfile create mode 100644 tengine/tika/README.md create mode 100644 tengine/tika/artifacts.json create mode 100755 tengine/tika/entrypoint.sh diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 3d60c022..3a85dc99 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -37,6 +37,8 @@ jobs: - name: Checkout uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + - uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v5.34.0 + - name: Setup nexus authentication run: | echo "machine nexus.alfresco.com" >> ~/.netrc @@ -74,6 +76,10 @@ jobs: run: | docker save -o /tmp/${{ env.ARTIFACT_NAME }}.tar $(docker images --format "{{.Repository}}:{{.Tag}}" | grep alfresco) + - name: Check disk space + run: df -h + if: always() + - name: Upload images as artifact uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4 with: diff --git a/.gitignore b/.gitignore index 14d0d311..78355de2 100644 --- a/.gitignore +++ b/.gitignore @@ -4,5 +4,5 @@ dist *.jar *.rpm *.gz - +*.tgz test/helm/enterprise-integration-test-values.yaml diff --git a/docker-bake.hcl b/docker-bake.hcl index f48491e7..784b9592 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -15,7 +15,7 @@ group "ats" { } group "tengines" { - targets = ["tengine_libreoffice", "tengine_imagemagick"] + targets = ["tengine_libreoffice", "tengine_imagemagick", "tengine_tika"] } variable "LABEL_VENDOR" { @@ -310,7 +310,7 @@ variable "ALFRESCO_LIBREOFFICE_USER_NAME" { } variable "ALFRESCO_LIBREOFFICE_USER_ID" { - default = "33002" + default = "33003" } target "tengine_libreoffice" { @@ -332,3 +332,31 @@ target "tengine_libreoffice" { tags = ["localhost/alfresco-libreoffice:latest"] output = ["type=docker"] } + +variable "ALFRESCO_TIKA_USER_NAME" { + default = "tika" +} + +variable "ALFRESCO_TIKA_USER_ID" { + default = "33004" +} + +target "tengine_tika" { + dockerfile = "./tengine/tika/Dockerfile" + inherits = ["java_base"] + contexts = { + java_base = "target:java_base" + } + args = { + ALFRESCO_TIKA_GROUP_NAME = "${ALFRESCO_GROUP_NAME}" + ALFRESCO_TIKA_GROUP_ID = "${ALFRESCO_GROUP_ID}" + ALFRESCO_TIKA_USER_NAME = "${ALFRESCO_TIKA_USER_NAME}" + ALFRESCO_TIKA_USER_ID = "${ALFRESCO_TIKA_USER_ID}" + } + labels = { + "org.opencontainers.image.title" = "${PRODUCT_LINE} Transform Engine Tika" + "org.opencontainers.image.description" = "Alfresco Transform Engine Tika" + } + tags = ["localhost/alfresco-tika:latest"] + output = ["type=docker"] +} diff --git a/tengine/imagemagick/Dockerfile b/tengine/imagemagick/Dockerfile index 83c7ff0d..55c8dd13 100644 --- a/tengine/imagemagick/Dockerfile +++ b/tengine/imagemagick/Dockerfile @@ -11,7 +11,7 @@ ARG ALFRESCO_IMAGEMAGICK_GROUP_ID ARG ALFRESCO_IMAGEMAGICK_USER_NAME ARG ALFRESCO_IMAGEMAGICK_USER_ID -ADD ${IMAGEMAGICK_COMMON_PATH}/alfresco-transform-imagemagick*.jar /usr/bin/app.jar +ADD ${IMAGEMAGICK_COMMON_PATH}/alfresco-transform-imagemagick*.jar /opt/app.jar ADD ${IMAGEMAGICK_COMMON_PATH}/imagemagick-distribution*-el9.rpm /tmp/imagemagick-distribution-el9.rpm ADD ${IMAGEMAGICK_COMMON_PATH}/libs/imagemagick-distribution*-libs-el9.rpm /tmp/imagemagick-distribution-libs-el9.rpm @@ -21,7 +21,7 @@ RUN yum install -y $IMAGEMAGICK_DEP_RPM_URL && \ RUN groupadd -g ${ALFRESCO_IMAGEMAGICK_GROUP_ID} ${ALFRESCO_IMAGEMAGICK_GROUP_NAME} && \ useradd -u ${ALFRESCO_IMAGEMAGICK_USER_ID} -g ${ALFRESCO_IMAGEMAGICK_GROUP_NAME} ${ALFRESCO_IMAGEMAGICK_USER_NAME} && \ - chgrp ${ALFRESCO_IMAGEMAGICK_GROUP_NAME} /usr/bin/app.jar + chgrp ${ALFRESCO_IMAGEMAGICK_GROUP_NAME} /opt/app.jar USER ${ALFRESCO_IMAGEMAGICK_USER_NAME} diff --git a/tengine/imagemagick/entrypoint.sh b/tengine/imagemagick/entrypoint.sh index 9837e5a3..1f50ab1c 100755 --- a/tengine/imagemagick/entrypoint.sh +++ b/tengine/imagemagick/entrypoint.sh @@ -1,3 +1,3 @@ #!/bin/bash -exec java $JAVA_OPTS $JAVA_OPTS_CONTAINER_FLAGS -jar /usr/bin/app.jar +exec java $JAVA_OPTS $JAVA_OPTS_CONTAINER_FLAGS -jar /opt/app.jar diff --git a/tengine/libreoffice/Dockerfile b/tengine/libreoffice/Dockerfile index d493ba41..1a262cca 100644 --- a/tengine/libreoffice/Dockerfile +++ b/tengine/libreoffice/Dockerfile @@ -18,11 +18,11 @@ RUN --mount=type=bind,source=${LIBREOFFICE_COMMON_PATH},target=/dist \ rm -rf /tmp/dist && \ yum clean all -ADD ${LIBREOFFICE_COMMON_PATH}/alfresco-transform-libreoffice*.jar /usr/bin/app.jar +ADD ${LIBREOFFICE_COMMON_PATH}/alfresco-transform-libreoffice*.jar /opt/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 + chgrp ${ALFRESCO_LIBREOFFICE_GROUP_NAME} /opt/app.jar USER ${ALFRESCO_LIBREOFFICE_USER_NAME} diff --git a/tengine/tika/Dockerfile b/tengine/tika/Dockerfile new file mode 100644 index 00000000..84b96bdd --- /dev/null +++ b/tengine/tika/Dockerfile @@ -0,0 +1,30 @@ +FROM java_base + +ENV JAVA_OPTS_CONTAINER_FLAGS=-XX:MaxRAMPercentage=80 +ENV TIKA_COMMON_PATH=tengine/tika +ENV TIKA_DEP_RPM_URL=https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm + +EXPOSE 8090 + +ARG ALFRESCO_TIKA_GROUP_NAME +ARG ALFRESCO_TIKA_GROUP_ID +ARG ALFRESCO_TIKA_USER_NAME +ARG ALFRESCO_TIKA_USER_ID + +RUN yum install -y ${TIKA_DEP_RPM_URL} && \ + yum -y install perl-Image-ExifTool && \ + yum clean all + +ADD ${TIKA_COMMON_PATH}/alfresco-transform-tika*.jar /opt/app.jar + +RUN groupadd -g ${ALFRESCO_TIKA_GROUP_ID} ${ALFRESCO_TIKA_GROUP_NAME} && \ + useradd -u ${ALFRESCO_TIKA_USER_ID} -g ${ALFRESCO_TIKA_GROUP_NAME} ${ALFRESCO_TIKA_USER_NAME} && \ + chgrp ${ALFRESCO_TIKA_GROUP_NAME} /opt/app.jar + +USER ${ALFRESCO_TIKA_USER_NAME} + +HEALTHCHECK --interval=20s --timeout=10s --retries=3 --start-period=30s \ + CMD curl -f http://localhost:8090/live || exit 1 + +COPY ${TIKA_COMMON_PATH}/entrypoint.sh /entrypoint.sh +CMD ["/entrypoint.sh"] diff --git a/tengine/tika/README.md b/tengine/tika/README.md new file mode 100644 index 00000000..203782f2 --- /dev/null +++ b/tengine/tika/README.md @@ -0,0 +1,22 @@ +# Runtime variables + +Sets of variables configurable with your docker image + +## tika + +```yaml + +transform-core-tika: + image: localhost/alfresco-tika:YOUR-TAG + environment: + JAVA_OPTS: + ACTIVEMQ_URL: nio://activemq:61616 + ACTIVEMQ_USER: admin + ACTIVEMQ_PASSWORD: admin + 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/tika/artifacts.json b/tengine/tika/artifacts.json new file mode 100644 index 00000000..452776ac --- /dev/null +++ b/tengine/tika/artifacts.json @@ -0,0 +1,14 @@ +{ + "artifacts": { + "acs23": [ + { + "name": "alfresco-transform-tika", + "version": "5.1.3", + "path": "tengine/tika", + "classifier": ".jar", + "repository": "releases", + "group": "org.alfresco" + } + ] + } +} diff --git a/tengine/tika/entrypoint.sh b/tengine/tika/entrypoint.sh new file mode 100755 index 00000000..158a2a1e --- /dev/null +++ b/tengine/tika/entrypoint.sh @@ -0,0 +1,2 @@ +#!/bin/bash +exec java $JAVA_OPTS $JAVA_OPTS_CONTAINER_FLAGS -jar /opt/app.jar diff --git a/test/helm/test-overrides.yaml b/test/helm/test-overrides.yaml index 8a279185..7ada7d0d 100644 --- a/test/helm/test-overrides.yaml +++ b/test/helm/test-overrides.yaml @@ -24,11 +24,14 @@ alfresco-transform-service: image: repository: localhost/alfresco-imagemagick tag: latest - #libreoffice: - #image: - # repository: localhost/alfresco-libreoffice - # tag: latest - #tika: + # libreoffice: + # image: + # repository: localhost/alfresco-libreoffice + # tag: latest + tika: + image: + repository: localhost/alfresco-tika + tag: latest #transformmisc: transformrouter: image: