Closed RossBarnie closed 4 years ago
I would prefer not to introduce extra complexity to the extension unless necessary.
You can use the bash script below to create your ownhadolint
executable.
$ cat ~/.bin/hadolint ~
#!/bin/bash
docker run --rm -i hadolint/hadolint < "$@"
---
$ hadolint Dockerfile ⏎
/dev/stdin:3 DL3008 Pin versions in apt get install. Instead of `apt-get in
stall <package>` use `apt-get install <package>=<version>`
/dev/stdin:3 DL3009 Delete the apt-get lists after installing something
/dev/stdin:3 DL3015 Avoid additional packages by specifying `--no-install-r
ecommends`
If the file does not exist under $PATH
, you can use the custom hadolint.hadolintPath
to set the path.
As this extension may add some Hadolint options (see setting hadolint.cliOptions
set to --no-color
by default), I am using the following workaround wrapper script based on Podman:
#!/bin/bash
dockerfile="$1"
shift
podman run --rm -i docker.io/hadolint/hadolint hadolint "$@" - < "$dockerfile"
Feature Request
Happy to help with implementation/testing if feature accepted.
Summary
Currently we must select an executable to run hadolint however I do not want to have to build and then maintain my local hadolint executable so I'd like to specify the VSCode extension to always run hadolint from its docker image, like so
docker run --rm -i $IMAGE < $FILE_TO_LINT
whereIMAGE
is the specified image in the config variable, andFILE_TO_LINT
is the dockerfile to be linted.Additional Configuration Variables
Run from docker image
- A checkbox with a note along the lines of "This overrides the executable path variable. Runs hadolint from the hadolint/hadolint docker image". Unchecked by default, extension runs as normal using the executable. When checked, uses the docker image specified and runs as a container.hadolint docker image
- the name and tag of the image, eg the default would behadolint/hadolint:latest