refactor(docker): improve Docker setup and reduce image size

- Add multi-stage build to Dockerfile for smaller production image
- Move docker-compose.yml to project root for easier usage
- Flatten docker/init/setup.sh to docker/setup.sh
- Expand .dockerignore to exclude unnecessary files
- Remove deprecated version field from compose files
This commit is contained in:
Houmgaor
2026-02-01 23:49:52 +01:00
parent dc49e5c34a
commit 160130e464
5 changed files with 62 additions and 19 deletions

26
docker/setup.sh Executable file
View File

@@ -0,0 +1,26 @@
#!/bin/bash
set -e
echo "INIT!"
pg_restore --username="$POSTGRES_USER" --dbname="$POSTGRES_DB" --verbose /schemas/init.sql
echo "Updating!"
if ls /schemas/update-schema/*.sql 1> /dev/null 2>&1; then
for file in /schemas/update-schema/*.sql
do
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" -1 -f "$file"
done
else
echo "No update schemas found"
fi
echo "Patching!"
if ls /schemas/patch-schema/*.sql 1> /dev/null 2>&1; then
for file in /schemas/patch-schema/*.sql
do
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" -1 -f "$file"
done
else
echo "No patch schemas found"
fi
echo "Database initialization complete!"