############################################################################## # Dockerfile to build LINDAT Dspace container images # Based on Ubuntu ############################################################################## ARG UBUNTU_VERSION=16.04 FROM ubuntu:$UBUNTU_VERSION ARG UBUNTU_VERSION ARG LABEL_VCS_URL="https://gitlab.inf.unibz.it/commul/docker/clarin-dspace" LABEL maintainer="Alexander König <Alexander.Koenig@eurac.edu>" \ maintainer="Egon W. Stemle <egon.stemle@eurac.edu>" ENV TOMCAT_VERSION="8.0.53" ENV TOMCAT_SHA512="cd8a4e48a629a2f2bb4ce6b101ebcce41da52b506064396ec1b2915c0b0d8d82123091242f2929a649bcd8b65ecf6cd1ab9c7d90ac0e261821097ab6fbe22df9 *apache-tomcat-8.0.53.tar.gz" # https://archive.apache.org/dist/tomcat/tomcat-8/v8.0.53/bin/apache-tomcat-8.0.53.tar.gz.sha512 ENV TERM linux # APT(-GET) tweaks # Set some sane defaults for apt inside docker ENV DEBIAN_FRONTEND=noninteractive COPY apt.local.conf /etc/apt/apt.conf.d/99local.conf # use fast(er) local mirrors COPY ubuntu-$UBUNTU_VERSION.sources.list /etc/apt/sources.list RUN apt-get update && \ apt-get upgrade # install cpanm and dependencies # install jdk, ant, psql, mvn, make, libxml, xsltproc, zip, wget RUN apt-get update && apt-get install \ unzip curl wget git \ make gcc \ cpanminus \ openjdk-8-jdk ant maven libxml2-utils xsltproc \ libapr1-dev RUN cpanm -n File::Spec::Functions && \ cpanm Term::ReadLine # install convenience apps for debug purposes (vim and jsbeautifier) RUN apt-get update && apt-get install vim less python-pip RUN pip install jsbeautifier COPY commul-customization/__init__.py /usr/local/lib/python2.7/dist-packages/jsbeautifier/ # set up a proper locale RUN apt-get update && apt-get 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 ### Install Tomcat # # build tomcat $TOMCAT_VERSION (> 8.0.35), version recommended by LINDAT RUN wget -O /tmp/apache-tomcat-$TOMCAT_VERSION.tar.gz \ https://archive.apache.org/dist/tomcat/tomcat-8/v$TOMCAT_VERSION/bin/apache-tomcat-$TOMCAT_VERSION.tar.gz WORKDIR /tmp # checksum check the download RUN echo "$TOMCAT_SHA512" > /tmp/apache-tomcat.sha512 && \ sha512sum --check apache-tomcat.sha512 RUN mkdir /opt/tomcat8 && \ tar xzf /tmp/apache-tomcat-$TOMCAT_VERSION.tar.gz \ -C /opt/tomcat8/ \ --strip-components=1 && \ groupadd tomcat8 && \ useradd -s /bin/false -g tomcat8 -d /opt/tomcat8/ tomcat8 && \ chown -R tomcat8:tomcat8 /opt/tomcat8 # Install Apache Tomcat Native # prerequisites: libopenssl, libapr1, jdk RUN mkdir /opt/tomcat8/bin/tomcat-native && \ tar xzf /opt/tomcat8/bin/tomcat-native.tar.gz \ -C /opt/tomcat8/bin/tomcat-native \ --strip-components=1 && \ cd /opt/tomcat8/bin/tomcat-native/native && \ ./configure \ --with-java-home=/usr/lib/jvm/java-8-openjdk-amd64/ \ --prefix=/usr/local/ && \ make && make install # copy config files etc. (setenv.sh,server.xml) COPY commul-customization/tomcat-setenv.sh /opt/tomcat8/bin/setenv.sh COPY commul-customization/tomcat-server.xml /opt/tomcat8/conf/server.xml ### Install Dspace # # Our clarin-dspace tag to checkout ENV DSPACE_TAG="commul-2020.01.0-rc2_dspace-2020.02.1" # clone specific version tag RUN git clone --depth 1 --branch "$DSPACE_TAG" --recursive https://github.com/commul/clarin-dspace.git /opt/repository/sources/dspace WORKDIR /opt/repository/sources/dspace # pre-fetch maven dependencies RUN mvn -B -T 1C \ --quiet \ --fail-never \ dependency:copy-dependencies dependency:resolve-plugins dependency:go-offline RUN mvn -B -T 1C clean compile 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 # install python modules: magic dateutil, lxml RUN apt-get update && apt-get install python-magic python-dateutil python-lxml # 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 WORKDIR /opt/repository/workspace/scripts RUN make install_libs # deploy DSpace RUN make new_deploy # DEBUG: to be able to access tomcat manager through browser # COPY commul-customization/tomcat-users.xml /opt/tomcat8/conf/ # adapt some config files RUN perl -pi -e 's/#useProxies = true/useProxies = true/' /opt/lindat-dspace/installation/config/dspace.cfg RUN perl -pi -e 's# (?s).*org.apache.catalina.connector.ClientAbortException: java.io.IOException: Broken pipe.*# (?s).*org.apache.catalina.connector.ClientAbortException: java.io.IOException: Broken pipe.*,\\\n (?s).*user-agent=.kube-probe.*#' /opt/lindat-dspace/installation/config/modules/lr.cfg # 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 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 ARG LABEL_VERSION ARG LABEL_BUILD_DATE LABEL org.label-schema.version=$LABEL_VERSION \ org.label-schema.build-date=$LABEL_BUILD_DATE \ org.label-schema.vcs-url=$LABEL_VCS_URL # copy entrypoint script and start COPY commul-customization/entrypoint.sh /usr/bin/entrypoint.sh RUN chmod u+x /usr/bin/entrypoint.sh ENTRYPOINT ["/usr/bin/entrypoint.sh"]