Skip to content
Snippets Groups Projects
Dockerfile.dspace 4.12 KiB
Newer Older
############################################################
# Dockerfile to build LINDAT Dspace container images
# Based on Ubuntu
############################################################

FROM ubuntu
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 File::Spec::Functions
RUN cpanm Term::ReadLine

# 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/
RUN apt-get -y install locales
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.35.tar.gz https://archive.apache.org/dist/tomcat/tomcat-8/v8.0.35/bin/apache-tomcat-8.0.35.tar.gz
RUN mkdir /opt/tomcat8
RUN tar xvzf /tmp/apache-tomcat-8.0.35.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


# install Dspace
RUN git clone https://github.com/commul/clarin-dspace.git -b clarin /opt/repository/sources/dspace
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
COPY commul-customization/dspace.cfg /opt/repository/sources/dspace/dspace/config/dspace.cfg

# 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

# adapt TOS
RUN perl /opt/repository/sources/dspace/utilities/adapt_tos.pl

WORKDIR /opt/repository/workspace/scripts
RUN make install_libs

RUN make new_deploy

COPY commul-customization/aai_config.js /opt/lindat-dspace/installation/webapps/xmlui/themes/UFAL/lib/js/
# 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/
RUN perl -pi -e 's/YOUR_NAMING_AUTHORITY/20.500.12084/' /opt/lindat-dspace/installation/handle-server/config.dct
RUN perl -pi -e 's/case_sensitive" = "no/case_sensitive" = "yes/' /opt/lindat-dspace/installation/handle-server/config.dct
RUN perl -i -plne 'print "    \"storage_type\" = \"CUSTOM\"\n\    \"storage_class\" = \"org.dspace.handle.HandlePlugin\"" if(/max_session/);' /opt/lindat-dspace/installation/handle-server/config.dct
RUN perl -pi -e 's/193.106.181.73/dspace/' /opt/lindat-dspace/installation/handle-server/config.dct
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 commul-customization/entrypoint.sh /usr/bin/entrypoint.sh
RUN chmod u+x /usr/bin/entrypoint.sh
ENTRYPOINT ["/usr/bin/entrypoint.sh"]