mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-08 18:44:22 +00:00
37 lines
1.4 KiB
Docker
37 lines
1.4 KiB
Docker
# This image will be published as dspace/dspace-dependencies
|
|
# The purpose of this image is to make the build for dspace/dspace run faster
|
|
#
|
|
|
|
# This Dockerfile uses JDK11 by default, but has also been tested with JDK17.
|
|
# To build with JDK17, use "--build-arg JDK_VERSION=17"
|
|
ARG JDK_VERSION=11
|
|
|
|
# Step 1 - Run Maven Build
|
|
FROM maven:3-openjdk-${JDK_VERSION}-slim as build
|
|
ARG TARGET_DIR=dspace-installer
|
|
WORKDIR /app
|
|
# Create the 'dspace' user account & home directory
|
|
RUN useradd dspace \
|
|
&& mkdir -p /home/dspace \
|
|
&& chown -Rv dspace: /home/dspace
|
|
RUN chown -Rv dspace: /app
|
|
# Need git to support buildnumber-maven-plugin, which lets us know what version of DSpace is being run.
|
|
RUN apt-get update \
|
|
&& apt-get install -y --no-install-recommends git \
|
|
&& apt-get purge -y --auto-remove \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Switch to dspace user & run below commands as that user
|
|
USER dspace
|
|
|
|
# Copy the DSpace source code (from local machine) into the workdir (excluding .dockerignore contents)
|
|
ADD --chown=dspace . /app/
|
|
|
|
# Trigger the installation of all maven dependencies (hide download progress messages)
|
|
RUN mvn --no-transfer-progress package
|
|
|
|
# Clear the contents of the /app directory (including all maven builds), so no artifacts remain.
|
|
# This ensures when dspace:dspace is built, it will use the Maven local cache (~/.m2) for dependencies
|
|
USER root
|
|
RUN rm -rf /app/*
|