Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Docker image build issues for new versions of Docker (25.0.2) and Docker Compose (2.24.3) #9303

Merged
merged 3 commits into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ jobs:
build_id: dspace-solr
image_name: dspace/dspace-solr
dockerfile_path: ./dspace/src/main/docker/dspace-solr/Dockerfile
# Must pass solrconfigs to the Dockerfile so that it can find the required Solr config files
dockerfile_additional_contexts: 'solrconfigs=./dspace/solr/'
secrets:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_ACCESS_TOKEN: ${{ secrets.DOCKER_ACCESS_TOKEN }}
Expand Down
10 changes: 9 additions & 1 deletion .github/workflows/reusable-docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ on:
dockerfile_context:
required: false
type: string
default: '.'
# Optionally a list of "additional_contexts" to pass to Dockerfile. Defaults to empty
dockerfile_additional_contexts:
required: false
type: string
default: ''
# If Docker image should have additional tag flavor details (e.g. a suffix), it may be passed in.
tags_flavor:
required: false
Expand Down Expand Up @@ -123,7 +129,9 @@ jobs:
id: docker_build
uses: docker/build-push-action@v5
with:
context: ${{ inputs.dockerfile_context || '.' }}
build-contexts: |
${{ inputs.dockerfile_additional_contexts }}
context: ${{ inputs.dockerfile_context }}
file: ${{ inputs.dockerfile_path }}
platforms: ${{ matrix.arch }}
# For pull requests, we run the Docker build (to ensure no PR changes break the build),
Expand Down
12 changes: 6 additions & 6 deletions docker-compose-cli.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
version: "3.7"

networks:
# Default to using network named 'dspacenet' from docker-compose.yml.
# Its full name will be prepended with the project name (e.g. "-p d7" means it will be named "d7_dspacenet")
default:
name: ${COMPOSE_PROJECT_NAME}_dspacenet
external: true
services:
dspace-cli:
image: "${DOCKER_OWNER:-dspace}/dspace-cli:${DSPACE_VER:-latest}"
Expand All @@ -26,13 +31,8 @@ services:
- ./dspace/config:/dspace/config
entrypoint: /dspace/bin/dspace
command: help
networks:
- dspacenet
tty: true
stdin_open: true

volumes:
assetstore:

networks:
dspacenet:
8 changes: 5 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ services:
depends_on:
- dspacedb
networks:
dspacenet:
- dspacenet
ports:
- published: 8080
target: 8080
Expand Down Expand Up @@ -89,8 +89,10 @@ services:
container_name: dspacesolr
image: "${DOCKER_OWNER:-dspace}/dspace-solr:${DSPACE_VER:-latest}"
build:
context: .
dockerfile: ./dspace/src/main/docker/dspace-solr/Dockerfile
context: ./dspace/src/main/docker/dspace-solr/
# Provide path to Solr configs necessary to build Docker image
additional_contexts:
solrconfigs: ./dspace/solr/
args:
SOLR_VERSION: "${SOLR_VER:-8.11}"
networks:
Expand Down
1 change: 1 addition & 0 deletions dspace/src/main/docker-compose/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ docker-compose -p d7 up -d
```
docker-compose -p d7 -f docker-compose.yml -f dspace/src/main/docker-compose/docker-compose-angular.yml up -d
```
NOTE: This starts the UI in development mode. It will take a few minutes to see the UI as the Angular code needs to be compiled.

## Run DSpace REST and DSpace Angular from local branches

Expand Down
8 changes: 5 additions & 3 deletions dspace/src/main/docker-compose/docker-compose-angular.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@

version: '3.7'
networks:
dspacenet:
# Default to using network named 'dspacenet' from docker-compose.yml.
# Its full name will be prepended with the project name (e.g. "-p d7" means it will be named "d7_dspacenet")
default:
name: ${COMPOSE_PROJECT_NAME}_dspacenet
external: true
services:
dspace-angular:
container_name: dspace-angular
Expand All @@ -24,8 +28,6 @@ services:
DSPACE_REST_PORT: 8080
DSPACE_REST_NAMESPACE: /server
image: dspace/dspace-angular:${DSPACE_VER:-latest}
networks:
dspacenet:
ports:
- published: 4000
target: 4000
Expand Down
8 changes: 5 additions & 3 deletions dspace/src/main/docker-compose/docker-compose-iiif.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@
#
version: '3.7'
networks:
dspacenet:
# Default to using network named 'dspacenet' from docker-compose.yml.
# Its full name will be prepended with the project name (e.g. "-p d7" means it will be named "d7_dspacenet")
default:
name: ${COMPOSE_PROJECT_NAME}_dspacenet
external: true
services:
dspace-iiif:
container_name: dspace-iiif
Expand All @@ -21,8 +25,6 @@ services:
# Using UCLA Library image as it seems to be most maintained at this time. There is no official image.
# https://hub.docker.com/r/uclalibrary/cantaloupe
image: uclalibrary/cantaloupe:5.0.4-0
networks:
dspacenet:
ports:
- '8182:8182'
# For a guide of environment variables that can be used, see
Expand Down
8 changes: 5 additions & 3 deletions dspace/src/main/docker-compose/docker-compose-shibboleth.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@
#
version: '3.7'
networks:
dspacenet:
# Default to using network named 'dspacenet' from docker-compose.yml.
# Its full name will be prepended with the project name (e.g. "-p d7" means it will be named "d7_dspacenet")
default:
name: ${COMPOSE_PROJECT_NAME}_dspacenet
external: true
services:
dspace-shibboleth:
container_name: dspace-shibboleth
Expand All @@ -22,8 +26,6 @@ services:
build:
# Must be relative to root, so that it can be built alongside [src]/docker-compose.yml
context: ./dspace/src/main/docker/dspace-shibboleth
networks:
dspacenet:
ports:
- published: 80
target: 80
Expand Down
12 changes: 7 additions & 5 deletions dspace/src/main/docker/dspace-solr/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@ RUN mkdir -p $AUTHORITY_CONFIGSET_PATH && \
mkdir -p $STATISTICS_CONFIGSET_PATH && \
mkdir -p $QAEVENT_CONFIGSET_PATH

COPY dspace/solr/authority/conf/* $AUTHORITY_CONFIGSET_PATH/
COPY dspace/solr/oai/conf/* $OAI_CONFIGSET_PATH/
COPY dspace/solr/search/conf/* $SEARCH_CONFIGSET_PATH/
COPY dspace/solr/statistics/conf/* $STATISTICS_CONFIGSET_PATH/
COPY dspace/solr/qaevent/conf/* $QAEVENT_CONFIGSET_PATH/
# NOTE: "solrconfigs" MUST be passed in by docker-compose via "additional_contexts"
# OR via "docker build --build-context solrconfigs=[path-to-dspace/solr]"
COPY --from=solrconfigs authority/conf/* $AUTHORITY_CONFIGSET_PATH/
COPY --from=solrconfigs oai/conf/* $OAI_CONFIGSET_PATH/
COPY --from=solrconfigs search/conf/* $SEARCH_CONFIGSET_PATH/
COPY --from=solrconfigs statistics/conf/* $STATISTICS_CONFIGSET_PATH/
COPY --from=solrconfigs qaevent/conf/* $QAEVENT_CONFIGSET_PATH/

RUN chown -R solr:solr /opt/solr/server/solr/configsets

Expand Down
Loading