Skip to content
Snippets Groups Projects
Commit 2d52f714 authored by nimrod's avatar nimrod
Browse files

Integrate dockerfile_lint to my Docker image.

- Include the npm package and sample rules in the image.
- Add a script to lint all files passed (otherwise just the first is
checked).
parent 9276abde
No related branches found
No related tags found
No related merge requests found
* *
!docker-compose-config !docker-compose-config
!dockerfile-lint
...@@ -12,10 +12,8 @@ ...@@ -12,10 +12,8 @@
description: A rule based 'linter' for Dockerfiles description: A rule based 'linter' for Dockerfiles
minimum_pre_commit_version: '0.18.0' minimum_pre_commit_version: '0.18.0'
language: docker_image language: docker_image
entry: projectatomic/dockerfile-lint dockerfile_lint entry: adarnimrod/docker-pre-commit dockerfile-lint
args: [ '-f' ]
types: [ dockerfile ] types: [ dockerfile ]
require_serial: true
- id: docker-compose - id: docker-compose
name: docker-compose config name: docker-compose config
description: Validate the Docker Compose file using docker-compose config description: Validate the Docker Compose file using docker-compose config
......
FROM alpine:3.10 FROM alpine:3.10
RUN apk add --update --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing/ docker-compose && \ RUN apk add --update --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing/ \
docker-compose \
npm \
&& \
docker-compose --version && \
wget https://github.com/projectatomic/dockerfile_lint/archive/v0.3.3.tar.gz -O /tmp/dockerfile_lint.tar.gz && \
npm install --global /tmp/dockerfile_lint.tar.gz && \
install -d -o root -g root -m 755 /sample_rules && \
tar -xzf /tmp/dockerfile_lint.tar.gz -C /tmp/ && \
cp /tmp/dockerfile_lint*/sample_rules/*.yaml /sample_rules/ && \
rm -rf /tmp/dockerfile_lint* && \
dockerfile_lint --help && \
wget https://github.com/hadolint/hadolint/releases/download/v1.17.1/hadolint-Linux-x86_64 -O /usr/local/bin/hadolint && \ wget https://github.com/hadolint/hadolint/releases/download/v1.17.1/hadolint-Linux-x86_64 -O /usr/local/bin/hadolint && \
chmod +x /usr/local/bin/hadolint chmod +x /usr/local/bin/hadolint && \
COPY docker-compose-config /usr/local/bin/ hadolint --version
COPY docker-compose-config dockerfile-lint /usr/local/bin/
USER nobody
#!/bin/sh
set -eu
echo "$@" | xargs -rtn1 dockerfile_lint --dockerfile
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment