Skip to content

Commit

Permalink
Add Docker registry to all scripts. Allow it to be configurable for D…
Browse files Browse the repository at this point in the history
…Space images (only). Other minor Dockerfile cleanup
  • Loading branch information
tdonohue committed Dec 12, 2024
1 parent be92570 commit 37e6407
Show file tree
Hide file tree
Showing 10 changed files with 39 additions and 27 deletions.
16 changes: 10 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@
# This Dockerfile uses JDK17 by default.
# To build with other versions, use "--build-arg JDK_VERSION=[value]"
ARG JDK_VERSION=17
# The Docker version tag to build from
ARG DSPACE_VERSION=latest
# The Docker registry to use for DSpace images. Defaults to "docker.io"
# NOTE: non-DSpace images are hardcoded to use "docker.io" and are not impacted by this build argument
ARG DOCKER_REGISTRY=docker.io

# Step 1 - Run Maven Build
FROM dspace/dspace-dependencies:${DSPACE_VERSION} AS build
FROM ${DOCKER_REGISTRY}/dspace/dspace-dependencies:${DSPACE_VERSION} AS build
ARG TARGET_DIR=dspace-installer
WORKDIR /app
# The dspace-installer directory will be written to /install
Expand All @@ -31,15 +35,15 @@ RUN mvn --no-transfer-progress package ${MAVEN_FLAGS} && \
RUN rm -rf /install/webapps/server/

# Step 2 - Run Ant Deploy
FROM eclipse-temurin:${JDK_VERSION} AS ant_build
FROM docker.io/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
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 \
Expand All @@ -52,7 +56,7 @@ RUN mkdir $ANT_HOME && \
RUN ant init_installation update_configs update_code update_webapps

# Step 3 - Start up DSpace via Runnable JAR
FROM eclipse-temurin:${JDK_VERSION}
FROM docker.io/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
Expand Down
16 changes: 10 additions & 6 deletions Dockerfile.cli
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@
# This Dockerfile uses JDK17 by default.
# To build with other versions, use "--build-arg JDK_VERSION=[value]"
ARG JDK_VERSION=17
# The Docker version tag to build from
ARG DSPACE_VERSION=latest
# The Docker registry to use for DSpace images. Defaults to "docker.io"
# NOTE: non-DSpace images are hardcoded to use "docker.io" and are not impacted by this build argument
ARG DOCKER_REGISTRY=docker.io

# Step 1 - Run Maven Build
FROM dspace/dspace-dependencies:${DSPACE_VERSION} AS build
FROM ${DOCKER_REGISTRY}/dspace/dspace-dependencies:${DSPACE_VERSION} AS build
ARG TARGET_DIR=dspace-installer
WORKDIR /app
# The dspace-installer directory will be written to /install
Expand All @@ -25,15 +29,15 @@ RUN mvn --no-transfer-progress package && \
mvn clean

# Step 2 - Run Ant Deploy
FROM eclipse-temurin:${JDK_VERSION} AS ant_build
FROM docker.io/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
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 \
Expand All @@ -46,7 +50,7 @@ RUN mkdir $ANT_HOME && \
RUN ant init_installation update_configs update_code

# Step 3 - Run jdk
FROM eclipse-temurin:${JDK_VERSION}
FROM docker.io/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
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
ARG JDK_VERSION=17

# Step 1 - Run Maven Build
FROM maven:3-eclipse-temurin-${JDK_VERSION} AS build
FROM docker.io/maven:3-eclipse-temurin-${JDK_VERSION} AS build
ARG TARGET_DIR=dspace-installer
WORKDIR /app
# Create the 'dspace' user account & home directory
Expand Down
16 changes: 10 additions & 6 deletions Dockerfile.test
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@
# This Dockerfile uses JDK17 by default.
# To build with other versions, use "--build-arg JDK_VERSION=[value]"
ARG JDK_VERSION=17
# The Docker version tag to build from
ARG DSPACE_VERSION=latest
# The Docker registry to use for DSpace images. Defaults to "docker.io"
# NOTE: non-DSpace images are hardcoded to use "docker.io" and are not impacted by this build argument
ARG DOCKER_REGISTRY=docker.io

# Step 1 - Run Maven Build
FROM dspace/dspace-dependencies:${DSPACE_VERSION} AS build
FROM ${DOCKER_REGISTRY}/dspace/dspace-dependencies:${DSPACE_VERSION} AS build
ARG TARGET_DIR=dspace-installer
WORKDIR /app
# The dspace-installer directory will be written to /install
Expand All @@ -30,15 +34,15 @@ RUN mvn --no-transfer-progress package && \
RUN rm -rf /install/webapps/server/

