[PECL-CVS] [pecl-search_engine-solr] master: docker: fix test setup
[email protected] (omars44) Thu, 25 Jun 2026 04:52:03 +0000
| Newsgroups | php.pecl.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: omars44 (omars44)
Date: 2025-11-17T09:33:56+02:00
Commit: https://github.com/php/pecl-search_engine-solr/commit/013673dc143ef7f8f42fa352919a87781b4da96c
Raw diff: https://github.com/php/pecl-search_engine-solr/commit/013673dc143ef7f8f42fa352919a87781b4da96c.diff
docker: fix test setup
Changed paths:
A tests/docker/init-solr.sh
M docker-compose.yml
M tests/docker/Dockerfile
Diff:
diff --git a/docker-compose.yml b/docker-compose.yml
index 46e7e44c..770746e3 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -1,7 +1,5 @@
-version: '2.1'
-
services:
solr:
build: tests/docker/
ports:
- - "8983:8983"
+ - "127.0.0.1:8983:8983"
diff --git a/tests/docker/Dockerfile b/tests/docker/Dockerfile
index 6d06d7ea..8c967453 100644
--- a/tests/docker/Dockerfile
+++ b/tests/docker/Dockerfile
@@ -1,11 +1,5 @@
-FROM bitnami/solr:9.8.1
+FROM solr:9.10.0-slim
-COPY collections collections
+COPY collections /opt/solr-configs
-RUN solr start &&\
- solr create -c collection1 &&\
- solr create -c metal_store &&\
- solr create -c myfiles &&\
- curl 'http://localhost:8983/solr/collection1/update/json?commit=true' --data-binary @collections/collection1.json -H 'Content-type:application/json' &&\
- curl 'http://localhost:8983/solr/metal_store/update/json?commit=true' --data-binary @collections/metal_store.json -H 'Content-type:application/json' &&\
- solr stop
+COPY --chmod=755 init-solr.sh /docker-entrypoint-initdb.d/init-solr.sh
\ No newline at end of file
diff --git a/tests/docker/init-solr.sh b/tests/docker/init-solr.sh
new file mode 100644
index 00000000..0f73af30
--- /dev/null
+++ b/tests/docker/init-solr.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+set -e
+
+echo "Starting temporary Solr server for initialization..."
+solr start
+
+echo "Solr server is running. Creating collections with default configs..."
+
+solr create -c collection1
+solr create -c metal_store
+solr create -c myfiles
+
+echo "Collections created. Indexing data..."
+
+curl 'http://localhost:8983/solr/collection1/update/json?commit=true' --data-binary @/opt/solr-configs/collection1.json -H 'Content-type:application/json'
+curl 'http://localhost:8983/solr/metal_store/update/json?commit=true' --data-binary @/opt/solr-configs/metal_store.json -H 'Content-type:application/json'
+
+echo "Data indexed. Stopping temporary Solr server..."
+solr stop
+echo "Solr initialization complete."
\ No newline at end of file