Files
dokku/docker/etc/my_init.d/10_dokku_init

48 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
set -eo pipefail
log-info() {
declare desc="Log info formatter"
echo " $*" 1>&2
}
log-fail() {
declare desc="Log fail formatter"
echo "! $*" 1>&2
exit 1
}
main() {
if [[ ! -d /mount ]]; then
log-info "Creating missing /mount"
mkdir -p /mount
fi
directories=("/etc/ssh" "/home/dokku" "/var/lib/dokku/config" "/var/lib/dokku/data")
for dir in "${directories[@]}"; do
if [[ ! -e "$dir" ]]; then
log-info "Copying ${dir} skel into place"
mkdir -p "/mount${dir}"
rsync -a "/skel${dir}/" "${dir}/" || log-fail "Unable to copy ${dir} skel into place"
fi
# chown mount directories to "dokku:dokku"
if [[ "$dir" != "/etc/ssh" ]]; then
find "$dir" -print0 | xargs -0 chown -h dokku:dokku
fi
done
if [[ -f /mount/plugin-list ]]; then
while read line; do
dokku plugin:install "$(echo "$line" | awk '{print $2}')" "$(echo "$line" | cut -d':' -f1)"
done </mount/plugin-list
fi
if [[ -n "$DOKKU_HOSTNAME" ]]; then
echo "dokku dokku/vhost_enable boolean true" | debconf-set-selections
dokku --quiet domains:set-global "$DOKKU_HOSTNAME"
fi
}
main "$@"