Lint dockerfiles and add CI pipeline for linting #67

Merged
mwalbeck merged 9 commits from linting into master 2021-02-03 14:52:14 +00:00
3 changed files with 22 additions and 12 deletions
Showing only changes of commit 3073d6f018 - Show all commits

View file

@ -8,10 +8,20 @@ steps:
- name: Lint Dockerfiles - name: Lint Dockerfiles
image: hadolint/hadolint image: hadolint/hadolint
commands: commands:
- hadolint 1.6/Dockerfile - hadolint */Dockerfile*
- hadolint 1.6/Dockerfile.prod when:
- hadolint 1.7/Dockerfile status:
- hadolint 1.7/Dockerfile.prod - failure
- success
- name: Lint entrypoint scripts
image: koalaman/shellcheck-alpine
commands:
- shellcheck entrypoint*.sh
when:
status:
- failure
- success
trigger: trigger:
event: event:

View file

@ -3,8 +3,8 @@ set -eu
GRAV_FOLDER=${GRAV_FOLDER:-html} GRAV_FOLDER=${GRAV_FOLDER:-html}
mkdir -p /var/www/$GRAV_FOLDER mkdir -p /var/www/"$GRAV_FOLDER"
cd /var/www/$GRAV_FOLDER cd /var/www/"$GRAV_FOLDER"
rsync -rlD --delete \ rsync -rlD --delete \
--exclude /backup/ \ --exclude /backup/ \
@ -12,7 +12,7 @@ rsync -rlD --delete \
--exclude /tmp/ \ --exclude /tmp/ \
--exclude /vendor/ \ --exclude /vendor/ \
--exclude /user/ \ --exclude /user/ \
/usr/share/grav/ /var/www/$GRAV_FOLDER /usr/share/grav/ /var/www/"$GRAV_FOLDER"
mkdir -p assets backup cache images logs tmp mkdir -p assets backup cache images logs tmp
@ -20,6 +20,6 @@ bin/grav install
bin/grav clearcache bin/grav clearcache
chown www-data /proc/self/fd/1 /proc/self/fd/2 chown www-data /proc/self/fd/1 /proc/self/fd/2
chown -R --from=root:root www-data:www-data /var/www/$GRAV_FOLDER chown -R --from=root:root www-data:www-data /var/www/"$GRAV_FOLDER"
exec gosu www-data "$@" exec gosu www-data "$@"

View file

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