Skip to content

Commit

Permalink
OPSEXP-2798: add ARM support for imagemagick tengine (#40)
Browse files Browse the repository at this point in the history
Co-authored-by: Giovanni Toraldo <[email protected]>
  • Loading branch information
alxgomz and gionn authored Sep 4, 2024
1 parent 7e6ebd1 commit 9bddd5f
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 38 deletions.
8 changes: 0 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,6 @@ connectors: prepare_connectors
@echo "Building Connectors images"
@docker buildx bake --no-cache --progress=plain connectors

amd64_all: docker-bake.hcl prepare_all
@echo "Building all images for amd64"
@docker buildx bake --no-cache --progress=plain --set *.platform=linux/amd64

arm64_all: docker-bake.hcl prepare_all
@echo "Building all images for arm64"
@docker buildx bake --no-cache --progress=plain --set *.platform=linux/arm64

all: docker-bake.hcl prepare_all
@echo "Building all images"
@docker buildx bake --no-cache --progress=plain
Expand Down
19 changes: 9 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Alfresco Docker images builder
# Alfresco Docker images builder

This projects aims at providing a quick and easy to build and maintain Alfresco
Docker images.
Expand Down Expand Up @@ -26,7 +26,7 @@ If you want to build a specific image, you can run one of the following make tar

* repo: build the Alfresco Content Repository image
* search_enterprise: build the Alfresco Search Enterprise images
* ats: build the Alfresco Transformation Service images
* ats: build the Alfresco Transformation Service images

## Customizing the images

Expand All @@ -35,24 +35,23 @@ If you want to build a specific image, you can run one of the following make tar
The Alfresco Content Repository image can be customized by adding different
types of files in the right locations:

* Alfresco Module Packages (AMPs) files in the [amps](repository/amps/README.md) folder
* Alfresco Module Packages (AMPs) files in the [amps](repository/amps/README.md)
folder
* Additional JAR files for the JRE in the [libs](repository/libs/README.md) folder

## Architecture choice

The image architecture defaults to the building system's architecture. To modify
it, you need to adjust variable when running bake command.
it, you need to adjust an environment variable when running bake command.

```sh

docker buildx bake --set *.platform=linux/arm64

export TARGETARCH=linux/arm64
docker buildx bake
```

To build just a specific image use e.g.:

```sh

docker buildx bake --set java_base.platform=linux/amd64 java_base

export TARGETARCH=linux/arm64
docker buildx bake tengine_imagemagick
```
17 changes: 17 additions & 0 deletions docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ variable "REGISTRY_NAMESPACE" {
default = "alfresco"
}

variable "TARGETARCH" {
default = ""
}

variable "TAG" {
default = "latest"
}
Expand Down Expand Up @@ -135,6 +139,7 @@ target "java_base" {
}
tags = ["${REGISTRY}/${REGISTRY_NAMESPACE}/alfresco-base-java:${JDIST}${JAVA_MAJOR}-${DISTRIB_NAME}${DISTRIB_MAJOR}"]
output = ["type=cacheonly"]
platforms = split(",", "${TARGETARCH}")
}

variable "TOMCAT_MAJOR" {
Expand Down Expand Up @@ -199,6 +204,7 @@ target "repository" {
}
tags = ["${REGISTRY}/${REGISTRY_NAMESPACE}/alfresco-content-repository:${TAG}"]
output = ["type=docker"]
platforms = split(",", "${TARGETARCH}")
}

target "search_liveindexing" {
Expand Down Expand Up @@ -238,6 +244,7 @@ target "search_liveindexing" {
}
tags = ["${REGISTRY}/${REGISTRY_NAMESPACE}/${liveindexing.artifact}:${TAG}"]
output = ["type=docker"]
platforms = split(",", "${TARGETARCH}")
}

variable "ALFRESCO_TROUTER_USER_NAME" {
Expand Down Expand Up @@ -267,6 +274,7 @@ target "ats_trouter" {
}
tags = ["${REGISTRY}/${REGISTRY_NAMESPACE}/alfresco-transform-router:${TAG}"]
output = ["type=docker"]
platforms = split(",", "${TARGETARCH}")
}

variable "ALFRESCO_SFS_USER_NAME" {
Expand Down Expand Up @@ -296,6 +304,7 @@ target "ats_sfs" {
}
tags = ["${REGISTRY}/${REGISTRY_NAMESPACE}/alfresco-shared-file-store:${TAG}"]
output = ["type=docker"]
platforms = split(",", "${TARGETARCH}")
}

