55# of both the ege-webclient and the TEIGarage (backend),
66# and installs it in a Tomcat application server
77# ########################################
8- FROM tomcat:7
8+ FROM tomcat:9-jdk11-openjdk
99
1010LABEL org.opencontainers.image.source=https://github.com/teic/teigarage
1111
12+ ARG VERSION_STYLESHEET=latest
13+ ARG VERSION_ODD=latest
14+ ARG WEBSERVICE_ARTIFACT=https://nightly.link/TEIC/TEIGarage/workflows/maven_docker/dev/artifact.zip
15+ ARG WEBCLIENT_ARTIFACT=https://nightly.link/TEIC/ege-webclient/workflows/maven/main/artifact.zip
16+ ARG BUILDTYPE=local
17+
1218ENV CATALINA_WEBAPPS ${CATALINA_HOME}/webapps
1319ENV OFFICE_HOME /usr/lib/libreoffice
14- ENV STYLESHEETS_HOME /usr/share/xml/tei
20+ ENV TEI_SOURCES_HOME /usr/share/xml/tei
1521
1622USER root:root
1723
1824RUN apt-get update \
19- && apt-get install -y libreoffice \
20- ttf -dejavu \
25+ && apt-get install --no-install-recommends - y libreoffice \
26+ fonts -dejavu \
2127 fonts-arphic-ukai \
2228 fonts-arphic-uming \
2329 fonts-baekmuk \
@@ -27,23 +33,18 @@ RUN apt-get update \
2733 fonts-ipafont-mincho \
2834 cmake \
2935 build-essential \
30- libgcc-8 -dev \
36+ libgcc-10 -dev \
3137 librsvg2-bin \
38+ curl \
3239 && ln -s ${OFFICE_HOME} /usr/lib/openoffice \
33- && rm -rf /var/lib/apt/lists/* \
34- && mkdir -p ${STYLESHEETS_HOME}
40+ && rm -rf /var/lib/apt/lists/*
3541
3642# entrypoint script
3743COPY docker-entrypoint.sh /my-docker-entrypoint.sh
3844
3945# log4j.xml configuration
4046COPY log4j.xml /var/cache/oxgarage/log4j.xml
4147
42- # download artifacts to /tmp
43- # these war-files are zipped so we need to unzip them twice at the next stage
44- ADD https://nightly.link/TEIC/TEIGarage/workflows/maven/main/artifact.zip /tmp/teigarage.zip
45- ADD https://nightly.link/TEIC/ege-webclient/workflows/maven/main/artifact.zip /tmp/webservice.zip
46-
4748# we could download the artifacts directly from GitHub but then
4849# we would need to pass in secrets since the GitHub API does not allow
4950# anonyous access. The following code is only for reference:
@@ -53,24 +54,50 @@ ADD https://nightly.link/TEIC/ege-webclient/workflows/maven/main/artifact.zip /t
5354# && unzip /tmp/teigarage.zip -d /tmp/ \
5455# && unzip /tmp/webservice.zip -d /tmp/
5556
56- # download TEI resources to /tmp
57- ADD https://github.com/TEIC/Stylesheets/releases/download/v7.52.0/tei-xsl-7.52.0.zip /tmp/stylesheet.zip
58- ADD https://github.com/TEIC/TEI/releases/download/P5_Release_4.3.0/tei-4.3.0.zip /tmp/odd.zip
57+ # download artifacts to /tmp and deploy them at ${CATALINA_WEBAPPS}
58+ # these war-files are zipped so we need to unzip them twice
59+ # conditional copy in docker needs a strange hack
60+ COPY log4j.xml artifact/teigarage.wa[r] /tmp/
5961
60- # unzip TEI resources and move them to correct folder
61- RUN unzip -q /tmp/stylesheet.zip -d ${STYLESHEETS_HOME}/stylesheet \
62- && unzip -q /tmp/odd.zip -d ${STYLESHEETS_HOME}/odd
63-
64- RUN rm -Rf ${CATALINA_WEBAPPS}/ROOT \
65- && unzip -q /tmp/webservice.zip -d /tmp/ \
66- && unzip -q /tmp/teigarage.zip -d /tmp/ \
67- && unzip -q /tmp/ege-webclient.war -d ${CATALINA_WEBAPPS}/ROOT/ \
62+ RUN if [ "$BUILDTYPE" = "local" ] ; then \
63+ curl -Ls ${WEBSERVICE_ARTIFACT} -o /tmp/teigarage.zip \
64+ && unzip -o -q /tmp/teigarage.zip -d /tmp/; \
65+ fi \
6866 && unzip -q /tmp/teigarage.war -d ${CATALINA_WEBAPPS}/ege-webservice/ \
67+ && rm -Rf ${CATALINA_WEBAPPS}/ROOT \
68+ && curl -Ls ${WEBCLIENT_ARTIFACT} -o /tmp/webclient.zip \
69+ && unzip -q /tmp/webclient.zip -d /tmp/ \
70+ && unzip -q /tmp/ege-webclient.war -d ${CATALINA_WEBAPPS}/ROOT/ \
6971 && cp ${CATALINA_WEBAPPS}/ege-webservice/WEB-INF/lib/oxgarage.properties /etc/ \
70- && rm /tmp/*.war \
71- && rm /tmp/*.zip \
72+ && rm -f /tmp/*.war \
73+ && rm -f /tmp/*.zip \
7274 && chmod 755 /my-docker-entrypoint.sh
7375
76+ # check if the version of stylesheet version is supplied, if not find out latest version
77+ RUN if [ "$VERSION_STYLESHEET" = "latest" ] ; then \
78+ VERSION_STYLESHEET=$(curl "https://api.github.com/repos/TEIC/Stylesheets/releases/latest" | grep -Po '"tag_name": "v\K .*?(?=")' ); \
79+ fi \
80+ && echo "Stylesheet version set to ${VERSION_STYLESHEET}" \
81+ # download the required tei odd and stylesheet sources in the image and move them to the respective folders (${TEI_SOURCES_HOME})
82+ && curl -s -L -o /tmp/stylesheet.zip https://github.com/TEIC/Stylesheets/releases/download/v${VERSION_STYLESHEET}/tei-xsl-${VERSION_STYLESHEET}.zip \
83+ && unzip /tmp/stylesheet.zip -d /tmp/stylesheet \
84+ && rm /tmp/stylesheet.zip \
85+ && mkdir -p ${TEI_SOURCES_HOME}/stylesheet \
86+ && cp -r /tmp/stylesheet/xml/tei/stylesheet/* ${TEI_SOURCES_HOME}/stylesheet \
87+ && rm -r /tmp/stylesheet
88+
89+ RUN if [ "$VERSION_ODD" = "latest" ] ; then \
90+ VERSION_ODD=$(curl "https://api.github.com/repos/TEIC/TEI/releases/latest" | grep -Po '"tag_name": "P5_Release_\K .*?(?=")' ); \
91+ fi \
92+ && echo "ODD version set to ${VERSION_ODD}" \
93+ # download the required tei odd and stylesheet sources in the image and move them to the respective folders ( ${TEI_SOURCES_HOME})
94+ && curl -s -L -o /tmp/odd.zip https://github.com/TEIC/TEI/releases/download/P5_Release_${VERSION_ODD}/tei-${VERSION_ODD}.zip \
95+ && unzip /tmp/odd.zip -d /tmp/odd \
96+ && rm /tmp/odd.zip \
97+ && mkdir -p ${TEI_SOURCES_HOME}/odd \
98+ && cp -r /tmp/odd/xml/tei/odd/* ${TEI_SOURCES_HOME}/odd \
99+ && rm -r /tmp/odd
100+
74101VOLUME ["/usr/share/xml/tei/stylesheet" , "/usr/share/xml/tei/odd" ]
75102
76103EXPOSE 8080 8081
0 commit comments