diff --git a/docker-bake.hcl b/docker-bake.hcl index 2fcd2f44..f48491e7 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -15,7 +15,7 @@ group "ats" { } group "tengines" { - targets = ["tengine_libreoffice"] + targets = ["tengine_libreoffice", "tengine_imagemagick"] } variable "LABEL_VENDOR" { @@ -277,6 +277,34 @@ target "ats_sfs" { output = ["type=docker"] } +variable "ALFRESCO_IMAGEMAGICK_USER_NAME" { + default = "imagemagick" +} + +variable "ALFRESCO_IMAGEMAGICK_USER_ID" { + default = "33002" +} + +target "tengine_imagemagick" { + dockerfile = "./tengine/imagemagick/Dockerfile" + inherits = ["java_base"] + contexts = { + java_base = "target:java_base" + } + args = { + ALFRESCO_IMAGEMAGICK_GROUP_NAME = "${ALFRESCO_GROUP_NAME}" + ALFRESCO_IMAGEMAGICK_GROUP_ID = "${ALFRESCO_GROUP_ID}" + ALFRESCO_IMAGEMAGICK_USER_NAME = "${ALFRESCO_IMAGEMAGICK_USER_NAME}" + ALFRESCO_IMAGEMAGICK_USER_ID = "${ALFRESCO_IMAGEMAGICK_USER_ID}" + } + labels = { + "org.opencontainers.image.title" = "${PRODUCT_LINE} Transform Engine Imagemagick" + "org.opencontainers.image.description" = "Alfresco Transform Engine Imagemagick" + } + tags = ["localhost/alfresco-imagemagick:latest"] + output = ["type=docker"] +} + variable "ALFRESCO_LIBREOFFICE_USER_NAME" { default = "libreoffice" } diff --git a/scripts/fetch-artifact.sh b/scripts/fetch-artifact.sh index 9d8f783f..dd7cff59 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/repository/${ARTIFACT_REPO}" + ARTIFACT_BASEURL="https://nexus.alfresco.com/nexus/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/imagemagick/Dockerfile b/tengine/imagemagick/Dockerfile new file mode 100644 index 00000000..83c7ff0d --- /dev/null +++ b/tengine/imagemagick/Dockerfile @@ -0,0 +1,32 @@ +FROM java_base + +EXPOSE 8090 + +ENV JAVA_OPTS_CONTAINER_FLAGS=-XX:MaxRAMPercentage=80 +ENV IMAGEMAGICK_DEP_RPM_URL=https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm +ENV IMAGEMAGICK_COMMON_PATH=tengine/imagemagick + +ARG ALFRESCO_IMAGEMAGICK_GROUP_NAME +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}/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 + +RUN yum install -y $IMAGEMAGICK_DEP_RPM_URL && \ + yum install -y /tmp/imagemagick-distribution-el9.rpm /tmp/imagemagick-distribution-libs-el9.rpm; \ + yum clean all + +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 + +USER ${ALFRESCO_IMAGEMAGICK_USER_NAME} + +HEALTHCHECK --interval=20s --timeout=10s --retries=3 --start-period=30s \ + CMD curl -f http://localhost:8090/live || exit 1 + +COPY ${IMAGEMAGICK_COMMON_PATH}/entrypoint.sh /entrypoint.sh +CMD ["/entrypoint.sh"] diff --git a/tengine/imagemagick/README.md b/tengine/imagemagick/README.md new file mode 100644 index 00000000..db161058 --- /dev/null +++ b/tengine/imagemagick/README.md @@ -0,0 +1,20 @@ +# Runtime variables + +Sets of variables configurable with your docker image + +## imagemagick + +```yaml + +transform-core-imagemagick: + image: localhost/alfresco-imagemagick: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/imagemagick/artifacts.json b/tengine/imagemagick/artifacts.json new file mode 100644 index 00000000..047e1279 --- /dev/null +++ b/tengine/imagemagick/artifacts.json @@ -0,0 +1,30 @@ +{ + "artifacts": { + "acs23": [ + { + "name": "imagemagick-distribution", + "version": "7.1.0-16-ci-10", + "path": "tengine/imagemagick/libs", + "classifier": "-libs-el9.rpm", + "repository": "thirdparty", + "group": "org.imagemagick" + }, + { + "name": "imagemagick-distribution", + "version": "7.1.0-16-ci-10", + "path": "tengine/imagemagick", + "classifier": "-el9.rpm", + "repository": "thirdparty", + "group": "org.imagemagick" + }, + { + "name": "alfresco-transform-imagemagick", + "version": "5.1.3", + "path": "tengine/imagemagick", + "classifier": ".jar", + "repository": "releases", + "group": "org.alfresco" + } + ] + } +} diff --git a/tengine/imagemagick/entrypoint.sh b/tengine/imagemagick/entrypoint.sh new file mode 100755 index 00000000..9837e5a3 --- /dev/null +++ b/tengine/imagemagick/entrypoint.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +exec java $JAVA_OPTS $JAVA_OPTS_CONTAINER_FLAGS -jar /usr/bin/app.jar diff --git a/tengine/imagemagick/libs/README.md b/tengine/imagemagick/libs/README.md new file mode 100644 index 00000000..117ba5d4 --- /dev/null +++ b/tengine/imagemagick/libs/README.md @@ -0,0 +1,3 @@ +This directory contains ImageMagick distribution libs artifacts. This ensures +that the Dockerfile adds the correct artifacts without specifying hardcoded +names. 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.