Skip to content

Instantly share code, notes, and snippets.

@vst
Created April 21, 2021 12:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vst/90e849a1d2249d4a713b98dcc53db637 to your computer and use it in GitHub Desktop.
Save vst/90e849a1d2249d4a713b98dcc53db637 to your computer and use it in GitHub Desktop.
Install Hadolint (Latest Release)
#!/usr/bin/env sh
## URL for the latest release:
_latest="https://api.github.com/repos/hadolint/hadolint/releases/latest"
## Kernel name:
_kernel="$(uname -s)"
## Architecture:
_arch="$(uname -m)"
## Target:
_target="${1:-/usr/local/bin/hadolint}"
## Download the binary to target path:
curl -s "${_latest}" | \
grep browser_download_url | \
grep "${_kernel}-${_arch}" | \
cut -f 2- -d ":" | \
tr -d "\"" | \
wget -qi - -O "${_target}"
## Attend permissions:
chmod +x "${_target}"
@vst
Copy link
Author

vst commented Apr 21, 2021

Install to the default target path (/usr/local/bin/hadolint):

curl -sf -L https://gist.githubusercontent.com/vst/90e849a1d2249d4a713b98dcc53db637/raw/install-hadolint.sh | sudo sh

Install to custom target path:

curl -sf -L https://gist.githubusercontent.com/vst/90e849a1d2249d4a713b98dcc53db637/raw/install-hadolint.sh | sudo sh -s /tmp/hadolint

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment