Files
Erupe/docker/setup.sh
Houmgaor 160130e464 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
2026-02-01 23:49:52 +01:00

27 lines
696 B
Bash
Executable File

#!/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!"