Files
storycove/solr.Dockerfile
Stefan Hardegger 726e699246 fix solr
2026-06-18 13:52:42 +02:00

39 lines
1.5 KiB
Docker

FROM solr:9.9.0
# Switch to root to set up configuration
USER root
# Copy Solr configurations into the image
COPY ./solr/stories /opt/solr-9.9.0/server/solr/configsets/storycove_stories
COPY ./solr/authors /opt/solr-9.9.0/server/solr/configsets/storycove_authors
# Create initialization script using the precreate-core pattern
COPY <<EOF /docker-entrypoint-initdb.d/init-cores.sh
#!/bin/bash
echo "StoryCove: Initializing cores..."
# Create cores on first startup (no-op if they already exist)
precreate-core storycove_stories /opt/solr-9.9.0/server/solr/configsets/storycove_stories
precreate-core storycove_authors /opt/solr-9.9.0/server/solr/configsets/storycove_authors
# Always sync schema files from the image so deployments pick up schema changes
cp -f /opt/solr-9.9.0/server/solr/configsets/storycove_stories/conf/managed-schema \
/var/solr/data/storycove_stories/conf/managed-schema
if [ -f /opt/solr-9.9.0/server/solr/configsets/storycove_authors/conf/managed-schema ]; then
cp -f /opt/solr-9.9.0/server/solr/configsets/storycove_authors/conf/managed-schema \
/var/solr/data/storycove_authors/conf/managed-schema
fi
echo "StoryCove: Core initialization complete!"
EOF
# Ensure proper permissions and make script executable
RUN chown -R solr:solr /opt/solr-9.9.0/server/solr/configsets/ && \
chmod +x /docker-entrypoint-initdb.d/init-cores.sh && \
chown solr:solr /docker-entrypoint-initdb.d/init-cores.sh
# Switch back to solr user
USER solr
# Use the default Solr entrypoint
CMD ["solr-foreground"]