all-in-one/.github/workflows/docker-lint.yml
Simon L 71e77c2147 fix some workflows
Signed-off-by: Simon L <szaimen@e.mail.de>
2023-06-06 10:30:32 +02:00

55 lines
1.4 KiB
YAML

name: Docker Lint
on:
pull_request:
paths:
- 'Containers/**'
push:
branches:
- main
paths:
- 'Containers/**'
permissions:
contents: read
concurrency:
group: docker-lint-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
docker-lint:
runs-on: ubuntu-latest
name: docker-lint
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install npm and dockerfilelint
run: |
sudo apt-get update
sudo apt-get install nodejs npm -y --no-install-recommends
npm install -g dockerfilelint
wget https://github.com/replicatedhq/dockerfilelint/pull/184.patch -O /usr/local/lib/node_modules/dockerfilelint/184.patch
CURRENT_DIR=$PWD
cd /usr/local/lib/node_modules/dockerfilelint/
git apply 184.patch
cd $CURRENT_DIR
cat << RULES > ./.dockerfilelintrc
rules:
sudo_usage: off
RULES
- name: run lint
run: |
DOCKERFILES="$(find ./Containers -name Dockerfile)"
mapfile -t DOCKERFILES <<< "$DOCKERFILES"
for file in "${DOCKERFILES[@]}"; do
dockerfilelint "$file" --config ./ | tee -a ./dockerfilelint.log
done
if grep "^Issues: [0-9]" ./dockerfilelint.log; then
exit 1
fi