Created
July 27, 2022 23:35
-
-
Save leewardbound/0df7b619fadc76e9ccb9f816985573c3 to your computer and use it in GitHub Desktop.
Self-serve minio container, automatically creates bucket at container startup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Self-service Minio container | |
# Automatically creates the $MINIO_BUCKET bucket and configures it for public downloads | |
FROM minio/mc AS mc | |
FROM minio/minio | |
RUN echo $'#!/usr/bin/env sh \n\ | |
cat /bin/start-minio.sh \n\ | |
AWAIT_STARTUP="sleep 5" \n\ | |
CONFIGURE_ROOT="mc config host add local http://minio:9000 $MINIO_ROOT_USER $MINIO_ROOT_PASSWORD" \n\ | |
DELETE_BUCKET="mc rm -r --force local/$MINIO_BUCKET || true" \n\ | |
CREATE_BUCKET="mc mb local/$MINIO_BUCKET" \n\ | |
ALLOW_DOWNLOADS="mc policy download local/$MINIO_BUCKET" \n\ | |
sh -c "$AWAIT_STARTUP && $CONFIGURE_ROOT && $CREATE_BUCKET && $ALLOW_DOWNLOADS" & \n\ | |
$*' > /bin/start-minio.sh | |
RUN chmod +x /bin/start-minio.sh | |
COPY --from=mc /usr/bin/mc /usr/bin/mc | |
ENTRYPOINT ["/bin/start-minio.sh"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment