From 6d2e34e049d4892199b2694b76571341ae4b8704 Mon Sep 17 00:00:00 2001 From: Andrew Hamilton Date: Fri, 8 Mar 2024 23:25:15 +1000 Subject: [PATCH] packaging: Install on Alpine distro --- README.md | 2 +- eris/eris/__main__.py | 11 +++++++++++ packaging/Dockerfile.alpine | 13 +++++++++++++ packaging/make-readme.py | 2 +- 4 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 packaging/Dockerfile.alpine diff --git a/README.md b/README.md index 77f86ae..16dd00f 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Eris maintains an up-to-date set of reports for every file in a codebase. ## Installation -#### Debian / Ubuntu / Fedora / Arch +#### Debian / Ubuntu / Fedora / Arch / Alpine Install eris with pipx, then install all the tools eris uses: diff --git a/eris/eris/__main__.py b/eris/eris/__main__.py index 6c84f23..c8867cc 100755 --- a/eris/eris/__main__.py +++ b/eris/eris/__main__.py @@ -1146,6 +1146,17 @@ def install_all_tools(): tools_ = ["python-" + tool[len("python3-"):] if tool.startswith("python3-") else tool for tool in tools_] install_command = ["pacman", "--noconfirm", "-S"] + elif "ID=alpine\n" in os_release_lines: + tools_.remove("python3-bandit") + tools_.remove("wabt") + tools_.remove("unrar") + renames = {"genisoimage": "cdrkit", "lua5.3": "lua", "ruby3.1": "ruby", "xz-utils": "xz", + "g++": "gcc", "golang-go": "go", "lua-check": "luacheck", "php-cli": "php", + "pylint": "py3-pylint", "tidy": "tidyhtml"} + tools_ = [renames.get(tool, tool) for tool in tools_] + tools_ = ["py3-" + tool[len("python3-"):] if tool.startswith("python3-") else tool + for tool in tools_] + install_command = ["apk", "add"] subprocess.run(["sudo"] + install_command + sorted(tools_), check=True) diff --git a/packaging/Dockerfile.alpine b/packaging/Dockerfile.alpine new file mode 100644 index 0000000..f4e6ae7 --- /dev/null +++ b/packaging/Dockerfile.alpine @@ -0,0 +1,13 @@ + + +FROM alpine:3.19.1 + +RUN apk add pipx gcc sudo python3-dev musl-dev +COPY . eris +RUN PIPX_BIN_DIR=/bin pipx install --system-site-packages ./eris/eris +RUN eris --install-all-tools + +ENTRYPOINT ["eris"] + + +# docker build -t eris -f packaging/Dockerfile.arch . diff --git a/packaging/make-readme.py b/packaging/make-readme.py index e579a79..1f93a00 100755 --- a/packaging/make-readme.py +++ b/packaging/make-readme.py @@ -22,7 +22,7 @@ Eris maintains an up-to-date set of reports for every file in a codebase. ## Installation -#### Debian / Ubuntu / Fedora / Arch +#### Debian / Ubuntu / Fedora / Arch / Alpine Install eris with pipx, then install all the tools eris uses: