From 0d127ee3a3c5eb3f6aa63e7a18c1fbb87fae1531 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Louis=20B=C3=A9ziaud?= Date: Wed, 12 Apr 2023 22:02:15 +0200 Subject: [PATCH] fix createbuckets entrypoint - add missing semicolons in sh script - nc is not available in minio/mc. add healthcheck on minio service and wait for it instead --- docker-compose.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) 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; "