docker-getgrav/entrypoint.sh
mwalbeck 5f9124a283
All checks were successful
continuous-integration/drone/push Build is passing
Lint dockerfiles and entrypoint scripts and add CI pipeline for linting (#67)
Add shellcheck for linting entrypoint scripts.

Add hadolint for linting Dockerfiles.

Co-authored-by: Magnus Walbeck <magnus.walbeck@walbeck.it>
Reviewed-on: #67
Co-Authored-By: mwalbeck <magnus.walbeck@walbeck.it>
Co-Committed-By: mwalbeck <magnus.walbeck@walbeck.it>
2021-02-03 14:52:09 +00:00

31 lines
628 B
Bash
Executable File

#!/bin/sh
set -eu
UID=${UID:-33}
GID=${GID:-33}
GRAV_FOLDER=${GRAV_FOLDER:-html}
usermod -o -u "$UID" foo
groupmod -o -g "$GID" foo
mkdir -p /var/www/"$GRAV_FOLDER"
cd /var/www/"$GRAV_FOLDER"
rsync -rlD --delete \
--exclude /backup/ \
--exclude /logs/ \
--exclude /tmp/ \
--exclude /vendor/ \
--exclude /user/ \
/usr/share/grav/ /var/www/"$GRAV_FOLDER"
mkdir -p assets backup cache images logs tmp
bin/grav install
bin/grav clearcache
chown foo /proc/self/fd/1 /proc/self/fd/2
chown -R --from=root:root foo:foo /var/www/"$GRAV_FOLDER"
exec gosu foo "$@"