kartoza / docker-postgis

Dockerfile for postgis
GNU General Public License v2.0
660 stars 313 forks source link

Wrong value for var DEFAULT_SCRIPTS_LOCKFILE_DIR #479

Closed vidlb closed 3 months ago

vidlb commented 3 months ago

What is the bug or the crash?

The default value here https://github.com/kartoza/docker-postgis/blob/7d7c5946db0c6b8a55ec228cfd205791ef5e95ca/scripts/env-data.sh#L9 is different that the one in the docs (or the official postgres image), it should be docker-entrypoint-initdb.d.
This results in a lockfile created in the wrong path, thus it won't get cached in case this directory is used as a volume.

Steps to reproduce the issue

echo "create table test (gid integer);" > setup-db.sql
docker run --name testdb -d -v `pwd`/setup-db.sql:/docker-entrypoint-initdb.d/setup-db.sql kartoza/postgis:16
docker exec testdb ls -A /docker-entrypoint-initdb.d
# setup-db.sql
docker exec testdb ls -A /docker-entrypoint.initdb.d
# .entry_point.lock

Versions

Starting from 14 to latest, 13 isn't affected

Trying to mount a directory of sql scripts as a volume to this target dir, and want to preserve the lockfile in future containers where pgdata volume already exists (in order to avoid re-init db).

NyakudyaA commented 3 months ago

Can you send a PR with the fix

vidlb commented 3 months ago

I was thinking you wouldn't accept a one-char-diff PR, but here it is !