Skip to content

Commit

Permalink
build: install chktex (#5074)
Browse files Browse the repository at this point in the history
Install chktex directly instead of using a third-party container image.
  • Loading branch information
ferrarimarco committed Dec 30, 2023
1 parent 1ca3ebc commit 690d422
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 6 deletions.
14 changes: 8 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 #
######################
Expand Down Expand Up @@ -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 #
#################
Expand Down
23 changes: 23 additions & 0 deletions scripts/install-chktex.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 690d422

Please sign in to comment.