variable "ALFRESCO_IMAGEMAGICK_USER_NAME" {
Expand Down Expand Up @@ -325,6 +334,7 @@ target "tengine_imagemagick" {
}
tags = ["${REGISTRY}/${REGISTRY_NAMESPACE}/alfresco-imagemagick:${TAG}"]
output = ["type=docker"]
platforms = split(",", "${TARGETARCH}")
}

variable "ALFRESCO_LIBREOFFICE_USER_NAME" {
Expand Down Expand Up @@ -354,6 +364,7 @@ target "tengine_libreoffice" {
}
tags = ["${REGISTRY}/${REGISTRY_NAMESPACE}/alfresco-libreoffice:${TAG}"]
output = ["type=docker"]
platforms = [ "linux/amd64" ]
}

variable "ALFRESCO_MISC_USER_NAME" {
Expand Down Expand Up @@ -383,6 +394,7 @@ target "tengine_misc" {
}
tags = ["${REGISTRY}/${REGISTRY_NAMESPACE}/alfresco-misc:${TAG}"]
output = ["type=docker"]
platforms = split(",", "${TARGETARCH}")
}

variable "ALFRESCO_TIKA_USER_NAME" {
Expand Down Expand Up @@ -412,6 +424,7 @@ target "tengine_tika" {
}
tags = ["${REGISTRY}/${REGISTRY_NAMESPACE}/alfresco-tika:${TAG}"]
output = ["type=docker"]
platforms = split(",", "${TARGETARCH}")
}

variable "ALFRESCO_PDFRENDERER_USER_NAME" {
Expand Down Expand Up @@ -441,6 +454,7 @@ target "tengine_pdfrenderer" {
}
tags = ["${REGISTRY}/${REGISTRY_NAMESPACE}/alfresco-pdf-renderer:${TAG}"]
output = ["type=docker"]
platforms = split(",", "${TARGETARCH}")
}

variable "ALFRESCO_AIO_USER_NAME" {
Expand Down Expand Up @@ -470,6 +484,7 @@ target "tengine_aio" {
}
tags = ["${REGISTRY}/${REGISTRY_NAMESPACE}/alfresco-transform-core-aio:${TAG}"]
output = ["type=docker"]
platforms = [ "linux/amd64" ]
}

variable "ALFRESCO_MSTEAMS_USER_NAME" {
Expand Down Expand Up @@ -499,6 +514,7 @@ target "connector_msteams" {
}
tags = ["${REGISTRY}/${REGISTRY_NAMESPACE}/alfresco-ms-teams-service:${TAG}"]
output = ["type=docker"]
platforms = split(",", "${TARGETARCH}")
}

variable "ALFRESCO_MS365_USER_NAME" {
Expand Down Expand Up @@ -528,4 +544,5 @@ target "connector_ms365" {
}
tags = ["${REGISTRY}/${REGISTRY_NAMESPACE}/alfresco-ooi-service:${TAG}"]
output = ["type=docker"]
platforms = split(",", "${TARGETARCH}")
}
20 changes: 9 additions & 11 deletions tengine/aio/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,30 @@ FROM java_base

ENV JAVA_OPTS_CONTAINER_FLAGS=-XX:MaxRAMPercentage=80

ENV COMMON_PATH=tengine
ENV EPEL_DEP_RPM_URL=https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm

EXPOSE 8090

ARG ALFRESCO_AIO_GROUP_NAME
ARG ALFRESCO_AIO_GROUP_ID
ARG ALFRESCO_AIO_USER_NAME
ARG ALFRESCO_AIO_USER_ID
ARG DISTRIB_MAJOR
ARG TARGETARCH

