mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 01:54:22 +00:00
61 lines
2.4 KiB
Docker
61 lines
2.4 KiB
Docker
# This image will be published as dspace/dspace-cli
|
|
# See https://github.com/DSpace/DSpace/tree/main/dspace/src/main/docker for usage details
|
|
#
|
|
# - note: default tag for branch: dspace/dspace-cli: dspace/dspace-cli:latest
|
|
|
|
# This Dockerfile uses JDK17 by default.
|
|
# To build with other versions, use "--build-arg JDK_VERSION=[value]"
|
|
ARG JDK_VERSION=17
|
|
ARG DSPACE_VERSION=latest
|
|
|
|
# Step 1 - Run Maven Build
|
|
FROM dspace/dspace-dependencies:${DSPACE_VERSION} 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 --no-transfer-progress package && \
|
|
mv /app/dspace/target/${TARGET_DIR}/* /install && \
|
|
mvn clean
|
|
|
|
# Step 2 - Run Ant Deploy
|
|
FROM eclipse-temurin:${JDK_VERSION} 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.13
|
|
ENV ANT_HOME /tmp/ant-$ANT_VERSION
|
|
ENV PATH $ANT_HOME/bin:$PATH
|
|
# Need wget to install ant
|
|
RUN apt-get update \
|
|
&& apt-get install -y --no-install-recommends wget \
|
|
&& apt-get purge -y --auto-remove \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
# 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
|
|
FROM eclipse-temurin:${JDK_VERSION}
|
|
# NOTE: DSPACE_INSTALL must align with the "dspace.dir" default configuration.
|
|
ENV DSPACE_INSTALL=/dspace
|
|
# Copy the /dspace directory from 'ant_build' container to /dspace in this container
|
|
COPY --from=ant_build /dspace $DSPACE_INSTALL
|
|
# Give java extra memory (1GB)
|
|
ENV JAVA_OPTS=-Xmx1000m
|
|
# Install unzip for AIPs
|
|
RUN apt-get update \
|
|
&& apt-get install -y --no-install-recommends unzip \
|
|
&& apt-get purge -y --auto-remove \
|
|
&& rm -rf /var/lib/apt/lists/*
|