mirror of
https://github.com/Mezeporta/Erupe.git
synced 2026-03-22 15:43:49 +01:00
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:
26
docker/setup.sh
Executable file
26
docker/setup.sh
Executable 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!"
|
||||
Reference in New Issue
Block a user