fix: repair minio-init cors setup script
All checks were successful
CI / test (push) Successful in 26s
All checks were successful
CI / test (push) Successful in 26s
- replace fragile heredoc in compose entrypoint - use shell-safe printf json for mc cors set
This commit is contained in:
@@ -86,23 +86,14 @@ services:
|
|||||||
image: minio/mc:latest
|
image: minio/mc:latest
|
||||||
depends_on:
|
depends_on:
|
||||||
- minio
|
- minio
|
||||||
entrypoint: >
|
entrypoint:
|
||||||
/bin/sh -c "
|
- /bin/sh
|
||||||
mc alias set local http://minio:9000 ${MINIO_ROOT_USER:-minioadmin} ${MINIO_ROOT_PASSWORD:-minioadmin} &&
|
- -ec
|
||||||
mc mb --ignore-existing local/${S3_BUCKET_NAME:-messenger-media} &&
|
- >
|
||||||
cat > /tmp/cors-rules.json <<EOF &&
|
mc alias set local http://minio:9000 ${MINIO_ROOT_USER:-minioadmin} ${MINIO_ROOT_PASSWORD:-minioadmin};
|
||||||
[
|
mc mb --ignore-existing local/${S3_BUCKET_NAME:-messenger-media};
|
||||||
{
|
printf '[{"AllowedHeaders":["*"],"AllowedMethods":["GET","PUT","POST","HEAD"],"AllowedOrigins":["%s"],"ExposeHeaders":["ETag"],"MaxAgeSeconds":3600}]' "${S3_CORS_ALLOW_ORIGIN:-*}" > /tmp/cors-rules.json;
|
||||||
\"AllowedHeaders\": [\"*\"],
|
mc cors set local/${S3_BUCKET_NAME:-messenger-media} /tmp/cors-rules.json
|
||||||
\"AllowedMethods\": [\"GET\", \"PUT\", \"POST\", \"HEAD\"],
|
|
||||||
\"AllowedOrigins\": [\"${S3_CORS_ALLOW_ORIGIN:-*}\"],
|
|
||||||
\"ExposeHeaders\": [\"ETag\"],
|
|
||||||
\"MaxAgeSeconds\": 3600
|
|
||||||
}
|
|
||||||
]
|
|
||||||
EOF
|
|
||||||
mc cors set local/${S3_BUCKET_NAME:-messenger-media} /tmp/cors-rules.json
|
|
||||||
"
|
|
||||||
restart: "no"
|
restart: "no"
|
||||||
|
|
||||||
backend:
|
backend:
|
||||||
|
|||||||
Reference in New Issue
Block a user