# This image will be published as dspace/dspace-cli # See https://github.com/DSpace/DSpace/tree/main/dspace/src/main/docker for usage details # # This version is JDK11 compatible # - openjdk:11 # - ANT 1.10.12 # - maven:3-jdk-11 (see dspace-dependencies) # - note: default tag for branch: dspace/dspace-cli: dspace/dspace-cli:dspace-7_x # Step 1 - Run Maven Build FROM dspace/dspace-dependencies:dspace-7_x as build ARG TARGET_DIR=dspace-installer WORKDIR /app # The dspace-installer directory will be written to /install RUN mkdir /install \ && chown -Rv dspace: /install \ && chown -Rv dspace: /app USER dspace # Copy the DSpace source code (from local machine) into the workdir (excluding .dockerignore contents) ADD --chown=dspace . /app/ # Build DSpace. Copy the dspace-installer directory to /install. Clean up the build to keep the docker image small RUN mvn package && \ mv /app/dspace/target/${TARGET_DIR}/* /install && \ mvn clean # Step 2 - Run Ant Deploy FROM openjdk:11 as ant_build ARG TARGET_DIR=dspace-installer # COPY the /install directory from 'build' container to /dspace-src in this container COPY --from=build /install /dspace-src WORKDIR /dspace-src # Create the initial install deployment using ANT ENV ANT_VERSION 1.10.12 ENV ANT_HOME /tmp/ant-$ANT_VERSION ENV PATH $ANT_HOME/bin:$PATH # Download and install 'ant' 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 necessary 'ant' deploy scripts RUN ant init_installation update_configs update_code # Step 3 - Run jdk # Create a new tomcat image that does not retain the the build directory contents FROM openjdk:11 # NOTE: DSPACE_INSTALL must align with the "dspace.dir" default configuration. ENV DSPACE_INSTALL=/dspace # Copy the /dspace directory from 'ant_build' containger to /dspace in this container COPY --from=ant_build /dspace $DSPACE_INSTALL # Give java extra memory (1GB) ENV JAVA_OPTS=-Xmx1000m