From 62404acb4478dc1d7fc3d347ce10bd86b352fb8e Mon Sep 17 00:00:00 2001 From: Yohan9206 Date: Sun, 3 Aug 2025 23:39:37 +0300 Subject: [PATCH] fix --- Dockerfile | 2 +- start.sh | 24 +++++++++++++++--------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index 59ca6c7d89..b779b45e43 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,7 +19,7 @@ RUN mix local.hex --force && \ mix deps.get && \ mix compile -RUN mix do ecto.create, ecto.migrate +#RUN mix do ecto.create, ecto.migrate RUN mix phx.digest && MIX_ENV=prod mix release diff --git a/start.sh b/start.sh index 65f5846279..93f1f83b28 100644 --- a/start.sh +++ b/start.sh @@ -1,9 +1,8 @@ #!/bin/sh -# Start PostgreSQL for Blockscout -docker-entrypoint.sh postgres & +set -e -# Wait for DB to be ready -until pg_isready -h localhost -p 5432; do +# Wait for Postgres to be ready (assumes external Postgres service) +until pg_isready -h "$DB_HOST" -p "$DB_PORT"; do echo "Waiting for Postgres..." sleep 2 done @@ -15,12 +14,19 @@ geth --dev \ --ws --ws.addr 0.0.0.0 \ --allow-insecure-unlock --mine --nodiscover & +# Set environment variables for Blockscout +export DATABASE_URL="postgresql://postgres:postgres@${DB_HOST:-localhost}:${DB_PORT:-5432}/blockscout" +export ETHEREUM_JSONRPC_HTTP_URL="http://localhost:8545" +export PORT=4000 +export MIX_ENV=prod + +cd /blockscout + +# Run DB setup +mix ecto.create +mix ecto.migrate + # Start Blockscout -cd /blockscout && \ -DATABASE_URL=postgresql://postgres:postgres@localhost:5432/blockscout \ -ETHEREUM_JSONRPC_HTTP_URL=http://localhost:8545 \ -PORT=4000 \ -MIX_ENV=prod \ /blockscout/_build/prod/rel/blockscout/bin/blockscout start wait \ No newline at end of file