1
0
mirror of https://github.com/vimagick/dockerfiles.git synced 2024-12-25 02:04:06 +02:00
dockerfiles/ghost/arm/docker-entrypoint.sh
2017-08-06 10:34:48 +08:00

25 lines
649 B
Bash
Executable File

#!/bin/bash
set -e
# allow the container to be started with `--user`
if [[ "$*" == node*current/index.js* ]] && [ "$(id -u)" = '0' ]; then
chown -R node "$GHOST_CONTENT"
exec su-exec node "$BASH_SOURCE" "$@"
fi
if [[ "$*" == node*current/index.js* ]]; then
baseDir="$GHOST_INSTALL/content.orig"
for src in "$baseDir"/*/ "$baseDir"/themes/*; do
src="${src%/}"
target="$GHOST_CONTENT/${src#$baseDir/}"
mkdir -p "$(dirname "$target")"
if [ ! -e "$target" ]; then
tar -cC "$(dirname "$src")" "$(basename "$src")" | tar -xC "$(dirname "$target")"
fi
done
knex-migrator-migrate --init --mgpath "$GHOST_INSTALL/current"
fi
exec "$@"