Skip to content

Commit

Permalink
leverage TARGETARCH builtin ARG to install the right package
Browse files Browse the repository at this point in the history
  • Loading branch information
alxgomz committed Sep 3, 2024
1 parent 0a3c217 commit e540681
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
6 changes: 4 additions & 2 deletions tengine/aio/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,20 @@ 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' ] && PKGARCH='-aarch64'; \
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 install -y /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 https://dl.fedoraproject.org/pub/epel/epel-release-latest-${DISTRIB_MAJOR}.noarch.rpm && \
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

Expand Down
15 changes: 9 additions & 6 deletions tengine/imagemagick/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,17 @@ 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

RUN yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-${DISTRIB_MAJOR}.noarch.rpm; \
yum install -y /tmp/imagemagick-distribution-el9.rpm /tmp/imagemagick-distribution-libs-el9.rpm; \
yum clean all
ADD imagemagick-distribution*-el${DISTRIB_MAJOR}*.rpm /tmp/
ADD libs/imagemagick-distribution*-libs-el${DISTRIB_MAJOR}*.rpm /tmp/

RUN [ "$TARGETARCH" == 'arm64' ] && PKGARCH='-aarch64'; \
yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-${DISTRIB_MAJOR}.noarch.rpm; \
yum localinstall -y /tmp/imagemagick-distribution-*-el${DISTRIB_MAJOR}${PKGARCH}.rpm /tmp/imagemagick-distribution-*-libs-el${DISTRIB_MAJOR}${PKG_ARCH}.rpm; \
yum clean all && rm -rf /var/cache/yum; \
rm -f /tmp/*.rpm

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} && \
Expand Down

0 comments on commit e540681

Please sign in to comment.