1
0
mirror of https://github.com/vimagick/dockerfiles.git synced 2024-12-23 01:39:27 +02:00
dockerfiles/ghost/arm/docker-entrypoint.sh
2015-12-06 17:21:51 +08:00

26 lines
591 B
Bash
Executable File

#!/bin/bash
set -e
if [[ "$*" == npm*start* ]]; then
for dir in "$GHOST_SOURCE/content"/*/; do
targetDir="$GHOST_CONTENT/$(basename "$dir")"
mkdir -p "$targetDir"
if [ -z "$(ls -A "$targetDir")" ]; then
tar cC "$dir" . | tar xC "$targetDir"
fi
done
if [ ! -e "$GHOST_CONTENT/config.js" ]; then
sed -r '
s/127\.0\.0\.1/0.0.0.0/g;
s!path.join\(__dirname, (.)/content!path.join(process.env.GHOST_CONTENT, \1!g;
' "$GHOST_SOURCE/config.example.js" > "$GHOST_CONTENT/config.js"
fi
ln -sf "$GHOST_CONTENT/config.js" "$GHOST_SOURCE/config.js"
exec "$@"
fi
exec "$@"