docker-compose.yml: use a pre-build inventaire image and env_file=.env

and customize CouchDB entrypoint script to fix the issue of the missing _users database
This commit is contained in:
maxlath
2025-02-26 20:55:53 +01:00
parent 9187c32c00
commit 69db3e1a86
6 changed files with 48 additions and 24 deletions

View File

@@ -0,0 +1,14 @@
FROM couchdb:3.4.2
COPY docker-custom-entrypoint.sh /usr/local/bin/docker-custom-entrypoint.sh
COPY init_users_db.sh /usr/local/bin/init_users_db.sh
ENTRYPOINT ["tini", "--", "/usr/local/bin/docker-custom-entrypoint.sh"]
EXPOSE 5984
# Copied from the couchdb image Dockerfile
# https://github.com/apache/couchdb-docker/blob/734c61f/3.4.2/Dockerfile#L104
# as it would have been otherwise reset to an empty string
# See https://docs.docker.com/reference/dockerfile/#understand-how-cmd-and-entrypoint-interact
CMD ["/opt/couchdb/bin/couchdb"]

View File

@@ -0,0 +1,3 @@
#!/bin/bash
/usr/local/bin/init_users_db.sh &
tini -- /docker-entrypoint.sh "$@"

12
couchdb/init_users_db.sh Executable file
View File

@@ -0,0 +1,12 @@
#!/bin/bash
while :; do {
echo "[init_users_db.sh] Waiting for CouchDB to be online to initialize the _users database"
curl http://localhost:5984 && {
echo "[init_users_db.sh] CouchDB is online! Trying to initialize _users database"
curl --user "$COUCHDB_USER:$COUCHDB_PASSWORD" -XPUT http://localhost:5984/_users
break
} || {
sleep 1
}
}; done