forked from br2490/isle-fedora
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Dockerfile
171 lines (155 loc) · 10.1 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
FROM islandoracollabgroup/isle-tomcat:1.5.28
## Dependencies
RUN GEN_DEP_PACKS="mysql-client \
default-libmysqlclient-dev \
openssl \
libxml2-dev" && \
echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections && \
apt-get update && \
apt-get install -y --no-install-recommends $GEN_DEP_PACKS && \
## Cleanup phase.
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
## Set up environmental variables for Tomcat & dependencies installation
# @see: Apache Maven http://maven.apache.org/download.cgi & Apache Ant https://ant.apache.org/
ENV JAVA_MAX_MEM=${JAVA_MAX_MEM:-3G} \
JAVA_MIN_MEM=${JAVA_MIN_MEM:-1G} \
JAVA_OPTS='-Djava.awt.headless=true -server -Xmx${JAVA_MAX_MEM} -Xms${JAVA_MIN_MEM} -XX:+UseG1GC -XX:+UseStringDeduplication -XX:MaxGCPauseMillis=200 -XX:InitiatingHeapOccupancyPercent=70 -Djava.net.preferIPv4Stack=true -Djava.net.preferIPv4Addresses=true' \
FEDORA_HOME=/usr/local/fedora \
FEDORA_PATH=$PATH:/usr/local/fedora/server/bin:/usr/local/fedora/client/bin \
PATH=$PATH:/usr/local/fedora/server/bin:/usr/local/fedora/client/bin:/opt/maven/bin:/opt/ant/bin \
MAVEN_HOME=/opt/maven \
ANT_HOME=/opt/ant \
MAVEN_MAJOR=${MAVEN_MAJOR:-3} \
# Holding at version 3.6.3 due to breakage in mirrors & dependencies - 4/25/21
MAVEN_VERSION=${MAVEN_VERSION:-3.6.3} \
# Holding at version 1.10.9 due to breakage in mirrors & dependencies - 5/25/21
ANT_VERSION=${ANT_VERSION:-1.10.9}
## Copy installation configuration files.
COPY install_properties/ /
## Fedora Installation with Drupalfilter
# @see: Fedora https://github.com/fcrepo3/fcrepo/releases & Drupal-filter https://github.com/Islandora/islandora_drupal_filter/releases
RUN mkdir -p $FEDORA_HOME /tmp/fedora &&\
cd /tmp/fedora && \
curl -O -L "https://github.com/fcrepo3/fcrepo/releases/download/v3.8.1/fcrepo-installer-3.8.1.jar" && \
java -jar fcrepo-installer-3.8.1.jar /usr/local/install.properties && \
$CATALINA_HOME/bin/startup.sh && \
## Docker Hub Auto-builds need some time.
sleep 90 && \
rm /usr/local/install.properties && \
# Setup XACML Policies
cd $FEDORA_HOME/data/fedora-xacml-policies/repository-policies && \
git clone https://github.com/Islandora/islandora-xacml-policies.git islandora && \
cd $FEDORA_HOME/data/fedora-xacml-policies/repository-policies/default && \
rm deny-inactive-or-deleted-objects-or-datastreams-if-not-administrator.xml && \
rm deny-policy-management-if-not-administrator.xml && \
rm deny-unallowed-file-resolution.xml&& \
rm deny-purge-datastream-if-active-or-inactive.xml && \
rm deny-purge-object-if-active-or-inactive.xml && \
rm deny-reloadPolicies-if-not-localhost.xml && \
cd $FEDORA_HOME/data/fedora-xacml-policies/repository-policies/islandora && \
rm permit-apim-to-anonymous-user.xml && \
rm permit-upload-to-anonymous-user.xml && \
# Drupal Filter
cd $CATALINA_HOME/webapps/fedora/WEB-INF/lib/ && \
curl -O -L "https://github.com/Islandora/islandora_drupal_filter/releases/download/7.1.12/fcrepo-drupalauthfilter-3.8.1.jar" && \
## Cleanup phase.
rm -rf /tmp/* /var/tmp/*
## ANT AND MAVEN ENV
ARG MAVEN_MAJOR
ARG MAVEN_VERSION
ARG ANT_VERSION
COPY fetch.xml /tmp/
RUN mkdir -p $ANT_HOME $MAVEN_HOME && \
cd /tmp && \
curl -O -L "https://www.apache.org/dyn/closer.cgi?action=download&filename=maven/maven-$MAVEN_MAJOR/$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.tar.gz" && \
tar xzf /tmp/apache-maven-$MAVEN_VERSION-bin.tar.gz -C $MAVEN_HOME --strip-components=1 && \
curl -O -L "https://www.apache.org/dyn/closer.cgi?action=download&filename=ant/binaries/apache-ant-$ANT_VERSION-bin.tar.gz" && \
tar xzf /tmp/apache-ant-$ANT_VERSION-bin.tar.gz -C $ANT_HOME --strip-components=1 && \
cd $ANT_HOME && \
mv /tmp/fetch.xml $ANT_HOME/ && \
ant -f fetch.xml -Ddest=system && \
## Cleanup phase.
rm -rf /tmp/* /var/tmp/* $ANT_HOME/bin/*.bat
## Trippi-Sail Adapter for Blazegraph
# @see: https://github.com/discoverygarden/trippi-sail/releases
RUN cd /tmp/ && \
git clone https://github.com/discoverygarden/trippi-sail.git && \
cd /tmp/trippi-sail && \
mvn package -Dfedora.version=3.8.1 && \
cd /tmp/trippi-sail/trippi-sail-blazegraph-remote/target && \
tar xf trippi-sail-blazegraph-remote-0.0.1-SNAPSHOT-bin.tar.gz && \
cp -r trippi-sail-blazegraph-remote-0.0.1-SNAPSHOT/* $CATALINA_HOME/webapps/fedora/WEB-INF/lib/ && \
sed -i 's#localhost:8080#isle-blazegraph:8080#g' /tmp/trippi-sail/trippi-sail-blazegraph-remote/src/main/resources/sample-bean-config-xml/remote-blazegraph.xml && \
# 15 spaces after \ for proper formatting.
sed -i '34i\ <constructor-arg type="boolean" value="false"/>' /tmp/trippi-sail/trippi-sail-blazegraph-remote/src/main/resources/sample-bean-config-xml/remote-blazegraph.xml && \
sed -i 's#SesameSession">#SesameSession" scope="prototype" >#g' /tmp/trippi-sail/trippi-sail-blazegraph-remote/src/main/resources/sample-bean-config-xml/remote-blazegraph.xml && \
sed -i 's#value="test#value="fedora#g' /tmp/trippi-sail/trippi-sail-blazegraph-remote/src/main/resources/sample-bean-config-xml/remote-blazegraph.xml && \
cp /tmp/trippi-sail/trippi-sail-blazegraph-remote/src/main/resources/sample-bean-config-xml/remote-blazegraph.xml $FEDORA_HOME/server/config/spring/remote-blazegraph.bk && \
chown -R tomcat:tomcat $FEDORA_HOME/ && \
rm -rf /tmp/* /var/tmp/*
## Fedora GSearch
# @see: Gsearch https://github.com/discoverygarden/gsearch/releases & DGI GSearch extensions https://github.com/discoverygarden/dgi_gsearch_extensions/releases
RUN mkdir /tmp/fedoragsearch && \
cd /tmp/fedoragsearch && \
git clone https://github.com/discoverygarden/gsearch.git && \
git clone https://github.com/discoverygarden/dgi_gsearch_extensions.git && \
cd /tmp/fedoragsearch/gsearch/FedoraGenericSearch && \
ant buildfromsource && \
cd /tmp/fedoragsearch/dgi_gsearch_extensions && \
mvn -q package && \
## Copy FGS and Extensions to their respective locations and deploy
cp -v /tmp/fedoragsearch/gsearch/FgsBuild/fromsource/fedoragsearch.war $CATALINA_HOME/webapps && \
unzip -o $CATALINA_HOME/webapps/fedoragsearch.war -d $CATALINA_HOME/webapps/fedoragsearch/ && \
cp -v /tmp/fedoragsearch/dgi_gsearch_extensions/target/gsearch_extensions-0.1.*-jar-with-dependencies.jar $CATALINA_HOME/webapps/fedoragsearch/WEB-INF/lib && \
rm $CATALINA_HOME/webapps/fedoragsearch/WEB-INF/lib/log4j-over-slf4j-1.5.10.jar && \
## Cleanup phase.
## Remove maven build files
rm -rf /root/.m2 && \
rm -rf /tmp/* /var/tmp/*
## Gsearch / Solr configuration
# Note from Ben: Why in another layer? caching during development.
# @see: https://github.com/discoverygarden/basic-solr-config/tree/4.10.x is the branch to review for changes.
RUN cd /tmp && \
git clone --recursive -b 4.10.x https://github.com/discoverygarden/basic-solr-config.git && \
cd basic-solr-config && \
# export SOLR_CONFIG_COMMIT=`git rev-parse --short HEAD` && \ ## Doesn't work. Would be nice to have this hash...
sed -i "s#localhost:8080#solr:8080#g" index.properties&& \
sed -i "s#/usr/local/fedora/solr/collection1/data/index#NOT_USED#g" index.properties&& \
sed -i 's#/usr/local/fedora/tomcat#/usr/local/tomcat#g' foxmlToSolr.xslt && \
sed -i 's#/usr/local/fedora/tomcat#/usr/local/tomcat#g' islandora_transforms/*.xslt && \
cd $CATALINA_HOME/webapps/fedoragsearch/FgsConfig && \
ant -f fgsconfig-basic.xml -Dlocal.FEDORA_HOME=$FEDORA_HOME -DgsearchUser=fgsAdmin -DgsearchPass=ild_fgs_admin_2018 -DfinalConfigPath=$CATALINA_HOME/webapps/fedoragsearch/WEB-INF/classes -DlogFilePath=$FEDORA_HOME/logs -DfedoraUser=fedoraAdmin -DfedoraPass=ild_fed_admin_2018 -DobjectStoreBase=$FEDORA_HOME/data/objectStore -DindexDir=NOT_USED -DindexingDocXslt=foxmlToSolr -DlogLevel=INFO -propertyfile fgsconfig-basic-for-islandora.properties && \
sed -i "s#FgsUpdaters#FgsUpdater0 FgsUpdater1 FgsUpdater2 FgsUpdater3 FgsUpdater4 FgsUpdater5 FgsUpdater6 FgsUpdater7#g" $CATALINA_HOME/webapps/fedoragsearch/WEB-INF/classes/fgsconfigFinal/fedoragsearch.properties && \
cp -vr /tmp/basic-solr-config/islandora_transforms $CATALINA_HOME/webapps/fedoragsearch/WEB-INF/classes/fgsconfigFinal/index/FgsIndex/islandora_transforms && \
cp -v /tmp/basic-solr-config/foxmlToSolr.xslt $CATALINA_HOME/webapps/fedoragsearch/WEB-INF/classes/fgsconfigFinal/index/FgsIndex/foxmlToSolr.xslt && \
cp -v /tmp/basic-solr-config/index.properties $CATALINA_HOME/webapps/fedoragsearch/WEB-INF/classes/fgsconfigFinal/index/FgsIndex/index.properties && \
## Link helper scripts.
ln -s /utility_scripts/rebuildFedora.sh /usr/local/bin/rebuildFedora && \
ln -s /utility_scripts/updateSolrIndex.sh /usr/local/bin/updateSolrIndex && \
## Permissions fix for link help script
chmod 755 /usr/local/tomcat/webapps/fedoragsearch/client && \
chmod -Rv 740 /usr/local/tomcat/webapps/fedoragsearch/client/* && \
## Cleanup phase.
rm -rf /tmp/* /var/tmp/* $CATALINA_HOME/webapps/fedora-demo* $CATALINA_HOME/webapps/fedoragsearch/WEB-INF/classes/configDemo*
## Labels
ARG BUILD_DATE
ARG VCS_REF
ARG VERSION
LABEL org.label-schema.build-date=$BUILD_DATE \
org.label-schema.name="ISLE Fedora Services" \
org.label-schema.description="ISLE Fedora image, responsible for storing and serving archival repository data." \
org.label-schema.url="https://islandora-collaboration-group.github.io" \
org.label-schema.vcs-ref=$VCS_REF \
org.label-schema.vcs-url="https://github.com/Islandora-Collaboration-Group/isle-fedora" \
org.label-schema.vendor="Islandora Collaboration Group (ICG) - [email protected]" \
org.label-schema.version=$VERSION \
org.label-schema.schema-version="1.0" \
traefik.port="8080"
COPY rootfs /
## Volume Fedora Data
VOLUME /usr/local/fedora/data/activemq-data /usr/local/fedora/data/datastreamStore \
/usr/local/fedora/data/fedora-xacml-policies /usr/local/fedora/data/objectStore \
/usr/local/fedora/data/resourceIndex
EXPOSE 8080
ENTRYPOINT ["/init"]