postgres shadow
Build and Push Docker Images / build-and-push (push) Failing after 14s

This commit is contained in:
2025-05-21 21:06:41 +02:00
parent 4e237f1737
commit 9fff5cef23
5 changed files with 103 additions and 26 deletions
-25
View File
@@ -1,25 +0,0 @@
#!/bin/bash
set -e
# Wait for PostgreSQL to be ready
until pg_isready; do
echo "Waiting for PostgreSQL to be ready..."
sleep 2
done
# Create the target database
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
CREATE DATABASE $TARGET_DB_NAME;
EOSQL
# Copy the database if SOURCE_DB_URL is provided
if [ ! -z "$SOURCE_DB_URL" ]; then
echo "Copying database from $SOURCE_DB_URL to $TARGET_DB_NAME..."
# Dump the source database
pg_dump "$SOURCE_DB_URL" | psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$TARGET_DB_NAME"
echo "Database copy completed successfully"
else
echo "No SOURCE_DB_URL provided, skipping database copy"
fi