# Step 2 - Run Ant Deploy
FROM eclipse-temurin:${JDK_VERSION} AS ant_build
FROM docker.io/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.12
ENV ANT_HOME /tmp/ant-$ANT_VERSION
ENV PATH $ANT_HOME/bin:$PATH
ENV ANT_VERSION=1.10.12
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 \
Expand All @@ -51,7 +55,7 @@ RUN mkdir $ANT_HOME && \
RUN ant init_installation update_configs update_code update_webapps

# Step 3 - Start up DSpace via Runnable JAR
FROM eclipse-temurin:${JDK_VERSION}
FROM docker.io/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
Expand Down
2 changes: 1 addition & 1 deletion docker-compose-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ networks:
external: true
services:
dspace-cli:
image: "${DOCKER_OWNER:-dspace}/dspace-cli:${DSPACE_VER:-latest}"
image: "${DOCKER_REGISTRY:-docker.io}/${DOCKER_OWNER:-dspace}/dspace-cli:${DSPACE_VER:-latest}"
container_name: dspace-cli
build:
context: .
Expand Down
6 changes: 3 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ services:
# from the host machine. This IP range MUST correspond to the 'dspacenet' subnet defined above.
proxies__P__trusted__P__ipranges: '172.23.0'
LOGGING_CONFIG: /dspace/config/log4j2-container.xml
image: "${DOCKER_OWNER:-dspace}/dspace:${DSPACE_VER:-latest-test}"
image: "${DOCKER_REGISTRY:-docker.io}/${DOCKER_OWNER:-dspace}/dspace:${DSPACE_VER:-latest-test}"
build:
context: .
dockerfile: Dockerfile.test
Expand Down Expand Up @@ -64,7 +64,7 @@ services:
dspacedb:
container_name: dspacedb
# Uses a custom Postgres image with pgcrypto installed
image: "${DOCKER_OWNER:-dspace}/dspace-postgres-pgcrypto:${DSPACE_VER:-latest}"
image: "${DOCKER_REGISTRY:-docker.io}/${DOCKER_OWNER:-dspace}/dspace-postgres-pgcrypto:${DSPACE_VER:-latest}"
build:
# Must build out of subdirectory to have access to install script for pgcrypto
context: ./dspace/src/main/docker/dspace-postgres-pgcrypto/
Expand All @@ -84,7 +84,7 @@ services:
# DSpace Solr container
dspacesolr:
container_name: dspacesolr
image: "${DOCKER_OWNER:-dspace}/dspace-solr:${DSPACE_VER:-latest}"
image: "${DOCKER_REGISTRY:-docker.io}/${DOCKER_OWNER:-dspace}/dspace-solr:${DSPACE_VER:-latest}"
build:
context: ./dspace/src/main/docker/dspace-solr/
# Provide path to Solr configs necessary to build Docker image
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
ARG POSTGRES_VERSION=15
ARG POSTGRES_PASSWORD=dspace

FROM postgres:${POSTGRES_VERSION}
FROM docker.io/postgres:${POSTGRES_VERSION}

ENV POSTGRES_DB dspace
ENV POSTGRES_USER dspace
Expand Down
2 changes: 1 addition & 1 deletion dspace/src/main/docker/dspace-postgres-pgcrypto/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
ARG POSTGRES_VERSION=15
ARG POSTGRES_PASSWORD=dspace

FROM postgres:${POSTGRES_VERSION}
FROM docker.io/postgres:${POSTGRES_VERSION}

ENV POSTGRES_DB dspace
ENV POSTGRES_USER dspace
Expand Down
2 changes: 1 addition & 1 deletion dspace/src/main/docker/dspace-shibboleth/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# Build from Ubuntu as it has easy Apache tooling (e.g. a2enmod script is debian only).
# Apache & mod_shib are required for DSpace to act as an SP
# See also https://wiki.lyrasis.org/display/DSDOC7x/Authentication+Plugins#AuthenticationPlugins-ShibbolethAuthentication
FROM ubuntu:20.04
FROM docker.io/ubuntu:20.04

# Apache ENVs (default values)
ENV APACHE_RUN_USER www-data
Expand Down
2 changes: 1 addition & 1 deletion dspace/src/main/docker/dspace-solr/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

ARG SOLR_VERSION=8.11

FROM solr:${SOLR_VERSION}-slim
FROM docker.io/solr:${SOLR_VERSION}-slim

ENV AUTHORITY_CONFIGSET_PATH=/opt/solr/server/solr/configsets/authority/conf \
OAI_CONFIGSET_PATH=/opt/solr/server/solr/configsets/oai/conf \
Expand Down

0 comments on commit 37e6407

Please sign in to comment.