Skip to content

Commit

Permalink
Merge pull request #370 from govCMS/update-dockerfile-solr
Browse files Browse the repository at this point in the history
[GOVCMSD10-361] Update Dockerfile.solr
  • Loading branch information
steveworley authored Nov 16, 2023
2 parents 45c971a + b74de89 commit d76f319
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 5 deletions.
13 changes: 8 additions & 5 deletions .docker/Dockerfile.solr
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,20 @@
# Solr 8
##

# Use the specified CLI image for building
ARG CLI_IMAGE
FROM ${CLI_IMAGE} as cli

# Use the uselagoon/solr-8 as the base image
FROM uselagoon/solr-8

# The Drupal module now provides valid jump start configuration sets for solr.
# Copy the jump-start configuration sets for Solr from the CLI image to the Solr image
COPY --from=cli /app/web/modules/contrib/search_api_solr/jump-start/solr8/config-set/ /opt/solr/server/solr/configsets/drupal/conf

# Switch to the 'solr' user
USER solr

# Solr-precreate is provided by the base solr docker image and is
# responsible for precreating the core and then starting solr in
# the foreground.
CMD solr-precreate drupal /opt/solr/server/solr/configsets/drupal
COPY .docker/images/solr/900-prepare-index.sh /lagoon/entrypoints/

# Run solr in the foreground.
CMD ["solr-foreground"]
22 changes: 22 additions & 0 deletions .docker/images/solr/900-prepare-index.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/bash

# Prepare the index.
#
# If the release requires a configset update then an
# environment variable needs to be present, this will
# recreate the solr core otherwise the core will be
# precreated (or skipped if it exists).

INDEX="${INDEX:-drupal}"
CONFIGSET="${CONFIGSET:-/opt/solr/server/solr/configsets/drupal}"

# The following scripts are provided by the base images.
if [ -n "$GOVCMS_SOLR_RECREATE" ]; then
# solr-recreate will remove the index data and configuration
# and rebuild from the configset provided.
solr-recreate "$INDEX" "$CONFIGSET"
else
# solr-precreate will initialise the solr data/conf directories
# if they exist on disk, this will skip.
solr-precreate "$INDEX" "$CONFIGSET"
fi

0 comments on commit d76f319

Please sign in to comment.