Skip to content

Commit f519da8

Browse files
MatusBekeclaude
andcommitted
Install curl explicitly, and fix the Solr image build context
Review feedback: both healthchecks shell out to curl, but neither Dockerfile installs it. Both base images do ship curl today, so this was not a live failure: solr:8.11-slim -> /usr/bin/curl, /usr/bin/grep tomcat:9-jdk (built image) -> /usr/bin/curl The objection is still right, because the probes relied on that by accident and the failure mode would be misleading rather than obvious: the container would never report healthy, depends_on: condition: service_healthy would stop dspace-angular from starting at all, and the autoheal sidecar would keep restarting a container that is fine. Nothing in the output would point at a missing binary. So the dependency is now explicit in both images, with a comment saying what breaks without it. Fixing the Solr image also required fixing its build. `docker compose build dspacesolr` could not work at all, independently of this branch: failed to compute cache key: "/scripts/log4j2.solr.xml": not found The compose build context was ./dspace/src/main/docker/dspace-solr/, a directory holding nothing but the Dockerfile, while the Dockerfile copies scripts/log4j2.solr.xml from the repository root. CI never noticed because .github/workflows/docker.yml builds the same Dockerfile with the repo root as context - compose and CI were building the image two different ways and only CI's way worked. Compose now matches CI. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent 3d202f0 commit f519da8

3 files changed

Lines changed: 21 additions & 3 deletions

File tree

Dockerfile.test

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,13 @@ ENV DSPACE_INSTALL=/dspace
5757
ENV TOMCAT_INSTALL=/usr/local/tomcat
5858
# Copy the /dspace directory from 'ant_build' containger to /dspace in this container
5959
COPY --from=ant_build /dspace $DSPACE_INSTALL
60-
# Need host command for "[dspace]/bin/make-handle-config"
60+
# host: needed by "[dspace]/bin/make-handle-config"
61+
# curl: used by the container healthcheck in docker-compose.yml. The tomcat base image
62+
# ships it today, but the probe must not silently depend on that staying true: if
63+
# curl went away the container would never report healthy, service_healthy would
64+
# block dspace-angular, and autoheal would restart a container that is actually fine.
6165
RUN apt-get update \
62-
&& apt-get install -y --no-install-recommends host \
66+
&& apt-get install -y --no-install-recommends host curl \
6367
&& apt-get purge -y --auto-remove \
6468
&& rm -rf /var/lib/apt/lists/*
6569
# Enable the AJP connector in Tomcat's server.xml

docker-compose.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,13 @@ services:
209209
autoheal: "true"
210210
image: "${DOCKER_OWNER:-dspace}/dspace-solr:${DSPACE_VER:-dspace-7.6.5}"
211211
build:
212-
context: ./dspace/src/main/docker/dspace-solr/
212+
# Context is the repository root, matching .github/workflows/docker.yml. The
213+
# Dockerfile does `COPY scripts/log4j2.solr.xml`, which lives at the repo root,
214+
# so the narrower ./dspace/src/main/docker/dspace-solr/ context used before made
215+
# `docker compose build dspacesolr` fail with "/scripts/log4j2.solr.xml: not found"
216+
# while CI built the same image fine.
217+
context: .
218+
dockerfile: ./dspace/src/main/docker/dspace-solr/Dockerfile
213219
# Provide path to Solr configs necessary to build Docker image
214220
additional_contexts:
215221
solrconfigs: ./dspace/solr/

dspace/src/main/docker/dspace-solr/Dockerfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,12 @@ RUN chown -R solr:solr /opt/solr/server/solr/configsets
3737

3838
COPY scripts/log4j2.solr.xml /var/solr/log4j2.xml
3939

40+
41+
# curl: used by the container healthcheck in docker-compose.yml, which asks the CoreAdmin
42+
# API whether the "search" core is registered. The solr:*-slim base ships curl today, but
43+
# the probe must not silently depend on that: without it Solr would never report healthy,
44+
# service_healthy would block the backend, and autoheal would restart a healthy container.
45+
RUN apt-get update \
46+
&& apt-get install -y --no-install-recommends curl \
47+
&& rm -rf /var/lib/apt/lists/*
4048
USER solr

0 commit comments

Comments
 (0)