Files
minio-build/docker-entrypoint.sh

16 lines
738 B
Bash
Executable File

#!/bin/sh
# Mirrors upstream's entrypoint: bare args (`server /data`) run as `minio server /data`; other binaries
# (sh, mc, curl) run as given; MINIO_USERNAME/GROUPNAME drop privileges the same way.
if [ "${1}" != "minio" ] && [ -n "${1}" ] && ! command -v "${1}" >/dev/null 2>&1; then
set -- minio "$@"
fi
if [ -n "${MINIO_USERNAME}" ] && [ -n "${MINIO_GROUPNAME}" ]; then
if [ -n "${MINIO_UID}" ] && [ -n "${MINIO_GID}" ]; then
exec chroot --userspec="${MINIO_UID}:${MINIO_GID}" / "$@"
fi
echo "${MINIO_USERNAME}:x:1000:1000:${MINIO_USERNAME}:/:/sbin/nologin" >>/etc/passwd
echo "${MINIO_GROUPNAME}:x:1000:" >>/etc/group
exec chroot --userspec="${MINIO_USERNAME}:${MINIO_GROUPNAME}" / "$@"
fi
exec "$@"