diff --git a/Dockerfile b/Dockerfile index 917e151..a3137fd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -38,7 +38,7 @@ FROM python:3.12-slim WORKDIR /app RUN apt-get update && apt-get install -y --no-install-recommends \ - libpq5 curl tini supervisor nginx \ + libpq5 postgresql-client curl tini supervisor nginx \ && rm -rf /var/lib/apt/lists/* \ && apt-get clean diff --git a/entrypoint.sh b/entrypoint.sh index 320d2e3..7b131c2 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,9 +1,10 @@ #!/bin/sh set -e -# Extract host and port from DATABASE_URL for wait check +# Extract host and port from DATABASE_URL +# Format: postgresql+asyncpg://user:pass@host:port/dbname DB_HOST=$(echo "$DATABASE_URL" | sed -E 's|.*@([^/:]+).*|\1|') -DB_PORT=$(echo "$DATABASE_URL" | sed -E 's|.*:[0-9]+/([0-9]+).*|\1|' | head -1) +DB_PORT=$(echo "$DATABASE_URL" | sed -E 's|.*@[^/:]+:([0-9]+)/.*|\1|') if [ -z "$DB_PORT" ] || [ "$DB_PORT" = "$DB_HOST" ]; then DB_PORT="5432" @@ -25,5 +26,4 @@ done echo "postgres is ready!" -# Execute the passed command (supervisord) exec "$@"