ff
This commit is contained in:
@@ -7,30 +7,25 @@ USER root
|
|||||||
COPY ./solr/stories /opt/solr-9.9.0/server/solr/configsets/storycove_stories
|
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
|
COPY ./solr/authors /opt/solr-9.9.0/server/solr/configsets/storycove_authors
|
||||||
|
|
||||||
# Create initialization script
|
# Create initialization script using the precreate-core pattern
|
||||||
COPY <<EOF /opt/solr-init.sh
|
COPY <<EOF /docker-entrypoint-initdb.d/init-cores.sh
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
echo "Starting Solr..."
|
echo "StoryCove: Initializing cores..."
|
||||||
solr start -f &
|
|
||||||
SOLR_PID=\$!
|
# Use solr's built-in precreate-core functionality
|
||||||
echo "Waiting for Solr to be ready..."
|
precreate-core storycove_stories /opt/solr-9.9.0/server/solr/configsets/storycove_stories
|
||||||
sleep 15
|
precreate-core storycove_authors /opt/solr-9.9.0/server/solr/configsets/storycove_authors
|
||||||
echo "Creating cores..."
|
|
||||||
(solr create_core -c storycove_stories -d storycove_stories || echo "Stories core already exists")
|
echo "StoryCove: Core initialization complete!"
|
||||||
echo "Stories core ready"
|
|
||||||
(solr create_core -c storycove_authors -d storycove_authors || echo "Authors core already exists")
|
|
||||||
echo "Authors core ready"
|
|
||||||
echo "Both cores are available"
|
|
||||||
wait \$SOLR_PID
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# Ensure proper permissions
|
# Ensure proper permissions and make script executable
|
||||||
RUN chown -R solr:solr /opt/solr-9.9.0/server/solr/configsets/ && \
|
RUN chown -R solr:solr /opt/solr-9.9.0/server/solr/configsets/ && \
|
||||||
chmod +x /opt/solr-init.sh && \
|
chmod +x /docker-entrypoint-initdb.d/init-cores.sh && \
|
||||||
chown solr:solr /opt/solr-init.sh
|
chown solr:solr /docker-entrypoint-initdb.d/init-cores.sh
|
||||||
|
|
||||||
# Switch back to solr user
|
# Switch back to solr user
|
||||||
USER solr
|
USER solr
|
||||||
|
|
||||||
# Set the entrypoint to our initialization script
|
# Use the default Solr entrypoint
|
||||||
ENTRYPOINT ["/opt/solr-init.sh"]
|
CMD ["solr-foreground"]
|
||||||
Reference in New Issue
Block a user