diff --git a/docker-compose.yml b/docker-compose.yml index 19e38809a..703568166 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -57,19 +57,23 @@ services: ports: - $MINIO_PORT:9000 env_file: .env + healthcheck: + test: ["CMD", "nc", "-z", "minio", "9000"] + interval: 5s + retries: 5 createbuckets: image: minio/mc depends_on: - - minio + minio: + condition: service_healthy env_file: .env # volumes: # This volume is shared with `minio`, so `z` to share it # - ./var/minio:/export entrypoint: > /bin/sh -c " - set -x - while ! nc -z minio 9000; echo 'Waiting for minio to startup...' && sleep 5; + set -x; if [ -n \"$MINIO_ACCESS_KEY\" ] && [ -n \"$MINIO_SECRET_KEY\" ] && [ -n \"$MINIO_PORT\" ]; then until /usr/bin/mc config host add minio_docker http://minio:$MINIO_PORT $MINIO_ACCESS_KEY $MINIO_SECRET_KEY && break; do echo '...waiting...' && sleep 5; done; /usr/bin/mc mb minio_docker/$AWS_STORAGE_BUCKET_NAME; @@ -77,7 +81,7 @@ services: /usr/bin/mc anonymous set download minio_docker/$AWS_STORAGE_BUCKET_NAME; else echo 'MINIO_ACCESS_KEY, MINIO_SECRET_KEY, or MINIO_PORT are not defined. Skipping buckets creation.'; - fi + fi; exit 0; "