Newer
Older
Alexander König
committed
############################################################
# Dockerfile to build LINDAT Dspace container images
# Based on Ubuntu
############################################################
Alexander König
committed
LABEL maintainer="Alexander König <Alexander.Koenig@eurac.edu>"
# install cpanm and dependencies
RUN apt-get update \
&& apt-get -y upgrade \
&& apt-get -y install make gcc wget cpanminus
RUN cpanm -n File::Spec::Functions
RUN cpanm Term::ReadLine
Alexander König
committed
# install jdk, ant, psql, mvn, make, libxml, xsltproc, zip, wget
RUN apt-get update && apt-get -y install openjdk-8-jdk ant maven libxml2-utils xsltproc unzip curl git
# install convenience apps for debug purposes (vim and jsbeautifier)
RUN apt-get update && apt-get -y install vim less python-pip
RUN pip install --upgrade pip
RUN pip install jsbeautifier
COPY commul-customization/__init__.py /usr/local/lib/python2.7/dist-packages/jsbeautifier/
Alexander König
committed
# set up a proper locale
RUN apt-get -y install locales
Alexander König
committed
RUN locale-gen en_US.UTF-8
COPY commul-customization/default_locale /etc/default/locale
RUN chmod 0755 /etc/default/locale
ENV LC_ALL=en_US.UTF-8
ENV LANG=en_US.UTF-8
ENV LANGUAGE=en_US.UTF-8
# build tomcat 8.0.35, version recommended by LINDAT
RUN wget -O /tmp/apache-tomcat-8.0.52.tar.gz https://archive.apache.org/dist/tomcat/tomcat-8/v8.0.52/bin/apache-tomcat-8.0.52.tar.gz
RUN tar xvzf /tmp/apache-tomcat-8.0.52.tar.gz -C /opt/tomcat8/ --strip-components=1
RUN groupadd tomcat8
RUN useradd -s /bin/false -g tomcat8 -d /opt/tomcat8/ tomcat8
# change permissions
RUN chown -R tomcat8:tomcat8 /opt/tomcat8
# copy config files etc. (init script,catalina.sh,setenv.sh,server.xml
COPY commul-customization/tomcat8 /etc/init.d/
RUN chmod a+x /etc/init.d/tomcat8
COPY commul-customization/catalina.sh /opt/tomcat8/bin/
COPY commul-customization/setenv.sh /opt/tomcat8/bin/
COPY commul-customization/tomcat-server.xml /opt/tomcat8/conf/server.xml
Alexander König
committed
# install Dspace
# pre-fetch maven dependencies
RUN git clone https://github.com/commul/clarin-dspace.git -b commul-custom /opt/repository/sources/dspace
WORKDIR /opt/repository/sources/dspace
RUN mvn compile
#COPY commul-customization/dspace-pom.xml /tmp/pom.xml
#WORKDIR /tmp/
## RUN mvn dependency:resolve
#RUN mvn -B -T 4 dependency:copy-dependencies dependency:resolve-plugins dependency:go-offline clean
# all files could be copied into a /tmp folder within the container first (maybe that could be mounted?); see also dspace-entrypoint.sh
# this checks if there was a new commit since the last build
ADD https://api.github.com/repos/commul/clarin-dspace/git/refs/heads/commul-custom /tmp/version.json
RUN git pull
Alexander König
committed
WORKDIR /opt/repository/sources/dspace/utilities/project_helpers
RUN ./setup.sh /opt/repository/workspace
COPY commul-customization/variable.makefile /opt/repository/workspace/config/variable.makefile
Alexander König
committed
# COPY commul-customization/dspace.cfg /opt/repository/sources/dspace/dspace/config/dspace.cfg
Alexander König
committed
# copy over configs and startup scripts
COPY commul-customization/start_stack.sh /opt/repository/workspace/scripts/
COPY commul-customization/stop_stack.sh /opt/repository/workspace/scripts/
COPY commul-customization/local.properties /opt/repository/workspace/sources/
RUN chmod u+x /opt/repository/workspace/scripts/*_stack.sh
# install libs
Alexander König
committed
WORKDIR /opt/repository/workspace/scripts
RUN make install_libs
# DEBUG: to be able to access tomcat manager through browser
# COPY commul-customization/tomcat-users.xml /opt/tomcat8/conf/
RUN perl -pi -e 's/#xmlui\.session\.ipcheck = true/xmlui.session.ipcheck = false/' /opt/lindat-dspace/installation/config/dspace.cfg
Alexander König
committed
# set up handle server
COPY commul-customization/hdl-setup.tmp /tmp/
RUN cat /tmp/hdl-setup.tmp | /opt/lindat-dspace/installation/bin/dspace make-handle-config /opt/lindat-dspace/installation/handle-server/
COPY commul-customization/config.dct /opt/lindat-dspace/installation/handle-server/config.dct
Alexander König
committed
RUN cp /opt/repository/workspace/config/etc/default/handle-server /etc/default/
RUN cp /opt/repository/workspace/config/etc/init.d/handle-server /etc/init.d/
RUN chmod +x /etc/init.d/handle-server
RUN perl -pi -e 's#DSPACE_INSTALLATION_DIRECTORY=#DSPACE_INSTALLATION_DIRECTORY=/opt/lindat-dspace/installation#' /etc/default/handle-server
# copy entrypoint script and start
Alexander König
committed
COPY commul-customization/entrypoint.sh /usr/bin/entrypoint.sh
RUN chmod u+x /usr/bin/entrypoint.sh
ENTRYPOINT ["/usr/bin/entrypoint.sh"]