ff
This commit is contained in:
36
solr.Dockerfile
Normal file
36
solr.Dockerfile
Normal file
@@ -0,0 +1,36 @@
|
||||
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
|
||||
COPY <<EOF /opt/solr-init.sh
|
||||
#!/bin/bash
|
||||
echo "Starting Solr..."
|
||||
solr start -f &
|
||||
SOLR_PID=\$!
|
||||
echo "Waiting for Solr to be ready..."
|
||||
sleep 15
|
||||
echo "Creating cores..."
|
||||
(solr create_core -c storycove_stories -d storycove_stories || echo "Stories core already exists")
|
||||
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
|
||||
|
||||
# Ensure proper permissions
|
||||
RUN chown -R solr:solr /opt/solr-9.9.0/server/solr/configsets/ && \
|
||||
chmod +x /opt/solr-init.sh && \
|
||||
chown solr:solr /opt/solr-init.sh
|
||||
|
||||
# Switch back to solr user
|
||||
USER solr
|
||||
|
||||
# Set the entrypoint to our initialization script
|
||||
ENTRYPOINT ["/opt/solr-init.sh"]
|
||||
Reference in New Issue
Block a user