Integrate extensions creation in entry point

Requires postgresql-client to be added to the image

Closes #503

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2020-11-14 19:31:23 +01:00
parent 0a0ce4a833
commit 030f548f16
No known key found for this signature in database
GPG key ID: A061B9DDE0CA0773
2 changed files with 9 additions and 1 deletions

View file

@ -31,7 +31,7 @@ RUN mix phx.digest \
# Finally setup the app
FROM alpine
RUN apk add --no-cache openssl ncurses-libs file
RUN apk add --no-cache openssl ncurses-libs file postgresql-client
USER nobody
EXPOSE 4000

View file

@ -2,6 +2,14 @@
set -e
echo "-- Waiting for database..."
while ! pg_isready -U ${MOBILIZON_DATABASE_USERNAME} -d postgres://${MOBILIZON_DATABASE_HOST}:5432/${MOBILIZON_DATABASE_DBNAME} -t 1; do
sleep 1s
done
PGPASSWORD=$MOBILIZON_DATABASE_PASSWORD psql -U $MOBILIZON_DATABASE_USERNAME -d $MOBILIZON_DATABASE_DBNAME -h $MOBILIZON_DATABASE_HOST -c 'CREATE EXTENSION IF NOT EXISTS pg_trgm;'
PGPASSWORD=$MOBILIZON_DATABASE_PASSWORD psql -U $MOBILIZON_DATABASE_USERNAME -d $MOBILIZON_DATABASE_DBNAME -h $MOBILIZON_DATABASE_HOST -c 'CREATE EXTENSION IF NOT EXISTS unaccent;'
echo "-- Running migrations..."
/bin/mobilizon_ctl migrate