Skip to content

Commit

Permalink
OPSEXP-2725 Add T-Engine LibreOffice image Dockerfile (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
pmacius authored Jul 31, 2024
1 parent 01d7e8d commit aec538c
Show file tree
Hide file tree
Showing 6 changed files with 108 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
*.amp
dist
*.jar
*.rpm
*.gz
30 changes: 29 additions & 1 deletion docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ group "ats" {
}

group "tengines" {
targets = ["tengine_imagemagick"]
targets = ["tengine_libreoffice", "tengine_imagemagick"]
}

variable "LABEL_VENDOR" {
Expand Down Expand Up @@ -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"]
}
33 changes: 33 additions & 0 deletions tengine/libreoffice/Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
20 changes: 20 additions & 0 deletions tengine/libreoffice/README.md
Original file line number Diff line number Diff line change
@@ -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.
22 changes: 22 additions & 0 deletions tengine/libreoffice/artifacts.json
Original file line number Diff line number Diff line change
@@ -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"
}
]
}
}
2 changes: 2 additions & 0 deletions tengine/libreoffice/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
exec java $JAVA_OPTS $JAVA_OPTS_CONTAINER_FLAGS -jar /opt/app.jar

0 comments on commit aec538c

Please sign in to comment.