Merge pull request #237 from nextcloud/fix/235/fix-database-import

fix database import by waiting for the database to start
This commit is contained in:
Simon L 2022-02-18 11:44:12 +01:00 committed by GitHub
commit 89830a1b81
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View file

@ -1,7 +1,7 @@
# From https://github.com/docker-library/postgres/blob/master/13/alpine/Dockerfile
FROM postgres:13.5-alpine3.15
RUN apk add --update --no-cache bash openssl shadow
RUN apk add --update --no-cache bash openssl shadow netcat-openbsd
# We need to use the same gid and uid as on old installations
RUN set -ex; \

View file

@ -58,8 +58,11 @@ if ( [ -f "$DATADIR/PG_VERSION" ] && [ "$PG_MAJOR" != "$(cat "$DATADIR/PG_VERSIO
# Create new database
exec docker-entrypoint.sh postgres &
# Wait 10s for creation
sleep 10s
# Wait for creation
while ! nc -z localhost 11000; do
echo "Waiting for the database to start."
sleep 5
done
# Set correct permissions
if grep -q "Owner: oc_admin" "$DUMP_FILE" && ! grep -q "Owner: oc_$POSTGRES_USER" "$DUMP_FILE"; then