From 690d422fd63cbc157177def7c5ecfa8bae472e4b Mon Sep 17 00:00:00 2001 From: Marco Ferrari Date: Sat, 30 Dec 2023 16:07:07 +0100 Subject: [PATCH] build: install chktex (#5074) Install chktex directly instead of using a third-party container image. --- Dockerfile | 14 ++++++++------ scripts/install-chktex.sh | 23 +++++++++++++++++++++++ 2 files changed, 31 insertions(+), 6 deletions(-) create mode 100755 scripts/install-chktex.sh diff --git a/Dockerfile b/Dockerfile index f363904e..8e35633f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,6 @@ ######################################### FROM tenable/terrascan:1.18.11 as terrascan FROM alpine/terragrunt:1.6.6 as terragrunt -FROM ghcr.io/assignuser/chktex-alpine:v0.2.0 as chktex FROM dotenvlinter/dotenv-linter:3.3.0 as dotenv-linter FROM ghcr.io/awkbar-devops/clang-format:v1.0.2 as clang-format FROM ghcr.io/terraform-linters/tflint:v0.50.0 as tflint @@ -129,6 +128,14 @@ RUN apk add --no-cache --virtual .perl-build-deps \ Perl::Critic::Tics \ && apk del --no-network --purge .perl-build-deps +################## +# Install chktex # +################## +COPY scripts/install-chktex.sh / +RUN --mount=type=secret,id=GITHUB_TOKEN /install-chktex.sh && rm -rf /install-chktex.sh +# Set work directory back to root because some scripts depend on it +WORKDIR / + ###################### # Install shellcheck # ###################### @@ -179,11 +186,6 @@ COPY --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker ############################### COPY --from=dockerfile-lint /bin/hadolint /usr/bin/hadolint -################## -# Install chktex # -################## -COPY --from=chktex /usr/bin/chktex /usr/bin/ - ################# # Install shfmt # ################# diff --git a/scripts/install-chktex.sh b/scripts/install-chktex.sh new file mode 100755 index 00000000..7d6153ec --- /dev/null +++ b/scripts/install-chktex.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +set -euo pipefail + +apk add --no-cache --virtual .chktex-build-deps \ + autoconf \ + automake \ + gcc \ + git \ + libc-dev \ + libtool \ + make + +git clone https://git.savannah.gnu.org/git/chktex.git && + cd chktex/chktex && + ./autogen.sh --prefix=/usr/bin && + ./configure && + make && + install chktex /usr/bin + +rm -rfv /chktex + +apk del --no-network --purge .chktex-build-deps