RUN --mount=type=bind,source=/,target=/dist \
[ "$TARGETARCH" == 'arm64' ] && export PKGARCH='-aarch64'; \
yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-${DISTRIB_MAJOR}.noarch.rpm && \
yum install -y cairo cups-libs libSM libGLU perl-Image-ExifTool && \
mkdir /tmp/dist && \
tar xzf /dist/libreoffice/*.gz -C /tmp/dist && \
yum localinstall -y /tmp/dist/LibreOffice*/RPMS/*.rpm && \
yum install -y cairo cups-libs libSM libGLU && \
yum install -y /dist/imagemagick/imagemagick-distribution*-el9.rpm /dist/imagemagick/libs/imagemagick-distribution*-libs-el9.rpm && \
yum localinstall -y /tmp/dist/LibreOffice*/RPMS/*.rpm /dist/imagemagick/imagemagick-distribution*-el${DISTRIB_MAJOR}${PKGARCH}.rpm /dist/imagemagick/libs/imagemagick-distribution*-libs-el${DISTRIB_MAJOR}${PKGARCH}.rpm && \
tar xzf /dist/pdfrenderer/*.tgz -C /usr/bin && \
yum install -y ${EPEL_DEP_RPM_URL} && \
yum -y install perl-Image-ExifTool && \
rm -rf /tmp/dist && \
yum clean all
yum clean all && rm -rf /var/cache/yum

ADD aio/alfresco-transform-core-aio*.jar /opt/app.jar
COPY aio/alfresco-transform-core-aio*.jar /opt/app.jar

RUN groupadd -g ${ALFRESCO_AIO_GROUP_ID} ${ALFRESCO_AIO_GROUP_NAME} && \
useradd -u ${ALFRESCO_AIO_USER_ID} -g ${ALFRESCO_AIO_GROUP_NAME} ${ALFRESCO_AIO_USER_NAME} && \
useradd -lu ${ALFRESCO_AIO_USER_ID} -g ${ALFRESCO_AIO_GROUP_NAME} ${ALFRESCO_AIO_USER_NAME} && \
chgrp ${ALFRESCO_AIO_GROUP_NAME} /opt/app.jar

USER ${ALFRESCO_AIO_USER_NAME}
Expand Down
17 changes: 9 additions & 8 deletions tengine/imagemagick/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,24 @@ 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-9.noarch.rpm

ARG ALFRESCO_IMAGEMAGICK_GROUP_NAME
ARG ALFRESCO_IMAGEMAGICK_GROUP_ID
ARG ALFRESCO_IMAGEMAGICK_USER_NAME
ARG ALFRESCO_IMAGEMAGICK_USER_ID
ARG DISTRIB_MAJOR
ARG TARGETARCH

ADD alfresco-transform-imagemagick*.jar /opt/app.jar
ADD imagemagick-distribution*-el9.rpm /tmp/imagemagick-distribution-el9.rpm
ADD libs/imagemagick-distribution*-libs-el9.rpm /tmp/imagemagick-distribution-libs-el9.rpm
COPY alfresco-transform-imagemagick*.jar /opt/app.jar

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 --mount=type=bind,source=/,target=/dist \
[ "$TARGETARCH" == 'arm64' ] && export PKGARCH='-aarch64'; \
yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-${DISTRIB_MAJOR}.noarch.rpm; \
yum localinstall -y /dist/imagemagick-distribution-*-el${DISTRIB_MAJOR}${PKGARCH}.rpm /dist/libs/imagemagick-distribution-*-libs-el${DISTRIB_MAJOR}${PKGARCH}.rpm; \
yum clean all && rm -rf /var/cache/yum

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} && \
useradd -lu ${ALFRESCO_IMAGEMAGICK_USER_ID} -g ${ALFRESCO_IMAGEMAGICK_GROUP_NAME} ${ALFRESCO_IMAGEMAGICK_USER_NAME} && \
chgrp ${ALFRESCO_IMAGEMAGICK_GROUP_NAME} /opt/app.jar

USER ${ALFRESCO_IMAGEMAGICK_USER_NAME}
Expand Down
18 changes: 17 additions & 1 deletion tengine/imagemagick/artifacts.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,30 @@
"repository": "thirdparty",
"group": "org.imagemagick"
},
{
"name": "imagemagick-distribution",
"version": "7.1.0-16-ci-10",
"path": "tengine/imagemagick/libs",
"classifier": "-libs-el9-aarch64.rpm",
"repository": "thirdparty",
"group": "org.imagemagick"
},
{
"name": "imagemagick-distribution",
"version": "7.1.0-16-ci-10",
"path": "tengine/imagemagick",
"classifier": "-el9-aarch64.rpm",
"repository": "thirdparty",
"group": "org.imagemagick"
},
{
"name": "alfresco-transform-imagemagick",
"version": "5.1.3",
"path": "tengine/imagemagick",
"classifier": ".jar",
"repository": "releases",
"group": "org.alfresco"
}
}
]
}
}

0 comments on commit 9bddd5f

Please sign in to comment.