mirror of
https://github.com/Mezeporta/Erupe.git
synced 2026-03-22 15:43:49 +01:00
- 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
27 lines
696 B
Bash
Executable File
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!"
|