mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-17 15:03:18 +00:00
60 lines
2.1 KiB
Docker
60 lines
2.1 KiB
Docker
# This image will be published as dspace/dspace
|
|
# See https://dspace-labs.github.io/DSpace-Docker-Images/ for usage details
|
|
#
|
|
# This version is JDK8 compatible
|
|
# - openjdk:8-jdk
|
|
# - ANT 1.10.7
|
|
# - maven:3-jdk-8
|
|
# - note:
|
|
# - default tag for branch: dspace/dspace-cli: dspace/dspace-cli:dspace-5_x
|
|
|
|
# Step 1 - Run Maven Build
|
|
FROM dspace/dspace-dependencies:dspace-5_x-jdk8 as build
|
|
ARG TARGET_DIR=dspace-installer
|
|
WORKDIR /app
|
|
|
|
# The dspace-install directory will be written to /install
|
|
RUN mkdir /install \
|
|
&& chown -Rv dspace: /install
|
|
|
|
USER dspace
|
|
|
|
# Copy the DSpace source code into the workdir (excluding .dockerignore contents)
|
|
ADD --chown=dspace . /app/
|
|
COPY --chown=dspace dspace/src/main/docker/build.properties /app/build.properties
|
|
|
|
# Build DSpace. Copy the dspace-install directory to /install. Clean up the build to keep the docker image small
|
|
RUN mvn package -P'!dspace-solr,!dspace-jspui,!dspace-xmlui,!dspace-rest,!dspace-xmlui-mirage2,!dspace-rdf,!dspace-sword,!dspace-swordv2' && \
|
|
mv /app/dspace/target/${TARGET_DIR}/* /install && \
|
|
mvn clean
|
|
|
|
# Step 2 - Run Ant Deploy
|
|
FROM openjdk:8-jdk as ant_build
|
|
ARG TARGET_DIR=dspace-installer
|
|
COPY --from=build /install /dspace-src
|
|
WORKDIR /dspace-src
|
|
|
|
# Create the initial install deployment using ANT
|
|
ENV ANT_VERSION 1.10.7
|
|
ENV ANT_HOME /tmp/ant-$ANT_VERSION
|
|
ENV PATH $ANT_HOME/bin:$PATH
|
|
|
|
RUN mkdir $ANT_HOME && \
|
|
wget -qO- "https://archive.apache.org/dist/ant/binaries/apache-ant-$ANT_VERSION-bin.tar.gz" | tar -zx --strip-components=1 -C $ANT_HOME
|
|
|
|
RUN ant init_installation update_configs update_code
|
|
|
|
# Step 3 - Run jdk
|
|
# Create a new jdk image that does not retain the the build directory contents
|
|
FROM openjdk:8-jdk
|
|
ENV DSPACE_INSTALL=/dspace
|
|
COPY --from=ant_build /dspace $DSPACE_INSTALL
|
|
|
|
ENV JAVA_OPTS=-Xmx1000m
|
|
|
|
# This script is used to parse environment variables to configs in dspace.cfg
|
|
# It is not executed in this Docker file, so it's up to docker-compose to call it.
|
|
COPY dspace/src/main/docker/parse_env_to_configs.sh $DSPACE_INSTALL/bin/parse_env_to_configs.sh
|
|
|
|
# Ensure all scripts are executable
|
|
RUN chmod +x $DSPACE_INSTALL/bin/* |