mrtazz / checkmake

experimental linter/analyzer for Makefiles
MIT License
1.03k stars 45 forks source link

Install checkmake on alpine linux ? #71

Closed nvuillam closed 1 year ago

nvuillam commented 2 years ago

I'd like to embed checkmake within MegaLinter

Is there a known way to install it on alpine linux ?

Many thanks !

wesley-dean-flexion commented 2 years ago

I use a Dockerfile that creates an Alpine-backed image:

ARG CHECKMAKE_VERSION=0.2.1
ARG CHECKMAKE_ARCH=amd64

FROM alpine
ARG CHECKMAKE_VERSION
ARG CHECKMAKE_ARCH

WORKDIR /tmp

RUN ( [ -d /usr/local/bin ] || mkdir -p /usr/local/bin ) \
  && wget -q "https://github.com/mrtazz/checkmake/releases/download/$CHECKMAKE_VERSION/checkmake-$CHECKMAKE_VERSION.linux.$CHECKMAKE_ARCH" -O /usr/local/bin/checkmake \
  && chmod 755 /usr/local/bin/checkmake

ENTRYPOINT ["/usr/local/bin/checkmake"]
CMD ["--help"]

To run it, I use:

docker run --rm -it -v "$(pwd):$(pwd)" -w "$(pwd)" checkmake-alpine Makefile

(assuming the image was tagged checkmake-alpine)

The guts (downloading via wget and using chmod to make it executable) ought to be sufficient for downloading, installing, and using it outside of a containerized context.

The Checkmake version is passed as a build arg (e.g., docker build --build-arg CHECKMAKE_VERSION=0.2.1 -t checkmark-alpine .) although I suppose one could get fancy and use the GitHub API to fetch the latest version.

nvuillam commented 2 years ago

That seems great,I'll try that, thanks :)

mrtazz commented 1 year ago

closing this since the suggested solution seems to work. Feel free to reopen if needed.