From fb924c7af0a974a4212b5b179b54cc9eb67a7c48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edouard=20Choini=C3=A8re?= <27212526+echoix@users.noreply.github.com> Date: Sun, 19 Feb 2023 13:28:06 -0500 Subject: [PATCH] Remove apk go requirement when possible (#2318) * Install revive from ghcr docker binary * Install actionlint from docker image's binary to remove apk go * Install checkmake from docker image binary * Use latest instead of tags for modified docker images * Use a builder image for revive as the released binaries return broken version number * Edit comment in actionlint Dockerfile instructions * Build dustilock in a stage and copy go binary * Specify GOBIN folder for revive install in builder * Remove unneeded GOPATH and GOROOT variables Unneeded since we are not building go packages from source anymore * Include fixes from linters * Add `COPY --link --from` by using dockerfile frontend syntax * Revert: Remove unneeded GOPATH and GOROOT variables * Run build.sh * Run ./build.sh after rebase * Include apk go requirement for golangci-lint * Add changelog entry * Handle duplicated FROM and COPY instructions * cSpell fixes --- .automation/build.py | 22 +++- .github/linters/.cspell.json | 4 + CHANGELOG.md | 1 + Dockerfile | 106 ++++++++++-------- flavors/ci_light/Dockerfile | 31 +++-- flavors/cupcake/Dockerfile | 92 +++++++++------ flavors/cupcake/flavor.json | 2 - flavors/documentation/Dockerfile | 57 ++++++---- flavors/documentation/flavor.json | 1 - flavors/dotnet/Dockerfile | 55 +++++---- flavors/dotnet/flavor.json | 1 - flavors/go/Dockerfile | 67 +++++++---- flavors/go/flavor.json | 2 - flavors/java/Dockerfile | 57 ++++++---- flavors/java/flavor.json | 1 - flavors/javascript/Dockerfile | 51 +++++---- flavors/javascript/flavor.json | 1 - flavors/php/Dockerfile | 51 +++++---- flavors/php/flavor.json | 1 - flavors/python/Dockerfile | 57 ++++++---- flavors/python/flavor.json | 1 - flavors/ruby/Dockerfile | 51 +++++---- flavors/ruby/flavor.json | 1 - flavors/rust/Dockerfile | 51 +++++---- flavors/rust/flavor.json | 1 - flavors/salesforce/Dockerfile | 52 +++++---- flavors/salesforce/flavor.json | 1 - flavors/security/Dockerfile | 50 ++++----- flavors/swift/Dockerfile | 51 +++++---- flavors/swift/flavor.json | 1 - flavors/terraform/Dockerfile | 73 +++++++----- flavors/terraform/flavor.json | 1 - linters/action_actionlint/Dockerfile | 14 ++- linters/ansible_ansible_lint/Dockerfile | 1 + linters/arm_arm_ttk/Dockerfile | 1 + linters/bash_exec/Dockerfile | 1 + linters/bash_shellcheck/Dockerfile | 12 +- linters/bash_shfmt/Dockerfile | 5 +- linters/bicep_bicep_linter/Dockerfile | 1 + linters/c_cpplint/Dockerfile | 1 + linters/clojure_clj_kondo/Dockerfile | 1 + linters/cloudformation_cfn_lint/Dockerfile | 1 + linters/coffee_coffeelint/Dockerfile | 1 + linters/copypaste_jscpd/Dockerfile | 1 + linters/cpp_cpplint/Dockerfile | 1 + linters/csharp_csharpier/Dockerfile | 1 + linters/csharp_dotnet_format/Dockerfile | 1 + linters/css_scss_lint/Dockerfile | 1 + linters/css_stylelint/Dockerfile | 1 + linters/dart_dartanalyzer/Dockerfile | 1 + linters/dockerfile_hadolint/Dockerfile | 5 +- .../Dockerfile | 5 +- linters/env_dotenv_linter/Dockerfile | 1 + linters/gherkin_gherkin_lint/Dockerfile | 1 + linters/go_golangci_lint/Dockerfile | 1 + linters/go_revive/Dockerfile | 11 +- .../graphql_graphql_schema_linter/Dockerfile | 1 + linters/groovy_npm_groovy_lint/Dockerfile | 1 + linters/html_djlint/Dockerfile | 1 + linters/html_htmlhint/Dockerfile | 1 + linters/java_checkstyle/Dockerfile | 1 + linters/java_pmd/Dockerfile | 1 + linters/javascript_es/Dockerfile | 1 + linters/javascript_prettier/Dockerfile | 1 + linters/javascript_standard/Dockerfile | 1 + linters/json_eslint_plugin_jsonc/Dockerfile | 1 + linters/json_jsonlint/Dockerfile | 1 + linters/json_npm_package_json_lint/Dockerfile | 1 + linters/json_prettier/Dockerfile | 1 + linters/json_v8r/Dockerfile | 1 + linters/jsx_eslint/Dockerfile | 1 + linters/kotlin_ktlint/Dockerfile | 1 + linters/kubernetes_kubeconform/Dockerfile | 1 + linters/kubernetes_kubeval/Dockerfile | 1 + linters/latex_chktex/Dockerfile | 5 +- linters/lua_luacheck/Dockerfile | 1 + linters/makefile_checkmake/Dockerfile | 10 +- .../markdown_markdown_link_check/Dockerfile | 1 + .../Dockerfile | 1 + linters/markdown_markdownlint/Dockerfile | 1 + linters/markdown_remark_lint/Dockerfile | 1 + linters/openapi_spectral/Dockerfile | 1 + linters/perl_perlcritic/Dockerfile | 1 + linters/php_phpcs/Dockerfile | 1 + linters/php_phplint/Dockerfile | 1 + linters/php_phpstan/Dockerfile | 1 + linters/php_psalm/Dockerfile | 1 + linters/powershell_powershell/Dockerfile | 1 + .../Dockerfile | 1 + linters/protobuf_protolint/Dockerfile | 5 +- linters/puppet_puppet_lint/Dockerfile | 1 + linters/python_bandit/Dockerfile | 1 + linters/python_black/Dockerfile | 1 + linters/python_flake8/Dockerfile | 1 + linters/python_isort/Dockerfile | 1 + linters/python_mypy/Dockerfile | 1 + linters/python_pylint/Dockerfile | 1 + linters/python_pyright/Dockerfile | 1 + linters/r_lintr/Dockerfile | 1 + linters/raku_raku/Dockerfile | 1 + linters/repository_checkov/Dockerfile | 1 + linters/repository_devskim/Dockerfile | 1 + linters/repository_dustilock/Dockerfile | 17 +-- linters/repository_git_diff/Dockerfile | 1 + linters/repository_gitleaks/Dockerfile | 5 +- linters/repository_goodcheck/Dockerfile | 1 + linters/repository_secretlint/Dockerfile | 1 + linters/repository_semgrep/Dockerfile | 1 + linters/repository_syft/Dockerfile | 1 + linters/repository_trivy/Dockerfile | 1 + linters/rst_rst_lint/Dockerfile | 1 + linters/rst_rstcheck/Dockerfile | 1 + linters/rst_rstfmt/Dockerfile | 1 + linters/ruby_rubocop/Dockerfile | 1 + linters/rust_clippy/Dockerfile | 1 + .../salesforce_sfdx_scanner_apex/Dockerfile | 1 + .../salesforce_sfdx_scanner_aura/Dockerfile | 1 + .../salesforce_sfdx_scanner_lwc/Dockerfile | 1 + linters/scala_scalafix/Dockerfile | 1 + linters/snakemake_lint/Dockerfile | 1 + linters/snakemake_snakefmt/Dockerfile | 1 + linters/spell_cspell/Dockerfile | 1 + linters/spell_misspell/Dockerfile | 1 + linters/spell_proselint/Dockerfile | 1 + linters/sql_sql_lint/Dockerfile | 1 + linters/sql_sqlfluff/Dockerfile | 1 + linters/sql_tsqllint/Dockerfile | 1 + linters/swift_swiftlint/Dockerfile | 1 + linters/tekton_tekton_lint/Dockerfile | 1 + linters/terraform_checkov/Dockerfile | 1 + linters/terraform_kics/Dockerfile | 5 +- linters/terraform_terraform_fmt/Dockerfile | 5 +- linters/terraform_terragrunt/Dockerfile | 5 +- linters/terraform_terrascan/Dockerfile | 5 +- linters/terraform_tflint/Dockerfile | 5 +- linters/tsx_eslint/Dockerfile | 1 + linters/typescript_es/Dockerfile | 1 + linters/typescript_prettier/Dockerfile | 1 + linters/typescript_standard/Dockerfile | 1 + linters/vbdotnet_dotnet_format/Dockerfile | 1 + linters/xml_xmllint/Dockerfile | 1 + linters/yaml_prettier/Dockerfile | 1 + linters/yaml_v8r/Dockerfile | 1 + linters/yaml_yamllint/Dockerfile | 1 + .../action.megalinter-descriptor.yml | 16 ++- megalinter/descriptors/all_flavors.json | 15 --- .../bash.megalinter-descriptor.yml | 11 +- .../dockerfile.megalinter-descriptor.yml | 2 +- .../editorconfig.megalinter-descriptor.yml | 2 +- .../descriptors/go.megalinter-descriptor.yml | 16 ++- .../latex.megalinter-descriptor.yml | 2 +- .../makefile.megalinter-descriptor.yml | 12 +- .../protobuf.megalinter-descriptor.yml | 2 +- .../repository.megalinter-descriptor.yml | 20 ++-- .../terraform.megalinter-descriptor.yml | 10 +- 155 files changed, 800 insertions(+), 517 deletions(-) diff --git a/.automation/build.py b/.automation/build.py index 9f99ee2053f..ace1e4d50c2 100644 --- a/.automation/build.py +++ b/.automation/build.py @@ -212,8 +212,13 @@ def generate_flavor(flavor, flavor_info): os.makedirs(os.path.dirname(dockerfile), exist_ok=True) copyfile(f"{REPO_HOME}/Dockerfile", dockerfile) flavor_label = flavor_info["label"] - comment = f"# MEGA-LINTER FLAVOR [{flavor}]: {flavor_label}" + comment = f"# MEGALINTER FLAVOR [{flavor}]: {flavor_label}" with open(dockerfile, "r+", encoding="utf-8") as f: + first_line = f.readline().rstrip() + if first_line.startswith("# syntax="): + comment = f"{first_line}\n{comment}" + else: + f.seek(0) content = f.read() f.seek(0) f.truncate() @@ -300,14 +305,27 @@ def build_dockerfile( for dockerfile_item in item["install"]["dockerfile"]: # FROM if dockerfile_item.startswith("FROM"): + if dockerfile_item in all_dockerfile_items: + dockerfile_item = ( + "# Next FROM line commented because already managed by another linter\n" + "# " + "\n# ".join(dockerfile_item.splitlines()) + ) docker_from += [dockerfile_item] # ARG elif dockerfile_item.startswith("ARG"): docker_arg += [dockerfile_item] # COPY elif dockerfile_item.startswith("COPY"): + if dockerfile_item in all_dockerfile_items: + dockerfile_item = ( + "# Next COPY line commented because already managed by another linter\n" + "# " + "\n# ".join(dockerfile_item.splitlines()) + ) docker_copy += [dockerfile_item] - docker_other += ["# Managed with " + dockerfile_item] + docker_other += [ + "# Managed with " + + "\n# ".join(dockerfile_item.splitlines()) + ] # Already used item elif ( dockerfile_item in all_dockerfile_items diff --git a/.github/linters/.cspell.json b/.github/linters/.cspell.json index 0002581c1d5..a117e6c1c64 100644 --- a/.github/linters/.cspell.json +++ b/.github/linters/.cspell.json @@ -132,6 +132,7 @@ "Fmegalinter", "GHSA", "GITLEAKS", + "GOBIN", "GOLANGCI", "GOODCHECK", "GOPATH", @@ -539,6 +540,7 @@ "descriptionless", "devcontainer", "devcontainers", + "devel", "devskim", "dimen", "dimendef", @@ -864,6 +866,7 @@ "mlinters", "moarvm", "mprettier", + "mrtazz", "msgon", "mstruebing", "msvs", @@ -977,6 +980,7 @@ "packagename", "pagebreak", "pageref", + "pandoc", "parallelization", "paren", "parens", diff --git a/CHANGELOG.md b/CHANGELOG.md index 36f1b2dc4af..ce4fa5e38a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,7 @@ Note: Can be used with `oxsecurity/megalinter@beta` in your GitHub Action mega-l - CI - Use docker/build-push-action to build docker images and akhilerm/tag-push-action to release by retagging and pushing beta images instead of rebuilding them - Authenticate to GitHub API during docker build to avoid reaching limits + - Remove apk go package install in images where possible to decrease image sizes, by @echoix in - Fixes - Replace deprecated spectral package, by @bdovaz in by @bdovaz in diff --git a/Dockerfile b/Dockerfile index b648d41cbb8..6549a76f4d2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## @@ -10,15 +11,33 @@ ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #FROM__START +FROM rhysd/actionlint:latest as actionlint +# shellcheck is a dependency for actionlint + +FROM koalaman/shellcheck:stable as shellcheck +# Next FROM line commented because already managed by another linter +# FROM koalaman/shellcheck:stable as shellcheck FROM mvdan/shfmt:latest-alpine as shfmt FROM hadolint/hadolint:v2.12.0-alpine as hadolint FROM mstruebing/editorconfig-checker:2.7.0 as editorconfig-checker +FROM golang:1.19-alpine as revive +## The golang image used as a builder is a temporary workaround +## for the released revive binaries not returning version numbers (devel). +## The install command should then be what is commented in the go.megalinter-descriptor.yml +RUN GOBIN=/usr/bin go install github.com/mgechev/revive@latest + FROM ghcr.io/assignuser/chktex-alpine:latest as chktex +FROM mrtazz/checkmake:latest as checkmake FROM yoheimuta/protolint:latest as protolint +FROM golang:alpine as dustilock +RUN GOBIN=/usr/bin go install github.com/checkmarx/dustilock@v1.2.0 + FROM zricethezav/gitleaks:v8.15.3 as gitleaks FROM ghcr.io/terraform-linters/tflint:v0.45.0 as tflint FROM tenable/terrascan:1.18.0 as terrascan FROM alpine/terragrunt:latest as terragrunt +# Next FROM line commented because already managed by another linter +# FROM alpine/terragrunt:latest as terragrunt FROM checkmarx/kics:alpine as kics #FROM__END @@ -69,7 +88,6 @@ RUN apk add --update --no-cache \ openssh \ docker \ openrc \ - go \ icu-libs \ libcurl \ libintl \ @@ -93,9 +111,11 @@ RUN apk add --update --no-cache \ php81-simplexml \ composer \ dpkg \ + py3-pyflakes \ nodejs \ npm \ yarn \ + go \ openssl \ readline-dev \ g++ \ @@ -280,17 +300,26 @@ ENV PATH="/root/.cargo/bin:${PATH}" ############################################################################################# #COPY__START -COPY --from=shfmt /bin/shfmt /usr/bin/ -COPY --from=hadolint /bin/hadolint /usr/bin/hadolint -COPY --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker -COPY --from=chktex /usr/bin/chktex /usr/bin/ -COPY --from=protolint /usr/local/bin/protolint /usr/bin/ -COPY --from=gitleaks /usr/bin/gitleaks /usr/bin/ -COPY --from=tflint /usr/local/bin/tflint /usr/bin/ -COPY --from=terrascan /go/bin/terrascan /usr/bin/ -COPY --from=terragrunt /usr/local/bin/terragrunt /usr/bin/ -COPY --from=terragrunt /bin/terraform /usr/bin/ -COPY --from=kics /app/bin/kics /usr/bin/ +COPY --link --from=actionlint /usr/local/bin/actionlint /usr/bin/actionlint +# shellcheck is a dependency for actionlint + +COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck +# Next COPY line commented because already managed by another linter +# COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck +COPY --link --from=shfmt /bin/shfmt /usr/bin/ +COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint +COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker +COPY --link --from=revive /usr/bin/revive /usr/bin/revive +COPY --link --from=chktex /usr/bin/chktex /usr/bin/ +COPY --link --from=checkmake /checkmake /usr/bin/checkmake +COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ +COPY --link --from=dustilock /usr/bin/dustilock /usr/bin/dustilock +COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ +COPY --link --from=tflint /usr/local/bin/tflint /usr/bin/ +COPY --link --from=terrascan /go/bin/terrascan /usr/bin/ +COPY --link --from=terragrunt /usr/local/bin/terragrunt /usr/bin/ +COPY --link --from=terragrunt /bin/terraform /usr/bin/ +COPY --link --from=kics /app/bin/kics /usr/bin/ COPY --from=kics /app/bin/assets /opt/kics/assets/ #COPY__END @@ -380,8 +409,9 @@ RUN echo y|sfdx plugins:install sfdx-hardis \ # ENV PATH="${PATH}:/root/.dotnet/tools:/usr/share/dotnet" # actionlint installation -ENV GO111MODULE=on -RUN go install github.com/rhysd/actionlint/cmd/actionlint@latest && go clean --cache +# Managed with COPY --link --from=actionlint /usr/local/bin/actionlint /usr/bin/actionlint +# # shellcheck is a dependency for actionlint +# Managed with COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck # arm-ttk installation ENV ARM_TTK_PSD1="${ARM_TTK_DIRECTORY}/arm-ttk-master/arm-ttk/arm-ttk.psd1" @@ -396,14 +426,11 @@ RUN curl --retry 5 --retry-delay 5 -sLO "${ARM_TTK_URI}" \ && chmod +x /usr/bin/bash-exec \ # shellcheck installation - && ML_THIRD_PARTY_DIR="/third-party/shellcheck" \ - && mkdir -p ${ML_THIRD_PARTY_DIR} \ - && wget -qO- "https://github.com/koalaman/shellcheck/releases/download/stable/shellcheck-stable.linux.x86_64.tar.xz" | tar -xJv --directory ${ML_THIRD_PARTY_DIR} \ - && mv "${ML_THIRD_PARTY_DIR}/shellcheck-stable/shellcheck" /usr/bin/ \ - && find ${ML_THIRD_PARTY_DIR} -type f -not -name 'LICENSE*' -delete -o -type d -empty -delete \ +# Managed with # Next COPY line commented because already managed by another linter +# # COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck # shfmt installation -# Managed with COPY --from=shfmt /bin/shfmt /usr/bin/ +# Managed with COPY --link --from=shfmt /bin/shfmt /usr/bin/ # bicep_linter installation && curl --retry 5 --retry-delay 5 -sLo ${BICEP_EXE} "${BICEP_URI}" \ @@ -428,20 +455,21 @@ RUN curl --retry 5 --retry-delay 5 -sLO "${ARM_TTK_URI}" \ && rm -r dart-sdk/ \ # hadolint installation -# Managed with COPY --from=hadolint /bin/hadolint /usr/bin/hadolint +# Managed with COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint # editorconfig-checker installation -# Managed with COPY --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker +# Managed with COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker # dotenv-linter installation && wget -q -O - https://raw.githubusercontent.com/dotenv-linter/dotenv-linter/master/install.sh | sh -s \ # golangci-lint installation && wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh \ - && golangci-lint --version \ + && golangci-lint --version + # revive installation - && go install github.com/mgechev/revive@latest && go clean --cache +# Managed with COPY --link --from=revive /usr/bin/revive /usr/bin/revive # checkstyle installation RUN --mount=type=secret,id=GITHUB_TOKEN CHECKSTYLE_LATEST=$(curl -s \ @@ -487,7 +515,7 @@ RUN wget --quiet https://github.com/pmd/pmd/releases/download/pmd_releases%2F${P && find ${ML_THIRD_PARTY_DIR} -type f -not -name 'LICENSE*' -delete -o -type d -empty -delete \ # chktex installation -# Managed with COPY --from=chktex /usr/bin/chktex /usr/bin/ +# Managed with COPY --link --from=chktex /usr/bin/chktex /usr/bin/ && cd ~ && touch .chktexrc && cd / \ # luacheck installation @@ -506,9 +534,7 @@ RUN wget --quiet https://github.com/pmd/pmd/releases/download/pmd_releases%2F${P && cd / \ # checkmake installation - && ( [ -d /usr/local/bin ] || mkdir -p /usr/local/bin ) \ - && wget -q "https://github.com/mrtazz/checkmake/releases/download/0.2.1/checkmake-0.2.1.linux.amd64" -O /usr/local/bin/checkmake \ - && chmod 755 /usr/local/bin/checkmake \ +# Managed with COPY --link --from=checkmake /checkmake /usr/bin/checkmake # perlcritic installation && curl --retry 5 --retry-delay 5 -sL https://cpanmin.us/ | perl - -nq --no-wget Perl::Critic @@ -537,7 +563,7 @@ RUN composer global require --ignore-platform-reqs overtrue/phplint ^5.3 \ # RUN pwsh -c 'Install-Module -Name PSScriptAnalyzer -RequiredVersion ${PSSA_VERSION} -Scope AllUsers -Force' # protolint installation -# Managed with COPY --from=protolint /usr/local/bin/protolint /usr/bin/ +# Managed with COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ # lintr installation && mkdir -p /home/r-library \ @@ -565,18 +591,10 @@ ENV PATH="~/.raku/bin:/opt/rakudo-pkg/bin:/opt/rakudo-pkg/share/perl6/site/bin:$ RUN dotnet tool install --global Microsoft.CST.DevSkim.CLI \ # dustilock installation - && ML_THIRD_PARTY_DIR=/download/dustilock && \ - mkdir -p ${ML_THIRD_PARTY_DIR} && \ - git clone https://github.com/Checkmarx/dustilock.git ${ML_THIRD_PARTY_DIR} && \ - cd ${ML_THIRD_PARTY_DIR} && \ - go build && go clean --cache && \ - chmod +x dustilock && \ - mv "${ML_THIRD_PARTY_DIR}/dustilock" /usr/bin/ && \ - find ${ML_THIRD_PARTY_DIR} -type f -not -name 'LICENSE*' -delete -o -type d -empty -delete && \ - cd / \ +# Managed with COPY --link --from=dustilock /usr/bin/dustilock /usr/bin/dustilock # gitleaks installation -# Managed with COPY --from=gitleaks /usr/bin/gitleaks /usr/bin/ +# Managed with COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ # syft installation && curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b /usr/local/bin \ @@ -622,19 +640,19 @@ RUN dotnet tool install --global Microsoft.CST.DevSkim.CLI \ && dotnet tool install --global TSQLLint \ # tflint installation -# Managed with COPY --from=tflint /usr/local/bin/tflint /usr/bin/ +# Managed with COPY --link --from=tflint /usr/local/bin/tflint /usr/bin/ # terrascan installation -# Managed with COPY --from=terrascan /go/bin/terrascan /usr/bin/ +# Managed with COPY --link --from=terrascan /go/bin/terrascan /usr/bin/ # terragrunt installation -# Managed with COPY --from=terragrunt /usr/local/bin/terragrunt /usr/bin/ +# Managed with COPY --link --from=terragrunt /usr/local/bin/terragrunt /usr/bin/ # terraform-fmt installation -# Managed with COPY --from=terragrunt /bin/terraform /usr/bin/ +# Managed with COPY --link --from=terragrunt /bin/terraform /usr/bin/ # kics installation -# Managed with COPY --from=kics /app/bin/kics /usr/bin/ +# Managed with COPY --link --from=kics /app/bin/kics /usr/bin/ && mkdir -p /opt/kics/assets ENV KICS_QUERIES_PATH=/opt/kics/assets/queries KICS_LIBRARIES_PATH=/opt/kics/assets/libraries # Managed with COPY --from=kics /app/bin/assets /opt/kics/assets/ diff --git a/flavors/ci_light/Dockerfile b/flavors/ci_light/Dockerfile index 614e2f1e26d..b2f582870d4 100644 --- a/flavors/ci_light/Dockerfile +++ b/flavors/ci_light/Dockerfile @@ -1,4 +1,5 @@ -# MEGA-LINTER FLAVOR [ci_light]: Optimized for CI items (Dockerfile, Jenkinsfile, JSON/YAML schemas,XML +# syntax=docker/dockerfile:1 +# MEGALINTER FLAVOR [ci_light]: Optimized for CI items (Dockerfile, Jenkinsfile, JSON/YAML schemas,XML ########################################### ########################################### ## Dockerfile to run MegaLinter ## @@ -11,8 +12,10 @@ ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #FROM__START +FROM koalaman/shellcheck:stable as shellcheck FROM mvdan/shfmt:latest-alpine as shfmt FROM hadolint/hadolint:v2.12.0-alpine as hadolint +FROM mrtazz/checkmake:latest as checkmake FROM zricethezav/gitleaks:v8.15.3 as gitleaks #FROM__END @@ -165,9 +168,11 @@ ENV PATH="/root/.cargo/bin:${PATH}" ############################################################################################# #COPY__START -COPY --from=shfmt /bin/shfmt /usr/bin/ -COPY --from=hadolint /bin/hadolint /usr/bin/hadolint -COPY --from=gitleaks /usr/bin/gitleaks /usr/bin/ +COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck +COPY --link --from=shfmt /bin/shfmt /usr/bin/ +COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint +COPY --link --from=checkmake /checkmake /usr/bin/checkmake +COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ #COPY__END ############################################################################################# @@ -175,28 +180,22 @@ COPY --from=gitleaks /usr/bin/gitleaks /usr/bin/ ############################################################################################# #OTHER__START # shellcheck installation -RUN ML_THIRD_PARTY_DIR="/third-party/shellcheck" \ - && mkdir -p ${ML_THIRD_PARTY_DIR} \ - && wget -qO- "https://github.com/koalaman/shellcheck/releases/download/stable/shellcheck-stable.linux.x86_64.tar.xz" | tar -xJv --directory ${ML_THIRD_PARTY_DIR} \ - && mv "${ML_THIRD_PARTY_DIR}/shellcheck-stable/shellcheck" /usr/bin/ \ - && find ${ML_THIRD_PARTY_DIR} -type f -not -name 'LICENSE*' -delete -o -type d -empty -delete \ +# Managed with COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck # shfmt installation -# Managed with COPY --from=shfmt /bin/shfmt /usr/bin/ +# Managed with COPY --link --from=shfmt /bin/shfmt /usr/bin/ # hadolint installation -# Managed with COPY --from=hadolint /bin/hadolint /usr/bin/hadolint +# Managed with COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint # dotenv-linter installation - && wget -q -O - https://raw.githubusercontent.com/dotenv-linter/dotenv-linter/master/install.sh | sh -s \ +RUN wget -q -O - https://raw.githubusercontent.com/dotenv-linter/dotenv-linter/master/install.sh | sh -s \ # checkmake installation - && ( [ -d /usr/local/bin ] || mkdir -p /usr/local/bin ) \ - && wget -q "https://github.com/mrtazz/checkmake/releases/download/0.2.1/checkmake-0.2.1.linux.amd64" -O /usr/local/bin/checkmake \ - && chmod 755 /usr/local/bin/checkmake \ +# Managed with COPY --link --from=checkmake /checkmake /usr/bin/checkmake # gitleaks installation -# Managed with COPY --from=gitleaks /usr/bin/gitleaks /usr/bin/ +# Managed with COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ # trivy installation && wget --tries=5 -q -O - https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin diff --git a/flavors/cupcake/Dockerfile b/flavors/cupcake/Dockerfile index 9c24ea9bce9..361dc6b459a 100644 --- a/flavors/cupcake/Dockerfile +++ b/flavors/cupcake/Dockerfile @@ -1,4 +1,5 @@ -# MEGA-LINTER FLAVOR [cupcake]: MegaLinter for the most commonly used languages +# syntax=docker/dockerfile:1 +# MEGALINTER FLAVOR [cupcake]: MegaLinter for the most commonly used languages ########################################### ########################################### ## Dockerfile to run MegaLinter ## @@ -11,13 +12,28 @@ ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #FROM__START +FROM rhysd/actionlint:latest as actionlint +# shellcheck is a dependency for actionlint + +FROM koalaman/shellcheck:stable as shellcheck +# Next FROM line commented because already managed by another linter +# FROM koalaman/shellcheck:stable as shellcheck FROM mvdan/shfmt:latest-alpine as shfmt FROM hadolint/hadolint:v2.12.0-alpine as hadolint FROM mstruebing/editorconfig-checker:2.7.0 as editorconfig-checker +FROM golang:1.19-alpine as revive +## The golang image used as a builder is a temporary workaround +## for the released revive binaries not returning version numbers (devel). +## The install command should then be what is commented in the go.megalinter-descriptor.yml +RUN GOBIN=/usr/bin go install github.com/mgechev/revive@latest + +FROM mrtazz/checkmake:latest as checkmake FROM zricethezav/gitleaks:v8.15.3 as gitleaks FROM ghcr.io/terraform-linters/tflint:v0.45.0 as tflint FROM tenable/terrascan:1.18.0 as terrascan FROM alpine/terragrunt:latest as terragrunt +# Next FROM line commented because already managed by another linter +# FROM alpine/terragrunt:latest as terragrunt FROM checkmarx/kics:alpine as kics #FROM__END @@ -57,7 +73,6 @@ RUN apk add --update --no-cache \ openssh \ docker \ openrc \ - go \ openjdk11 \ gnupg \ php81 \ @@ -71,9 +86,11 @@ RUN apk add --update --no-cache \ php81-simplexml \ composer \ dpkg \ + py3-pyflakes \ nodejs \ npm \ yarn \ + go \ libc-dev \ libxml2-dev \ libxml2-utils \ @@ -242,15 +259,23 @@ ENV PATH="/root/.cargo/bin:${PATH}" ############################################################################################# #COPY__START -COPY --from=shfmt /bin/shfmt /usr/bin/ -COPY --from=hadolint /bin/hadolint /usr/bin/hadolint -COPY --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker -COPY --from=gitleaks /usr/bin/gitleaks /usr/bin/ -COPY --from=tflint /usr/local/bin/tflint /usr/bin/ -COPY --from=terrascan /go/bin/terrascan /usr/bin/ -COPY --from=terragrunt /usr/local/bin/terragrunt /usr/bin/ -COPY --from=terragrunt /bin/terraform /usr/bin/ -COPY --from=kics /app/bin/kics /usr/bin/ +COPY --link --from=actionlint /usr/local/bin/actionlint /usr/bin/actionlint +# shellcheck is a dependency for actionlint + +COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck +# Next COPY line commented because already managed by another linter +# COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck +COPY --link --from=shfmt /bin/shfmt /usr/bin/ +COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint +COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker +COPY --link --from=revive /usr/bin/revive /usr/bin/revive +COPY --link --from=checkmake /checkmake /usr/bin/checkmake +COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ +COPY --link --from=tflint /usr/local/bin/tflint /usr/bin/ +COPY --link --from=terrascan /go/bin/terrascan /usr/bin/ +COPY --link --from=terragrunt /usr/local/bin/terragrunt /usr/bin/ +COPY --link --from=terragrunt /bin/terraform /usr/bin/ +COPY --link --from=kics /app/bin/kics /usr/bin/ COPY --from=kics /app/bin/assets /opt/kics/assets/ #COPY__END @@ -282,22 +307,20 @@ RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GI ENV PATH="/root/.composer/vendor/bin:$PATH" # actionlint installation -ENV GO111MODULE=on -RUN go install github.com/rhysd/actionlint/cmd/actionlint@latest && go clean --cache \ +# Managed with COPY --link --from=actionlint /usr/local/bin/actionlint /usr/bin/actionlint +# # shellcheck is a dependency for actionlint +# Managed with COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck # bash-exec installation - && printf '#!/bin/bash \n\nif [[ -x "$1" ]]; then exit 0; else echo "Error: File:[$1] is not executable"; exit 1; fi' > /usr/bin/bash-exec \ +RUN printf '#!/bin/bash \n\nif [[ -x "$1" ]]; then exit 0; else echo "Error: File:[$1] is not executable"; exit 1; fi' > /usr/bin/bash-exec \ && chmod +x /usr/bin/bash-exec \ # shellcheck installation - && ML_THIRD_PARTY_DIR="/third-party/shellcheck" \ - && mkdir -p ${ML_THIRD_PARTY_DIR} \ - && wget -qO- "https://github.com/koalaman/shellcheck/releases/download/stable/shellcheck-stable.linux.x86_64.tar.xz" | tar -xJv --directory ${ML_THIRD_PARTY_DIR} \ - && mv "${ML_THIRD_PARTY_DIR}/shellcheck-stable/shellcheck" /usr/bin/ \ - && find ${ML_THIRD_PARTY_DIR} -type f -not -name 'LICENSE*' -delete -o -type d -empty -delete \ +# Managed with # Next COPY line commented because already managed by another linter +# # COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck # shfmt installation -# Managed with COPY --from=shfmt /bin/shfmt /usr/bin/ +# Managed with COPY --link --from=shfmt /bin/shfmt /usr/bin/ # clj-kondo installation && curl -sLO https://raw.githubusercontent.com/clj-kondo/clj-kondo/master/script/install-clj-kondo \ @@ -305,20 +328,21 @@ RUN go install github.com/rhysd/actionlint/cmd/actionlint@latest && go clean --c && ./install-clj-kondo \ # hadolint installation -# Managed with COPY --from=hadolint /bin/hadolint /usr/bin/hadolint +# Managed with COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint # editorconfig-checker installation -# Managed with COPY --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker +# Managed with COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker # dotenv-linter installation && wget -q -O - https://raw.githubusercontent.com/dotenv-linter/dotenv-linter/master/install.sh | sh -s \ # golangci-lint installation && wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh \ - && golangci-lint --version \ + && golangci-lint --version + # revive installation - && go install github.com/mgechev/revive@latest && go clean --cache +# Managed with COPY --link --from=revive /usr/bin/revive /usr/bin/revive # checkstyle installation RUN --mount=type=secret,id=GITHUB_TOKEN CHECKSTYLE_LATEST=$(curl -s \ @@ -361,13 +385,11 @@ RUN wget --quiet https://github.com/pmd/pmd/releases/download/pmd_releases%2F${P && tar xf ${ML_THIRD_PARTY_DIR}/kubeconform-linux-amd64.tar.gz --directory ${ML_THIRD_PARTY_DIR} \ && mv ${ML_THIRD_PARTY_DIR}/kubeconform /usr/local/bin \ && rm ${ML_THIRD_PARTY_DIR}/kubeconform-linux-amd64.tar.gz \ - && find ${ML_THIRD_PARTY_DIR} -type f -not -name 'LICENSE*' -delete -o -type d -empty -delete \ + && find ${ML_THIRD_PARTY_DIR} -type f -not -name 'LICENSE*' -delete -o -type d -empty -delete -# checkmake installation - && ( [ -d /usr/local/bin ] || mkdir -p /usr/local/bin ) \ - && wget -q "https://github.com/mrtazz/checkmake/releases/download/0.2.1/checkmake-0.2.1.linux.amd64" -O /usr/local/bin/checkmake \ - && chmod 755 /usr/local/bin/checkmake +# checkmake installation +# Managed with COPY --link --from=checkmake /checkmake /usr/bin/checkmake # phpcs installation RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GITHUB_TOKEN)" && export GITHUB_AUTH_TOKEN && phive --no-progress install phpcs -g --trust-gpg-keys 31C7E470E2138192 @@ -386,7 +408,7 @@ RUN composer global require --ignore-platform-reqs overtrue/phplint ^5.3 \ && composer global config bin-dir --absolute \ # gitleaks installation -# Managed with COPY --from=gitleaks /usr/bin/gitleaks /usr/bin/ +# Managed with COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ # trivy installation && wget --tries=5 -q -O - https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin \ @@ -400,19 +422,19 @@ RUN composer global require --ignore-platform-reqs overtrue/phplint ^5.3 \ && find /tmp -path '/tmp/tmp.*' -type f -name 'misspell*' -delete -o -type d -empty -delete \ # tflint installation -# Managed with COPY --from=tflint /usr/local/bin/tflint /usr/bin/ +# Managed with COPY --link --from=tflint /usr/local/bin/tflint /usr/bin/ # terrascan installation -# Managed with COPY --from=terrascan /go/bin/terrascan /usr/bin/ +# Managed with COPY --link --from=terrascan /go/bin/terrascan /usr/bin/ # terragrunt installation -# Managed with COPY --from=terragrunt /usr/local/bin/terragrunt /usr/bin/ +# Managed with COPY --link --from=terragrunt /usr/local/bin/terragrunt /usr/bin/ # terraform-fmt installation -# Managed with COPY --from=terragrunt /bin/terraform /usr/bin/ +# Managed with COPY --link --from=terragrunt /bin/terraform /usr/bin/ # kics installation -# Managed with COPY --from=kics /app/bin/kics /usr/bin/ +# Managed with COPY --link --from=kics /app/bin/kics /usr/bin/ && mkdir -p /opt/kics/assets ENV KICS_QUERIES_PATH=/opt/kics/assets/queries KICS_LIBRARIES_PATH=/opt/kics/assets/libraries # Managed with COPY --from=kics /app/bin/assets /opt/kics/assets/ diff --git a/flavors/cupcake/flavor.json b/flavors/cupcake/flavor.json index 74b5370a340..83ecbc94378 100644 --- a/flavors/cupcake/flavor.json +++ b/flavors/cupcake/flavor.json @@ -1,8 +1,6 @@ { "descriptors": [ - "ACTION", "BASH", - "GO", "JAVA", "KOTLIN", "PHP", diff --git a/flavors/documentation/Dockerfile b/flavors/documentation/Dockerfile index ad00f2b89f4..69fb727d644 100644 --- a/flavors/documentation/Dockerfile +++ b/flavors/documentation/Dockerfile @@ -1,4 +1,5 @@ -# MEGA-LINTER FLAVOR [documentation]: MegaLinter for documentation projects +# syntax=docker/dockerfile:1 +# MEGALINTER FLAVOR [documentation]: MegaLinter for documentation projects ########################################### ########################################### ## Dockerfile to run MegaLinter ## @@ -11,9 +12,16 @@ ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #FROM__START +FROM rhysd/actionlint:latest as actionlint +# shellcheck is a dependency for actionlint + +FROM koalaman/shellcheck:stable as shellcheck +# Next FROM line commented because already managed by another linter +# FROM koalaman/shellcheck:stable as shellcheck FROM mvdan/shfmt:latest-alpine as shfmt FROM hadolint/hadolint:v2.12.0-alpine as hadolint FROM mstruebing/editorconfig-checker:2.7.0 as editorconfig-checker +FROM mrtazz/checkmake:latest as checkmake FROM yoheimuta/protolint:latest as protolint FROM zricethezav/gitleaks:v8.15.3 as gitleaks #FROM__END @@ -52,8 +60,8 @@ RUN apk add --update --no-cache \ make \ musl-dev \ openssh \ - go \ openjdk11 \ + py3-pyflakes \ nodejs \ npm \ yarn \ @@ -191,11 +199,18 @@ ENV PATH="/root/.cargo/bin:${PATH}" ############################################################################################# #COPY__START -COPY --from=shfmt /bin/shfmt /usr/bin/ -COPY --from=hadolint /bin/hadolint /usr/bin/hadolint -COPY --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker -COPY --from=protolint /usr/local/bin/protolint /usr/bin/ -COPY --from=gitleaks /usr/bin/gitleaks /usr/bin/ +COPY --link --from=actionlint /usr/local/bin/actionlint /usr/bin/actionlint +# shellcheck is a dependency for actionlint + +COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck +# Next COPY line commented because already managed by another linter +# COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck +COPY --link --from=shfmt /bin/shfmt /usr/bin/ +COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint +COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker +COPY --link --from=checkmake /checkmake /usr/bin/checkmake +COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ +COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ #COPY__END ############################################################################################# @@ -203,28 +218,26 @@ COPY --from=gitleaks /usr/bin/gitleaks /usr/bin/ ############################################################################################# #OTHER__START # actionlint installation -ENV GO111MODULE=on -RUN go install github.com/rhysd/actionlint/cmd/actionlint@latest && go clean --cache \ +# Managed with COPY --link --from=actionlint /usr/local/bin/actionlint /usr/bin/actionlint +# # shellcheck is a dependency for actionlint +# Managed with COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck # bash-exec installation - && printf '#!/bin/bash \n\nif [[ -x "$1" ]]; then exit 0; else echo "Error: File:[$1] is not executable"; exit 1; fi' > /usr/bin/bash-exec \ +RUN printf '#!/bin/bash \n\nif [[ -x "$1" ]]; then exit 0; else echo "Error: File:[$1] is not executable"; exit 1; fi' > /usr/bin/bash-exec \ && chmod +x /usr/bin/bash-exec \ # shellcheck installation - && ML_THIRD_PARTY_DIR="/third-party/shellcheck" \ - && mkdir -p ${ML_THIRD_PARTY_DIR} \ - && wget -qO- "https://github.com/koalaman/shellcheck/releases/download/stable/shellcheck-stable.linux.x86_64.tar.xz" | tar -xJv --directory ${ML_THIRD_PARTY_DIR} \ - && mv "${ML_THIRD_PARTY_DIR}/shellcheck-stable/shellcheck" /usr/bin/ \ - && find ${ML_THIRD_PARTY_DIR} -type f -not -name 'LICENSE*' -delete -o -type d -empty -delete \ +# Managed with # Next COPY line commented because already managed by another linter +# # COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck # shfmt installation -# Managed with COPY --from=shfmt /bin/shfmt /usr/bin/ +# Managed with COPY --link --from=shfmt /bin/shfmt /usr/bin/ # hadolint installation -# Managed with COPY --from=hadolint /bin/hadolint /usr/bin/hadolint +# Managed with COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint # editorconfig-checker installation -# Managed with COPY --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker +# Managed with COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker # dotenv-linter installation && wget -q -O - https://raw.githubusercontent.com/dotenv-linter/dotenv-linter/master/install.sh | sh -s \ @@ -254,15 +267,13 @@ RUN go install github.com/rhysd/actionlint/cmd/actionlint@latest && go clean --c && find ${ML_THIRD_PARTY_DIR} -type f -not -name 'LICENSE*' -delete -o -type d -empty -delete \ # checkmake installation - && ( [ -d /usr/local/bin ] || mkdir -p /usr/local/bin ) \ - && wget -q "https://github.com/mrtazz/checkmake/releases/download/0.2.1/checkmake-0.2.1.linux.amd64" -O /usr/local/bin/checkmake \ - && chmod 755 /usr/local/bin/checkmake \ +# Managed with COPY --link --from=checkmake /checkmake /usr/bin/checkmake # protolint installation -# Managed with COPY --from=protolint /usr/local/bin/protolint /usr/bin/ +# Managed with COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ # gitleaks installation -# Managed with COPY --from=gitleaks /usr/bin/gitleaks /usr/bin/ +# Managed with COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ # trivy installation && wget --tries=5 -q -O - https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin \ diff --git a/flavors/documentation/flavor.json b/flavors/documentation/flavor.json index c5a95ffe4ef..906cb5e742b 100644 --- a/flavors/documentation/flavor.json +++ b/flavors/documentation/flavor.json @@ -1,6 +1,5 @@ { "descriptors": [ - "ACTION", "BASH", "KOTLIN" ], diff --git a/flavors/dotnet/Dockerfile b/flavors/dotnet/Dockerfile index dc14306c1a2..afaa4310f13 100644 --- a/flavors/dotnet/Dockerfile +++ b/flavors/dotnet/Dockerfile @@ -1,4 +1,5 @@ -# MEGA-LINTER FLAVOR [dotnet]: Optimized for C, C++, C# or VB based projects +# syntax=docker/dockerfile:1 +# MEGALINTER FLAVOR [dotnet]: Optimized for C, C++, C# or VB based projects ########################################### ########################################### ## Dockerfile to run MegaLinter ## @@ -11,9 +12,16 @@ ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #FROM__START +FROM rhysd/actionlint:latest as actionlint +# shellcheck is a dependency for actionlint + +FROM koalaman/shellcheck:stable as shellcheck +# Next FROM line commented because already managed by another linter +# FROM koalaman/shellcheck:stable as shellcheck FROM mvdan/shfmt:latest-alpine as shfmt FROM hadolint/hadolint:v2.12.0-alpine as hadolint FROM mstruebing/editorconfig-checker:2.7.0 as editorconfig-checker +FROM mrtazz/checkmake:latest as checkmake FROM yoheimuta/protolint:latest as protolint FROM zricethezav/gitleaks:v8.15.3 as gitleaks #FROM__END @@ -60,7 +68,6 @@ RUN apk add --update --no-cache \ make \ musl-dev \ openssh \ - go \ icu-libs \ libcurl \ libintl \ @@ -70,6 +77,7 @@ RUN apk add --update --no-cache \ zlib \ zlib-dev \ openjdk11 \ + py3-pyflakes \ nodejs \ npm \ yarn \ @@ -211,11 +219,18 @@ ENV PATH="/root/.cargo/bin:${PATH}" ############################################################################################# #COPY__START -COPY --from=shfmt /bin/shfmt /usr/bin/ -COPY --from=hadolint /bin/hadolint /usr/bin/hadolint -COPY --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker -COPY --from=protolint /usr/local/bin/protolint /usr/bin/ -COPY --from=gitleaks /usr/bin/gitleaks /usr/bin/ +COPY --link --from=actionlint /usr/local/bin/actionlint /usr/bin/actionlint +# shellcheck is a dependency for actionlint + +COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck +# Next COPY line commented because already managed by another linter +# COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck +COPY --link --from=shfmt /bin/shfmt /usr/bin/ +COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint +COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker +COPY --link --from=checkmake /checkmake /usr/bin/checkmake +COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ +COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ #COPY__END ############################################################################################# @@ -267,8 +282,9 @@ RUN --mount=type=secret,id=GITHUB_TOKEN mkdir -p ${PWSH_DIRECTORY} \ # ENV PATH="${PATH}:/root/.dotnet/tools:/usr/share/dotnet" # actionlint installation -ENV GO111MODULE=on -RUN go install github.com/rhysd/actionlint/cmd/actionlint@latest && go clean --cache +# Managed with COPY --link --from=actionlint /usr/local/bin/actionlint /usr/bin/actionlint +# # shellcheck is a dependency for actionlint +# Managed with COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck # arm-ttk installation ENV ARM_TTK_PSD1="${ARM_TTK_DIRECTORY}/arm-ttk-master/arm-ttk/arm-ttk.psd1" @@ -283,14 +299,11 @@ RUN curl --retry 5 --retry-delay 5 -sLO "${ARM_TTK_URI}" \ && chmod +x /usr/bin/bash-exec \ # shellcheck installation - && ML_THIRD_PARTY_DIR="/third-party/shellcheck" \ - && mkdir -p ${ML_THIRD_PARTY_DIR} \ - && wget -qO- "https://github.com/koalaman/shellcheck/releases/download/stable/shellcheck-stable.linux.x86_64.tar.xz" | tar -xJv --directory ${ML_THIRD_PARTY_DIR} \ - && mv "${ML_THIRD_PARTY_DIR}/shellcheck-stable/shellcheck" /usr/bin/ \ - && find ${ML_THIRD_PARTY_DIR} -type f -not -name 'LICENSE*' -delete -o -type d -empty -delete \ +# Managed with # Next COPY line commented because already managed by another linter +# # COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck # shfmt installation -# Managed with COPY --from=shfmt /bin/shfmt /usr/bin/ +# Managed with COPY --link --from=shfmt /bin/shfmt /usr/bin/ # bicep_linter installation && curl --retry 5 --retry-delay 5 -sLo ${BICEP_EXE} "${BICEP_URI}" \ @@ -301,10 +314,10 @@ RUN curl --retry 5 --retry-delay 5 -sLO "${ARM_TTK_URI}" \ && /usr/share/dotnet/dotnet tool install -g csharpier \ # hadolint installation -# Managed with COPY --from=hadolint /bin/hadolint /usr/bin/hadolint +# Managed with COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint # editorconfig-checker installation -# Managed with COPY --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker +# Managed with COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker # dotenv-linter installation && wget -q -O - https://raw.githubusercontent.com/dotenv-linter/dotenv-linter/master/install.sh | sh -s \ @@ -334,9 +347,7 @@ RUN curl --retry 5 --retry-delay 5 -sLO "${ARM_TTK_URI}" \ && find ${ML_THIRD_PARTY_DIR} -type f -not -name 'LICENSE*' -delete -o -type d -empty -delete \ # checkmake installation - && ( [ -d /usr/local/bin ] || mkdir -p /usr/local/bin ) \ - && wget -q "https://github.com/mrtazz/checkmake/releases/download/0.2.1/checkmake-0.2.1.linux.amd64" -O /usr/local/bin/checkmake \ - && chmod 755 /usr/local/bin/checkmake \ +# Managed with COPY --link --from=checkmake /checkmake /usr/bin/checkmake # powershell installation && pwsh -c 'Install-Module -Name PSScriptAnalyzer -RequiredVersion ${PSSA_VERSION} -Scope AllUsers -Force' \ @@ -346,10 +357,10 @@ RUN curl --retry 5 --retry-delay 5 -sLO "${ARM_TTK_URI}" \ # RUN pwsh -c 'Install-Module -Name PSScriptAnalyzer -RequiredVersion ${PSSA_VERSION} -Scope AllUsers -Force' # protolint installation -# Managed with COPY --from=protolint /usr/local/bin/protolint /usr/bin/ +# Managed with COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ # gitleaks installation -# Managed with COPY --from=gitleaks /usr/bin/gitleaks /usr/bin/ +# Managed with COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ # trivy installation && wget --tries=5 -q -O - https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin \ diff --git a/flavors/dotnet/flavor.json b/flavors/dotnet/flavor.json index 31d626bdf21..8f6f25ff80e 100644 --- a/flavors/dotnet/flavor.json +++ b/flavors/dotnet/flavor.json @@ -1,6 +1,5 @@ { "descriptors": [ - "ACTION", "ARM", "BASH", "CSHARP", diff --git a/flavors/go/Dockerfile b/flavors/go/Dockerfile index 250a480259a..dc228ac7474 100644 --- a/flavors/go/Dockerfile +++ b/flavors/go/Dockerfile @@ -1,4 +1,5 @@ -# MEGA-LINTER FLAVOR [go]: Optimized for GO based projects +# syntax=docker/dockerfile:1 +# MEGALINTER FLAVOR [go]: Optimized for GO based projects ########################################### ########################################### ## Dockerfile to run MegaLinter ## @@ -11,9 +12,22 @@ ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #FROM__START +FROM rhysd/actionlint:latest as actionlint +# shellcheck is a dependency for actionlint + +FROM koalaman/shellcheck:stable as shellcheck +# Next FROM line commented because already managed by another linter +# FROM koalaman/shellcheck:stable as shellcheck FROM mvdan/shfmt:latest-alpine as shfmt FROM hadolint/hadolint:v2.12.0-alpine as hadolint FROM mstruebing/editorconfig-checker:2.7.0 as editorconfig-checker +FROM golang:1.19-alpine as revive +## The golang image used as a builder is a temporary workaround +## for the released revive binaries not returning version numbers (devel). +## The install command should then be what is commented in the go.megalinter-descriptor.yml +RUN GOBIN=/usr/bin go install github.com/mgechev/revive@latest + +FROM mrtazz/checkmake:latest as checkmake FROM yoheimuta/protolint:latest as protolint FROM zricethezav/gitleaks:v8.15.3 as gitleaks #FROM__END @@ -52,11 +66,12 @@ RUN apk add --update --no-cache \ make \ musl-dev \ openssh \ - go \ openjdk11 \ + py3-pyflakes \ nodejs \ npm \ yarn \ + go \ libc-dev \ libxml2-dev \ libxml2-utils \ @@ -191,11 +206,19 @@ ENV PATH="/root/.cargo/bin:${PATH}" ############################################################################################# #COPY__START -COPY --from=shfmt /bin/shfmt /usr/bin/ -COPY --from=hadolint /bin/hadolint /usr/bin/hadolint -COPY --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker -COPY --from=protolint /usr/local/bin/protolint /usr/bin/ -COPY --from=gitleaks /usr/bin/gitleaks /usr/bin/ +COPY --link --from=actionlint /usr/local/bin/actionlint /usr/bin/actionlint +# shellcheck is a dependency for actionlint + +COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck +# Next COPY line commented because already managed by another linter +# COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck +COPY --link --from=shfmt /bin/shfmt /usr/bin/ +COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint +COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker +COPY --link --from=revive /usr/bin/revive /usr/bin/revive +COPY --link --from=checkmake /checkmake /usr/bin/checkmake +COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ +COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ #COPY__END ############################################################################################# @@ -203,28 +226,26 @@ COPY --from=gitleaks /usr/bin/gitleaks /usr/bin/ ############################################################################################# #OTHER__START # actionlint installation -ENV GO111MODULE=on -RUN go install github.com/rhysd/actionlint/cmd/actionlint@latest && go clean --cache \ +# Managed with COPY --link --from=actionlint /usr/local/bin/actionlint /usr/bin/actionlint +# # shellcheck is a dependency for actionlint +# Managed with COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck # bash-exec installation - && printf '#!/bin/bash \n\nif [[ -x "$1" ]]; then exit 0; else echo "Error: File:[$1] is not executable"; exit 1; fi' > /usr/bin/bash-exec \ +RUN printf '#!/bin/bash \n\nif [[ -x "$1" ]]; then exit 0; else echo "Error: File:[$1] is not executable"; exit 1; fi' > /usr/bin/bash-exec \ && chmod +x /usr/bin/bash-exec \ # shellcheck installation - && ML_THIRD_PARTY_DIR="/third-party/shellcheck" \ - && mkdir -p ${ML_THIRD_PARTY_DIR} \ - && wget -qO- "https://github.com/koalaman/shellcheck/releases/download/stable/shellcheck-stable.linux.x86_64.tar.xz" | tar -xJv --directory ${ML_THIRD_PARTY_DIR} \ - && mv "${ML_THIRD_PARTY_DIR}/shellcheck-stable/shellcheck" /usr/bin/ \ - && find ${ML_THIRD_PARTY_DIR} -type f -not -name 'LICENSE*' -delete -o -type d -empty -delete \ +# Managed with # Next COPY line commented because already managed by another linter +# # COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck # shfmt installation -# Managed with COPY --from=shfmt /bin/shfmt /usr/bin/ +# Managed with COPY --link --from=shfmt /bin/shfmt /usr/bin/ # hadolint installation -# Managed with COPY --from=hadolint /bin/hadolint /usr/bin/hadolint +# Managed with COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint # editorconfig-checker installation -# Managed with COPY --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker +# Managed with COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker # dotenv-linter installation && wget -q -O - https://raw.githubusercontent.com/dotenv-linter/dotenv-linter/master/install.sh | sh -s \ @@ -234,7 +255,7 @@ RUN go install github.com/rhysd/actionlint/cmd/actionlint@latest && go clean --c && golangci-lint --version \ # revive installation - && go install github.com/mgechev/revive@latest && go clean --cache \ +# Managed with COPY --link --from=revive /usr/bin/revive /usr/bin/revive # ktlint installation && curl --retry 5 --retry-delay 5 -sSLO https://github.com/pinterest/ktlint/releases/latest/download/ktlint && \ @@ -261,15 +282,13 @@ RUN go install github.com/rhysd/actionlint/cmd/actionlint@latest && go clean --c && find ${ML_THIRD_PARTY_DIR} -type f -not -name 'LICENSE*' -delete -o -type d -empty -delete \ # checkmake installation - && ( [ -d /usr/local/bin ] || mkdir -p /usr/local/bin ) \ - && wget -q "https://github.com/mrtazz/checkmake/releases/download/0.2.1/checkmake-0.2.1.linux.amd64" -O /usr/local/bin/checkmake \ - && chmod 755 /usr/local/bin/checkmake \ +# Managed with COPY --link --from=checkmake /checkmake /usr/bin/checkmake # protolint installation -# Managed with COPY --from=protolint /usr/local/bin/protolint /usr/bin/ +# Managed with COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ # gitleaks installation -# Managed with COPY --from=gitleaks /usr/bin/gitleaks /usr/bin/ +# Managed with COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ # trivy installation && wget --tries=5 -q -O - https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin \ diff --git a/flavors/go/flavor.json b/flavors/go/flavor.json index 31c64cf0cb0..53562877bc5 100644 --- a/flavors/go/flavor.json +++ b/flavors/go/flavor.json @@ -1,8 +1,6 @@ { "descriptors": [ - "ACTION", "BASH", - "GO", "KOTLIN" ], "label": "Optimized for GO based projects", diff --git a/flavors/java/Dockerfile b/flavors/java/Dockerfile index 9843ac95457..ac0eba86ff7 100644 --- a/flavors/java/Dockerfile +++ b/flavors/java/Dockerfile @@ -1,4 +1,5 @@ -# MEGA-LINTER FLAVOR [java]: Optimized for JAVA based projects +# syntax=docker/dockerfile:1 +# MEGALINTER FLAVOR [java]: Optimized for JAVA based projects ########################################### ########################################### ## Dockerfile to run MegaLinter ## @@ -11,9 +12,16 @@ ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #FROM__START +FROM rhysd/actionlint:latest as actionlint +# shellcheck is a dependency for actionlint + +FROM koalaman/shellcheck:stable as shellcheck +# Next FROM line commented because already managed by another linter +# FROM koalaman/shellcheck:stable as shellcheck FROM mvdan/shfmt:latest-alpine as shfmt FROM hadolint/hadolint:v2.12.0-alpine as hadolint FROM mstruebing/editorconfig-checker:2.7.0 as editorconfig-checker +FROM mrtazz/checkmake:latest as checkmake FROM yoheimuta/protolint:latest as protolint FROM zricethezav/gitleaks:v8.15.3 as gitleaks #FROM__END @@ -52,8 +60,8 @@ RUN apk add --update --no-cache \ make \ musl-dev \ openssh \ - go \ openjdk11 \ + py3-pyflakes \ nodejs \ npm \ yarn \ @@ -191,11 +199,18 @@ ENV PATH="/root/.cargo/bin:${PATH}" ############################################################################################# #COPY__START -COPY --from=shfmt /bin/shfmt /usr/bin/ -COPY --from=hadolint /bin/hadolint /usr/bin/hadolint -COPY --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker -COPY --from=protolint /usr/local/bin/protolint /usr/bin/ -COPY --from=gitleaks /usr/bin/gitleaks /usr/bin/ +COPY --link --from=actionlint /usr/local/bin/actionlint /usr/bin/actionlint +# shellcheck is a dependency for actionlint + +COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck +# Next COPY line commented because already managed by another linter +# COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck +COPY --link --from=shfmt /bin/shfmt /usr/bin/ +COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint +COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker +COPY --link --from=checkmake /checkmake /usr/bin/checkmake +COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ +COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ #COPY__END ############################################################################################# @@ -207,22 +222,20 @@ ENV JAVA_HOME=/usr/lib/jvm/java-11-openjdk ENV PATH="$JAVA_HOME/bin:${PATH}" # actionlint installation -ENV GO111MODULE=on -RUN go install github.com/rhysd/actionlint/cmd/actionlint@latest && go clean --cache \ +# Managed with COPY --link --from=actionlint /usr/local/bin/actionlint /usr/bin/actionlint +# # shellcheck is a dependency for actionlint +# Managed with COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck # bash-exec installation - && printf '#!/bin/bash \n\nif [[ -x "$1" ]]; then exit 0; else echo "Error: File:[$1] is not executable"; exit 1; fi' > /usr/bin/bash-exec \ +RUN printf '#!/bin/bash \n\nif [[ -x "$1" ]]; then exit 0; else echo "Error: File:[$1] is not executable"; exit 1; fi' > /usr/bin/bash-exec \ && chmod +x /usr/bin/bash-exec \ # shellcheck installation - && ML_THIRD_PARTY_DIR="/third-party/shellcheck" \ - && mkdir -p ${ML_THIRD_PARTY_DIR} \ - && wget -qO- "https://github.com/koalaman/shellcheck/releases/download/stable/shellcheck-stable.linux.x86_64.tar.xz" | tar -xJv --directory ${ML_THIRD_PARTY_DIR} \ - && mv "${ML_THIRD_PARTY_DIR}/shellcheck-stable/shellcheck" /usr/bin/ \ - && find ${ML_THIRD_PARTY_DIR} -type f -not -name 'LICENSE*' -delete -o -type d -empty -delete \ +# Managed with # Next COPY line commented because already managed by another linter +# # COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck # shfmt installation -# Managed with COPY --from=shfmt /bin/shfmt /usr/bin/ +# Managed with COPY --link --from=shfmt /bin/shfmt /usr/bin/ # clj-kondo installation && curl -sLO https://raw.githubusercontent.com/clj-kondo/clj-kondo/master/script/install-clj-kondo \ @@ -230,10 +243,10 @@ RUN go install github.com/rhysd/actionlint/cmd/actionlint@latest && go clean --c && ./install-clj-kondo \ # hadolint installation -# Managed with COPY --from=hadolint /bin/hadolint /usr/bin/hadolint +# Managed with COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint # editorconfig-checker installation -# Managed with COPY --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker +# Managed with COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker # dotenv-linter installation && wget -q -O - https://raw.githubusercontent.com/dotenv-linter/dotenv-linter/master/install.sh | sh -s @@ -282,15 +295,13 @@ RUN wget --quiet https://github.com/pmd/pmd/releases/download/pmd_releases%2F${P && find ${ML_THIRD_PARTY_DIR} -type f -not -name 'LICENSE*' -delete -o -type d -empty -delete \ # checkmake installation - && ( [ -d /usr/local/bin ] || mkdir -p /usr/local/bin ) \ - && wget -q "https://github.com/mrtazz/checkmake/releases/download/0.2.1/checkmake-0.2.1.linux.amd64" -O /usr/local/bin/checkmake \ - && chmod 755 /usr/local/bin/checkmake \ +# Managed with COPY --link --from=checkmake /checkmake /usr/bin/checkmake # protolint installation -# Managed with COPY --from=protolint /usr/local/bin/protolint /usr/bin/ +# Managed with COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ # gitleaks installation -# Managed with COPY --from=gitleaks /usr/bin/gitleaks /usr/bin/ +# Managed with COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ # trivy installation && wget --tries=5 -q -O - https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin \ diff --git a/flavors/java/flavor.json b/flavors/java/flavor.json index e178d5e2bd7..887a58597a2 100644 --- a/flavors/java/flavor.json +++ b/flavors/java/flavor.json @@ -1,6 +1,5 @@ { "descriptors": [ - "ACTION", "BASH", "JAVA", "KOTLIN" diff --git a/flavors/javascript/Dockerfile b/flavors/javascript/Dockerfile index d66e3a664cc..7cd8b44d831 100644 --- a/flavors/javascript/Dockerfile +++ b/flavors/javascript/Dockerfile @@ -1,4 +1,5 @@ -# MEGA-LINTER FLAVOR [javascript]: Optimized for JAVASCRIPT or TYPESCRIPT based projects +# syntax=docker/dockerfile:1 +# MEGALINTER FLAVOR [javascript]: Optimized for JAVASCRIPT or TYPESCRIPT based projects ########################################### ########################################### ## Dockerfile to run MegaLinter ## @@ -11,6 +12,12 @@ ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #FROM__START +FROM rhysd/actionlint:latest as actionlint +# shellcheck is a dependency for actionlint + +FROM koalaman/shellcheck:stable as shellcheck +# Next FROM line commented because already managed by another linter +# FROM koalaman/shellcheck:stable as shellcheck FROM mvdan/shfmt:latest-alpine as shfmt FROM hadolint/hadolint:v2.12.0-alpine as hadolint FROM mstruebing/editorconfig-checker:2.7.0 as editorconfig-checker @@ -52,8 +59,8 @@ RUN apk add --update --no-cache \ make \ musl-dev \ openssh \ - go \ openjdk11 \ + py3-pyflakes \ nodejs \ npm \ yarn \ @@ -213,11 +220,17 @@ ENV PATH="/root/.cargo/bin:${PATH}" ############################################################################################# #COPY__START -COPY --from=shfmt /bin/shfmt /usr/bin/ -COPY --from=hadolint /bin/hadolint /usr/bin/hadolint -COPY --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker -COPY --from=protolint /usr/local/bin/protolint /usr/bin/ -COPY --from=gitleaks /usr/bin/gitleaks /usr/bin/ +COPY --link --from=actionlint /usr/local/bin/actionlint /usr/bin/actionlint +# shellcheck is a dependency for actionlint + +COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck +# Next COPY line commented because already managed by another linter +# COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck +COPY --link --from=shfmt /bin/shfmt /usr/bin/ +COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint +COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker +COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ +COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ #COPY__END ############################################################################################# @@ -225,28 +238,26 @@ COPY --from=gitleaks /usr/bin/gitleaks /usr/bin/ ############################################################################################# #OTHER__START # actionlint installation -ENV GO111MODULE=on -RUN go install github.com/rhysd/actionlint/cmd/actionlint@latest && go clean --cache \ +# Managed with COPY --link --from=actionlint /usr/local/bin/actionlint /usr/bin/actionlint +# # shellcheck is a dependency for actionlint +# Managed with COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck # bash-exec installation - && printf '#!/bin/bash \n\nif [[ -x "$1" ]]; then exit 0; else echo "Error: File:[$1] is not executable"; exit 1; fi' > /usr/bin/bash-exec \ +RUN printf '#!/bin/bash \n\nif [[ -x "$1" ]]; then exit 0; else echo "Error: File:[$1] is not executable"; exit 1; fi' > /usr/bin/bash-exec \ && chmod +x /usr/bin/bash-exec \ # shellcheck installation - && ML_THIRD_PARTY_DIR="/third-party/shellcheck" \ - && mkdir -p ${ML_THIRD_PARTY_DIR} \ - && wget -qO- "https://github.com/koalaman/shellcheck/releases/download/stable/shellcheck-stable.linux.x86_64.tar.xz" | tar -xJv --directory ${ML_THIRD_PARTY_DIR} \ - && mv "${ML_THIRD_PARTY_DIR}/shellcheck-stable/shellcheck" /usr/bin/ \ - && find ${ML_THIRD_PARTY_DIR} -type f -not -name 'LICENSE*' -delete -o -type d -empty -delete \ +# Managed with # Next COPY line commented because already managed by another linter +# # COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck # shfmt installation -# Managed with COPY --from=shfmt /bin/shfmt /usr/bin/ +# Managed with COPY --link --from=shfmt /bin/shfmt /usr/bin/ # hadolint installation -# Managed with COPY --from=hadolint /bin/hadolint /usr/bin/hadolint +# Managed with COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint # editorconfig-checker installation -# Managed with COPY --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker +# Managed with COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker # dotenv-linter installation && wget -q -O - https://raw.githubusercontent.com/dotenv-linter/dotenv-linter/master/install.sh | sh -s \ @@ -276,10 +287,10 @@ RUN go install github.com/rhysd/actionlint/cmd/actionlint@latest && go clean --c && find ${ML_THIRD_PARTY_DIR} -type f -not -name 'LICENSE*' -delete -o -type d -empty -delete \ # protolint installation -# Managed with COPY --from=protolint /usr/local/bin/protolint /usr/bin/ +# Managed with COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ # gitleaks installation -# Managed with COPY --from=gitleaks /usr/bin/gitleaks /usr/bin/ +# Managed with COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ # trivy installation && wget --tries=5 -q -O - https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin \ diff --git a/flavors/javascript/flavor.json b/flavors/javascript/flavor.json index 31d31cdc44b..b6ce44edbe6 100644 --- a/flavors/javascript/flavor.json +++ b/flavors/javascript/flavor.json @@ -1,6 +1,5 @@ { "descriptors": [ - "ACTION", "BASH", "KOTLIN", "TYPESCRIPT" diff --git a/flavors/php/Dockerfile b/flavors/php/Dockerfile index 76ad3392bb9..b81b1fefe43 100644 --- a/flavors/php/Dockerfile +++ b/flavors/php/Dockerfile @@ -1,4 +1,5 @@ -# MEGA-LINTER FLAVOR [php]: Optimized for PHP based projects +# syntax=docker/dockerfile:1 +# MEGALINTER FLAVOR [php]: Optimized for PHP based projects ########################################### ########################################### ## Dockerfile to run MegaLinter ## @@ -11,6 +12,12 @@ ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #FROM__START +FROM rhysd/actionlint:latest as actionlint +# shellcheck is a dependency for actionlint + +FROM koalaman/shellcheck:stable as shellcheck +# Next FROM line commented because already managed by another linter +# FROM koalaman/shellcheck:stable as shellcheck FROM mvdan/shfmt:latest-alpine as shfmt FROM hadolint/hadolint:v2.12.0-alpine as hadolint FROM mstruebing/editorconfig-checker:2.7.0 as editorconfig-checker @@ -52,7 +59,6 @@ RUN apk add --update --no-cache \ make \ musl-dev \ openssh \ - go \ openjdk11 \ gnupg \ php81 \ @@ -66,6 +72,7 @@ RUN apk add --update --no-cache \ php81-simplexml \ composer \ dpkg \ + py3-pyflakes \ nodejs \ npm \ yarn \ @@ -203,11 +210,17 @@ ENV PATH="/root/.cargo/bin:${PATH}" ############################################################################################# #COPY__START -COPY --from=shfmt /bin/shfmt /usr/bin/ -COPY --from=hadolint /bin/hadolint /usr/bin/hadolint -COPY --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker -COPY --from=protolint /usr/local/bin/protolint /usr/bin/ -COPY --from=gitleaks /usr/bin/gitleaks /usr/bin/ +COPY --link --from=actionlint /usr/local/bin/actionlint /usr/bin/actionlint +# shellcheck is a dependency for actionlint + +COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck +# Next COPY line commented because already managed by another linter +# COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck +COPY --link --from=shfmt /bin/shfmt /usr/bin/ +COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint +COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker +COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ +COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ #COPY__END ############################################################################################# @@ -233,28 +246,26 @@ RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GI ENV PATH="/root/.composer/vendor/bin:$PATH" # actionlint installation -ENV GO111MODULE=on -RUN go install github.com/rhysd/actionlint/cmd/actionlint@latest && go clean --cache \ +# Managed with COPY --link --from=actionlint /usr/local/bin/actionlint /usr/bin/actionlint +# # shellcheck is a dependency for actionlint +# Managed with COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck # bash-exec installation - && printf '#!/bin/bash \n\nif [[ -x "$1" ]]; then exit 0; else echo "Error: File:[$1] is not executable"; exit 1; fi' > /usr/bin/bash-exec \ +RUN printf '#!/bin/bash \n\nif [[ -x "$1" ]]; then exit 0; else echo "Error: File:[$1] is not executable"; exit 1; fi' > /usr/bin/bash-exec \ && chmod +x /usr/bin/bash-exec \ # shellcheck installation - && ML_THIRD_PARTY_DIR="/third-party/shellcheck" \ - && mkdir -p ${ML_THIRD_PARTY_DIR} \ - && wget -qO- "https://github.com/koalaman/shellcheck/releases/download/stable/shellcheck-stable.linux.x86_64.tar.xz" | tar -xJv --directory ${ML_THIRD_PARTY_DIR} \ - && mv "${ML_THIRD_PARTY_DIR}/shellcheck-stable/shellcheck" /usr/bin/ \ - && find ${ML_THIRD_PARTY_DIR} -type f -not -name 'LICENSE*' -delete -o -type d -empty -delete \ +# Managed with # Next COPY line commented because already managed by another linter +# # COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck # shfmt installation -# Managed with COPY --from=shfmt /bin/shfmt /usr/bin/ +# Managed with COPY --link --from=shfmt /bin/shfmt /usr/bin/ # hadolint installation -# Managed with COPY --from=hadolint /bin/hadolint /usr/bin/hadolint +# Managed with COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint # editorconfig-checker installation -# Managed with COPY --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker +# Managed with COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker # dotenv-linter installation && wget -q -O - https://raw.githubusercontent.com/dotenv-linter/dotenv-linter/master/install.sh | sh -s \ @@ -301,10 +312,10 @@ RUN composer global require --ignore-platform-reqs overtrue/phplint ^5.3 \ && composer global config bin-dir --absolute \ # protolint installation -# Managed with COPY --from=protolint /usr/local/bin/protolint /usr/bin/ +# Managed with COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ # gitleaks installation -# Managed with COPY --from=gitleaks /usr/bin/gitleaks /usr/bin/ +# Managed with COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ # trivy installation && wget --tries=5 -q -O - https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin \ diff --git a/flavors/php/flavor.json b/flavors/php/flavor.json index 3716e6350e4..bf6b63dea7a 100644 --- a/flavors/php/flavor.json +++ b/flavors/php/flavor.json @@ -1,6 +1,5 @@ { "descriptors": [ - "ACTION", "BASH", "KOTLIN", "PHP" diff --git a/flavors/python/Dockerfile b/flavors/python/Dockerfile index 8d4e7e60892..c81701b37c1 100644 --- a/flavors/python/Dockerfile +++ b/flavors/python/Dockerfile @@ -1,4 +1,5 @@ -# MEGA-LINTER FLAVOR [python]: Optimized for PYTHON based projects +# syntax=docker/dockerfile:1 +# MEGALINTER FLAVOR [python]: Optimized for PYTHON based projects ########################################### ########################################### ## Dockerfile to run MegaLinter ## @@ -11,9 +12,16 @@ ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #FROM__START +FROM rhysd/actionlint:latest as actionlint +# shellcheck is a dependency for actionlint + +FROM koalaman/shellcheck:stable as shellcheck +# Next FROM line commented because already managed by another linter +# FROM koalaman/shellcheck:stable as shellcheck FROM mvdan/shfmt:latest-alpine as shfmt FROM hadolint/hadolint:v2.12.0-alpine as hadolint FROM mstruebing/editorconfig-checker:2.7.0 as editorconfig-checker +FROM mrtazz/checkmake:latest as checkmake FROM yoheimuta/protolint:latest as protolint FROM zricethezav/gitleaks:v8.15.3 as gitleaks #FROM__END @@ -52,8 +60,8 @@ RUN apk add --update --no-cache \ make \ musl-dev \ openssh \ - go \ openjdk11 \ + py3-pyflakes \ nodejs \ npm \ yarn \ @@ -201,11 +209,18 @@ ENV PATH="/root/.cargo/bin:${PATH}" ############################################################################################# #COPY__START -COPY --from=shfmt /bin/shfmt /usr/bin/ -COPY --from=hadolint /bin/hadolint /usr/bin/hadolint -COPY --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker -COPY --from=protolint /usr/local/bin/protolint /usr/bin/ -COPY --from=gitleaks /usr/bin/gitleaks /usr/bin/ +COPY --link --from=actionlint /usr/local/bin/actionlint /usr/bin/actionlint +# shellcheck is a dependency for actionlint + +COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck +# Next COPY line commented because already managed by another linter +# COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck +COPY --link --from=shfmt /bin/shfmt /usr/bin/ +COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint +COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker +COPY --link --from=checkmake /checkmake /usr/bin/checkmake +COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ +COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ #COPY__END ############################################################################################# @@ -213,28 +228,26 @@ COPY --from=gitleaks /usr/bin/gitleaks /usr/bin/ ############################################################################################# #OTHER__START # actionlint installation -ENV GO111MODULE=on -RUN go install github.com/rhysd/actionlint/cmd/actionlint@latest && go clean --cache \ +# Managed with COPY --link --from=actionlint /usr/local/bin/actionlint /usr/bin/actionlint +# # shellcheck is a dependency for actionlint +# Managed with COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck # bash-exec installation - && printf '#!/bin/bash \n\nif [[ -x "$1" ]]; then exit 0; else echo "Error: File:[$1] is not executable"; exit 1; fi' > /usr/bin/bash-exec \ +RUN printf '#!/bin/bash \n\nif [[ -x "$1" ]]; then exit 0; else echo "Error: File:[$1] is not executable"; exit 1; fi' > /usr/bin/bash-exec \ && chmod +x /usr/bin/bash-exec \ # shellcheck installation - && ML_THIRD_PARTY_DIR="/third-party/shellcheck" \ - && mkdir -p ${ML_THIRD_PARTY_DIR} \ - && wget -qO- "https://github.com/koalaman/shellcheck/releases/download/stable/shellcheck-stable.linux.x86_64.tar.xz" | tar -xJv --directory ${ML_THIRD_PARTY_DIR} \ - && mv "${ML_THIRD_PARTY_DIR}/shellcheck-stable/shellcheck" /usr/bin/ \ - && find ${ML_THIRD_PARTY_DIR} -type f -not -name 'LICENSE*' -delete -o -type d -empty -delete \ +# Managed with # Next COPY line commented because already managed by another linter +# # COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck # shfmt installation -# Managed with COPY --from=shfmt /bin/shfmt /usr/bin/ +# Managed with COPY --link --from=shfmt /bin/shfmt /usr/bin/ # hadolint installation -# Managed with COPY --from=hadolint /bin/hadolint /usr/bin/hadolint +# Managed with COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint # editorconfig-checker installation -# Managed with COPY --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker +# Managed with COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker # dotenv-linter installation && wget -q -O - https://raw.githubusercontent.com/dotenv-linter/dotenv-linter/master/install.sh | sh -s \ @@ -264,15 +277,13 @@ RUN go install github.com/rhysd/actionlint/cmd/actionlint@latest && go clean --c && find ${ML_THIRD_PARTY_DIR} -type f -not -name 'LICENSE*' -delete -o -type d -empty -delete \ # checkmake installation - && ( [ -d /usr/local/bin ] || mkdir -p /usr/local/bin ) \ - && wget -q "https://github.com/mrtazz/checkmake/releases/download/0.2.1/checkmake-0.2.1.linux.amd64" -O /usr/local/bin/checkmake \ - && chmod 755 /usr/local/bin/checkmake \ +# Managed with COPY --link --from=checkmake /checkmake /usr/bin/checkmake # protolint installation -# Managed with COPY --from=protolint /usr/local/bin/protolint /usr/bin/ +# Managed with COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ # gitleaks installation -# Managed with COPY --from=gitleaks /usr/bin/gitleaks /usr/bin/ +# Managed with COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ # trivy installation && wget --tries=5 -q -O - https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin \ diff --git a/flavors/python/flavor.json b/flavors/python/flavor.json index eaf5fdfefce..31c09ff92ea 100644 --- a/flavors/python/flavor.json +++ b/flavors/python/flavor.json @@ -1,6 +1,5 @@ { "descriptors": [ - "ACTION", "BASH", "KOTLIN" ], diff --git a/flavors/ruby/Dockerfile b/flavors/ruby/Dockerfile index 07edbdaae3b..46de9c823e7 100644 --- a/flavors/ruby/Dockerfile +++ b/flavors/ruby/Dockerfile @@ -1,4 +1,5 @@ -# MEGA-LINTER FLAVOR [ruby]: Optimized for RUBY based projects +# syntax=docker/dockerfile:1 +# MEGALINTER FLAVOR [ruby]: Optimized for RUBY based projects ########################################### ########################################### ## Dockerfile to run MegaLinter ## @@ -11,6 +12,12 @@ ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #FROM__START +FROM rhysd/actionlint:latest as actionlint +# shellcheck is a dependency for actionlint + +FROM koalaman/shellcheck:stable as shellcheck +# Next FROM line commented because already managed by another linter +# FROM koalaman/shellcheck:stable as shellcheck FROM mvdan/shfmt:latest-alpine as shfmt FROM hadolint/hadolint:v2.12.0-alpine as hadolint FROM mstruebing/editorconfig-checker:2.7.0 as editorconfig-checker @@ -52,8 +59,8 @@ RUN apk add --update --no-cache \ make \ musl-dev \ openssh \ - go \ openjdk11 \ + py3-pyflakes \ nodejs \ npm \ yarn \ @@ -197,11 +204,17 @@ ENV PATH="/root/.cargo/bin:${PATH}" ############################################################################################# #COPY__START -COPY --from=shfmt /bin/shfmt /usr/bin/ -COPY --from=hadolint /bin/hadolint /usr/bin/hadolint -COPY --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker -COPY --from=protolint /usr/local/bin/protolint /usr/bin/ -COPY --from=gitleaks /usr/bin/gitleaks /usr/bin/ +COPY --link --from=actionlint /usr/local/bin/actionlint /usr/bin/actionlint +# shellcheck is a dependency for actionlint + +COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck +# Next COPY line commented because already managed by another linter +# COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck +COPY --link --from=shfmt /bin/shfmt /usr/bin/ +COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint +COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker +COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ +COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ #COPY__END ############################################################################################# @@ -209,28 +222,26 @@ COPY --from=gitleaks /usr/bin/gitleaks /usr/bin/ ############################################################################################# #OTHER__START # actionlint installation -ENV GO111MODULE=on -RUN go install github.com/rhysd/actionlint/cmd/actionlint@latest && go clean --cache \ +# Managed with COPY --link --from=actionlint /usr/local/bin/actionlint /usr/bin/actionlint +# # shellcheck is a dependency for actionlint +# Managed with COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck # bash-exec installation - && printf '#!/bin/bash \n\nif [[ -x "$1" ]]; then exit 0; else echo "Error: File:[$1] is not executable"; exit 1; fi' > /usr/bin/bash-exec \ +RUN printf '#!/bin/bash \n\nif [[ -x "$1" ]]; then exit 0; else echo "Error: File:[$1] is not executable"; exit 1; fi' > /usr/bin/bash-exec \ && chmod +x /usr/bin/bash-exec \ # shellcheck installation - && ML_THIRD_PARTY_DIR="/third-party/shellcheck" \ - && mkdir -p ${ML_THIRD_PARTY_DIR} \ - && wget -qO- "https://github.com/koalaman/shellcheck/releases/download/stable/shellcheck-stable.linux.x86_64.tar.xz" | tar -xJv --directory ${ML_THIRD_PARTY_DIR} \ - && mv "${ML_THIRD_PARTY_DIR}/shellcheck-stable/shellcheck" /usr/bin/ \ - && find ${ML_THIRD_PARTY_DIR} -type f -not -name 'LICENSE*' -delete -o -type d -empty -delete \ +# Managed with # Next COPY line commented because already managed by another linter +# # COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck # shfmt installation -# Managed with COPY --from=shfmt /bin/shfmt /usr/bin/ +# Managed with COPY --link --from=shfmt /bin/shfmt /usr/bin/ # hadolint installation -# Managed with COPY --from=hadolint /bin/hadolint /usr/bin/hadolint +# Managed with COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint # editorconfig-checker installation -# Managed with COPY --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker +# Managed with COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker # dotenv-linter installation && wget -q -O - https://raw.githubusercontent.com/dotenv-linter/dotenv-linter/master/install.sh | sh -s \ @@ -260,10 +271,10 @@ RUN go install github.com/rhysd/actionlint/cmd/actionlint@latest && go clean --c && find ${ML_THIRD_PARTY_DIR} -type f -not -name 'LICENSE*' -delete -o -type d -empty -delete \ # protolint installation -# Managed with COPY --from=protolint /usr/local/bin/protolint /usr/bin/ +# Managed with COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ # gitleaks installation -# Managed with COPY --from=gitleaks /usr/bin/gitleaks /usr/bin/ +# Managed with COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ # trivy installation && wget --tries=5 -q -O - https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin \ diff --git a/flavors/ruby/flavor.json b/flavors/ruby/flavor.json index 55f0f058ee5..1a7caa05aeb 100644 --- a/flavors/ruby/flavor.json +++ b/flavors/ruby/flavor.json @@ -1,6 +1,5 @@ { "descriptors": [ - "ACTION", "BASH", "KOTLIN" ], diff --git a/flavors/rust/Dockerfile b/flavors/rust/Dockerfile index 99bd027a382..f1dd4eb4cc6 100644 --- a/flavors/rust/Dockerfile +++ b/flavors/rust/Dockerfile @@ -1,4 +1,5 @@ -# MEGA-LINTER FLAVOR [rust]: Optimized for RUST based projects +# syntax=docker/dockerfile:1 +# MEGALINTER FLAVOR [rust]: Optimized for RUST based projects ########################################### ########################################### ## Dockerfile to run MegaLinter ## @@ -11,6 +12,12 @@ ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #FROM__START +FROM rhysd/actionlint:latest as actionlint +# shellcheck is a dependency for actionlint + +FROM koalaman/shellcheck:stable as shellcheck +# Next FROM line commented because already managed by another linter +# FROM koalaman/shellcheck:stable as shellcheck FROM mvdan/shfmt:latest-alpine as shfmt FROM hadolint/hadolint:v2.12.0-alpine as hadolint FROM mstruebing/editorconfig-checker:2.7.0 as editorconfig-checker @@ -52,8 +59,8 @@ RUN apk add --update --no-cache \ make \ musl-dev \ openssh \ - go \ openjdk11 \ + py3-pyflakes \ nodejs \ npm \ yarn \ @@ -191,11 +198,17 @@ ENV PATH="/root/.cargo/bin:${PATH}" ############################################################################################# #COPY__START -COPY --from=shfmt /bin/shfmt /usr/bin/ -COPY --from=hadolint /bin/hadolint /usr/bin/hadolint -COPY --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker -COPY --from=protolint /usr/local/bin/protolint /usr/bin/ -COPY --from=gitleaks /usr/bin/gitleaks /usr/bin/ +COPY --link --from=actionlint /usr/local/bin/actionlint /usr/bin/actionlint +# shellcheck is a dependency for actionlint + +COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck +# Next COPY line commented because already managed by another linter +# COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck +COPY --link --from=shfmt /bin/shfmt /usr/bin/ +COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint +COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker +COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ +COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ #COPY__END ############################################################################################# @@ -203,28 +216,26 @@ COPY --from=gitleaks /usr/bin/gitleaks /usr/bin/ ############################################################################################# #OTHER__START # actionlint installation -ENV GO111MODULE=on -RUN go install github.com/rhysd/actionlint/cmd/actionlint@latest && go clean --cache \ +# Managed with COPY --link --from=actionlint /usr/local/bin/actionlint /usr/bin/actionlint +# # shellcheck is a dependency for actionlint +# Managed with COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck # bash-exec installation - && printf '#!/bin/bash \n\nif [[ -x "$1" ]]; then exit 0; else echo "Error: File:[$1] is not executable"; exit 1; fi' > /usr/bin/bash-exec \ +RUN printf '#!/bin/bash \n\nif [[ -x "$1" ]]; then exit 0; else echo "Error: File:[$1] is not executable"; exit 1; fi' > /usr/bin/bash-exec \ && chmod +x /usr/bin/bash-exec \ # shellcheck installation - && ML_THIRD_PARTY_DIR="/third-party/shellcheck" \ - && mkdir -p ${ML_THIRD_PARTY_DIR} \ - && wget -qO- "https://github.com/koalaman/shellcheck/releases/download/stable/shellcheck-stable.linux.x86_64.tar.xz" | tar -xJv --directory ${ML_THIRD_PARTY_DIR} \ - && mv "${ML_THIRD_PARTY_DIR}/shellcheck-stable/shellcheck" /usr/bin/ \ - && find ${ML_THIRD_PARTY_DIR} -type f -not -name 'LICENSE*' -delete -o -type d -empty -delete \ +# Managed with # Next COPY line commented because already managed by another linter +# # COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck # shfmt installation -# Managed with COPY --from=shfmt /bin/shfmt /usr/bin/ +# Managed with COPY --link --from=shfmt /bin/shfmt /usr/bin/ # hadolint installation -# Managed with COPY --from=hadolint /bin/hadolint /usr/bin/hadolint +# Managed with COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint # editorconfig-checker installation -# Managed with COPY --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker +# Managed with COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker # dotenv-linter installation && wget -q -O - https://raw.githubusercontent.com/dotenv-linter/dotenv-linter/master/install.sh | sh -s \ @@ -254,10 +265,10 @@ RUN go install github.com/rhysd/actionlint/cmd/actionlint@latest && go clean --c && find ${ML_THIRD_PARTY_DIR} -type f -not -name 'LICENSE*' -delete -o -type d -empty -delete \ # protolint installation -# Managed with COPY --from=protolint /usr/local/bin/protolint /usr/bin/ +# Managed with COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ # gitleaks installation -# Managed with COPY --from=gitleaks /usr/bin/gitleaks /usr/bin/ +# Managed with COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ # trivy installation && wget --tries=5 -q -O - https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin \ diff --git a/flavors/rust/flavor.json b/flavors/rust/flavor.json index df6ae986711..ee66213a12f 100644 --- a/flavors/rust/flavor.json +++ b/flavors/rust/flavor.json @@ -1,6 +1,5 @@ { "descriptors": [ - "ACTION", "BASH", "KOTLIN" ], diff --git a/flavors/salesforce/Dockerfile b/flavors/salesforce/Dockerfile index fc9aff0f178..a8e84b5df31 100644 --- a/flavors/salesforce/Dockerfile +++ b/flavors/salesforce/Dockerfile @@ -1,4 +1,5 @@ -# MEGA-LINTER FLAVOR [salesforce]: Optimized for Salesforce based projects +# syntax=docker/dockerfile:1 +# MEGALINTER FLAVOR [salesforce]: Optimized for Salesforce based projects ########################################### ########################################### ## Dockerfile to run MegaLinter ## @@ -11,6 +12,12 @@ ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #FROM__START +FROM rhysd/actionlint:latest as actionlint +# shellcheck is a dependency for actionlint + +FROM koalaman/shellcheck:stable as shellcheck +# Next FROM line commented because already managed by another linter +# FROM koalaman/shellcheck:stable as shellcheck FROM mvdan/shfmt:latest-alpine as shfmt FROM hadolint/hadolint:v2.12.0-alpine as hadolint FROM mstruebing/editorconfig-checker:2.7.0 as editorconfig-checker @@ -52,8 +59,8 @@ RUN apk add --update --no-cache \ make \ musl-dev \ openssh \ - go \ openjdk11 \ + py3-pyflakes \ nodejs \ npm \ yarn \ @@ -194,11 +201,17 @@ ENV PATH="/root/.cargo/bin:${PATH}" ############################################################################################# #COPY__START -COPY --from=shfmt /bin/shfmt /usr/bin/ -COPY --from=hadolint /bin/hadolint /usr/bin/hadolint -COPY --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker -COPY --from=protolint /usr/local/bin/protolint /usr/bin/ -COPY --from=gitleaks /usr/bin/gitleaks /usr/bin/ +COPY --link --from=actionlint /usr/local/bin/actionlint /usr/bin/actionlint +# shellcheck is a dependency for actionlint + +COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck +# Next COPY line commented because already managed by another linter +# COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck +COPY --link --from=shfmt /bin/shfmt /usr/bin/ +COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint +COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker +COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ +COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ #COPY__END ############################################################################################# @@ -210,32 +223,29 @@ ENV JAVA_HOME=/usr/lib/jvm/java-11-openjdk ENV PATH="$JAVA_HOME/bin:${PATH}" RUN echo y|sfdx plugins:install sfdx-hardis \ && npm cache clean --force || true \ - && rm -rf /root/.npm/_cacache - + && rm -rf /root/.npm/_cacache \ # actionlint installation -ENV GO111MODULE=on -RUN go install github.com/rhysd/actionlint/cmd/actionlint@latest && go clean --cache \ +# Managed with COPY --link --from=actionlint /usr/local/bin/actionlint /usr/bin/actionlint +# # shellcheck is a dependency for actionlint +# Managed with COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck # bash-exec installation && printf '#!/bin/bash \n\nif [[ -x "$1" ]]; then exit 0; else echo "Error: File:[$1] is not executable"; exit 1; fi' > /usr/bin/bash-exec \ && chmod +x /usr/bin/bash-exec \ # shellcheck installation - && ML_THIRD_PARTY_DIR="/third-party/shellcheck" \ - && mkdir -p ${ML_THIRD_PARTY_DIR} \ - && wget -qO- "https://github.com/koalaman/shellcheck/releases/download/stable/shellcheck-stable.linux.x86_64.tar.xz" | tar -xJv --directory ${ML_THIRD_PARTY_DIR} \ - && mv "${ML_THIRD_PARTY_DIR}/shellcheck-stable/shellcheck" /usr/bin/ \ - && find ${ML_THIRD_PARTY_DIR} -type f -not -name 'LICENSE*' -delete -o -type d -empty -delete \ +# Managed with # Next COPY line commented because already managed by another linter +# # COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck # shfmt installation -# Managed with COPY --from=shfmt /bin/shfmt /usr/bin/ +# Managed with COPY --link --from=shfmt /bin/shfmt /usr/bin/ # hadolint installation -# Managed with COPY --from=hadolint /bin/hadolint /usr/bin/hadolint +# Managed with COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint # editorconfig-checker installation -# Managed with COPY --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker +# Managed with COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker # dotenv-linter installation && wget -q -O - https://raw.githubusercontent.com/dotenv-linter/dotenv-linter/master/install.sh | sh -s \ @@ -265,10 +275,10 @@ RUN go install github.com/rhysd/actionlint/cmd/actionlint@latest && go clean --c && find ${ML_THIRD_PARTY_DIR} -type f -not -name 'LICENSE*' -delete -o -type d -empty -delete \ # protolint installation -# Managed with COPY --from=protolint /usr/local/bin/protolint /usr/bin/ +# Managed with COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ # gitleaks installation -# Managed with COPY --from=gitleaks /usr/bin/gitleaks /usr/bin/ +# Managed with COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ # trivy installation && wget --tries=5 -q -O - https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin \ diff --git a/flavors/salesforce/flavor.json b/flavors/salesforce/flavor.json index 835bbe780f1..bc2d5ece479 100644 --- a/flavors/salesforce/flavor.json +++ b/flavors/salesforce/flavor.json @@ -1,6 +1,5 @@ { "descriptors": [ - "ACTION", "BASH", "KOTLIN", "SALESFORCE" diff --git a/flavors/security/Dockerfile b/flavors/security/Dockerfile index 97aea287683..3f836600b7d 100644 --- a/flavors/security/Dockerfile +++ b/flavors/security/Dockerfile @@ -1,4 +1,5 @@ -# MEGA-LINTER FLAVOR [security]: Optimized for security +# syntax=docker/dockerfile:1 +# MEGALINTER FLAVOR [security]: Optimized for security ########################################### ########################################### ## Dockerfile to run MegaLinter ## @@ -11,7 +12,11 @@ ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #FROM__START +FROM koalaman/shellcheck:stable as shellcheck FROM hadolint/hadolint:v2.12.0-alpine as hadolint +FROM golang:alpine as dustilock +RUN GOBIN=/usr/bin go install github.com/checkmarx/dustilock@v1.2.0 + FROM zricethezav/gitleaks:v8.15.3 as gitleaks FROM ghcr.io/terraform-linters/tflint:v0.45.0 as tflint FROM tenable/terrascan:1.18.0 as terrascan @@ -61,7 +66,6 @@ RUN apk add --update --no-cache \ lttng-ust-dev \ zlib \ zlib-dev \ - go \ npm \ nodejs-current \ yarn \ @@ -161,12 +165,14 @@ ENV PATH="/root/.cargo/bin:${PATH}" ############################################################################################# #COPY__START -COPY --from=hadolint /bin/hadolint /usr/bin/hadolint -COPY --from=gitleaks /usr/bin/gitleaks /usr/bin/ -COPY --from=tflint /usr/local/bin/tflint /usr/bin/ -COPY --from=terrascan /go/bin/terrascan /usr/bin/ -COPY --from=terragrunt /usr/local/bin/terragrunt /usr/bin/ -COPY --from=kics /app/bin/kics /usr/bin/ +COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck +COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint +COPY --link --from=dustilock /usr/bin/dustilock /usr/bin/dustilock +COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ +COPY --link --from=tflint /usr/local/bin/tflint /usr/bin/ +COPY --link --from=terrascan /go/bin/terrascan /usr/bin/ +COPY --link --from=terragrunt /usr/local/bin/terragrunt /usr/bin/ +COPY --link --from=kics /app/bin/kics /usr/bin/ COPY --from=kics /app/bin/assets /opt/kics/assets/ #COPY__END @@ -179,14 +185,10 @@ RUN printf '#!/bin/bash \n\nif [[ -x "$1" ]]; then exit 0; else echo "Error: Fil && chmod +x /usr/bin/bash-exec \ # shellcheck installation - && ML_THIRD_PARTY_DIR="/third-party/shellcheck" \ - && mkdir -p ${ML_THIRD_PARTY_DIR} \ - && wget -qO- "https://github.com/koalaman/shellcheck/releases/download/stable/shellcheck-stable.linux.x86_64.tar.xz" | tar -xJv --directory ${ML_THIRD_PARTY_DIR} \ - && mv "${ML_THIRD_PARTY_DIR}/shellcheck-stable/shellcheck" /usr/bin/ \ - && find ${ML_THIRD_PARTY_DIR} -type f -not -name 'LICENSE*' -delete -o -type d -empty -delete \ +# Managed with COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck # hadolint installation -# Managed with COPY --from=hadolint /bin/hadolint /usr/bin/hadolint +# Managed with COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint # kubeval installation && ML_THIRD_PARTY_DIR="/third-party/kubeval" \ @@ -216,18 +218,10 @@ ENV PATH="${PATH}:/root/.dotnet/tools:/usr/share/dotnet" RUN dotnet tool install --global Microsoft.CST.DevSkim.CLI \ # dustilock installation - && ML_THIRD_PARTY_DIR=/download/dustilock && \ - mkdir -p ${ML_THIRD_PARTY_DIR} && \ - git clone https://github.com/Checkmarx/dustilock.git ${ML_THIRD_PARTY_DIR} && \ - cd ${ML_THIRD_PARTY_DIR} && \ - go build && go clean --cache && \ - chmod +x dustilock && \ - mv "${ML_THIRD_PARTY_DIR}/dustilock" /usr/bin/ && \ - find ${ML_THIRD_PARTY_DIR} -type f -not -name 'LICENSE*' -delete -o -type d -empty -delete && \ - cd / \ +# Managed with COPY --link --from=dustilock /usr/bin/dustilock /usr/bin/dustilock # gitleaks installation -# Managed with COPY --from=gitleaks /usr/bin/gitleaks /usr/bin/ +# Managed with COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ # syft installation && curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b /usr/local/bin \ @@ -236,16 +230,16 @@ RUN dotnet tool install --global Microsoft.CST.DevSkim.CLI \ && wget --tries=5 -q -O - https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin \ # tflint installation -# Managed with COPY --from=tflint /usr/local/bin/tflint /usr/bin/ +# Managed with COPY --link --from=tflint /usr/local/bin/tflint /usr/bin/ # terrascan installation -# Managed with COPY --from=terrascan /go/bin/terrascan /usr/bin/ +# Managed with COPY --link --from=terrascan /go/bin/terrascan /usr/bin/ # terragrunt installation -# Managed with COPY --from=terragrunt /usr/local/bin/terragrunt /usr/bin/ +# Managed with COPY --link --from=terragrunt /usr/local/bin/terragrunt /usr/bin/ # kics installation -# Managed with COPY --from=kics /app/bin/kics /usr/bin/ +# Managed with COPY --link --from=kics /app/bin/kics /usr/bin/ && mkdir -p /opt/kics/assets ENV KICS_QUERIES_PATH=/opt/kics/assets/queries KICS_LIBRARIES_PATH=/opt/kics/assets/libraries # Managed with COPY --from=kics /app/bin/assets /opt/kics/assets/ diff --git a/flavors/swift/Dockerfile b/flavors/swift/Dockerfile index 17a0ed2c891..afcc8886f04 100644 --- a/flavors/swift/Dockerfile +++ b/flavors/swift/Dockerfile @@ -1,4 +1,5 @@ -# MEGA-LINTER FLAVOR [swift]: Optimized for SWIFT based projects +# syntax=docker/dockerfile:1 +# MEGALINTER FLAVOR [swift]: Optimized for SWIFT based projects ########################################### ########################################### ## Dockerfile to run MegaLinter ## @@ -11,6 +12,12 @@ ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #FROM__START +FROM rhysd/actionlint:latest as actionlint +# shellcheck is a dependency for actionlint + +FROM koalaman/shellcheck:stable as shellcheck +# Next FROM line commented because already managed by another linter +# FROM koalaman/shellcheck:stable as shellcheck FROM mvdan/shfmt:latest-alpine as shfmt FROM hadolint/hadolint:v2.12.0-alpine as hadolint FROM mstruebing/editorconfig-checker:2.7.0 as editorconfig-checker @@ -54,8 +61,8 @@ RUN apk add --update --no-cache \ openssh \ docker \ openrc \ - go \ openjdk11 \ + py3-pyflakes \ nodejs \ npm \ yarn \ @@ -193,41 +200,45 @@ ENV PATH="/root/.cargo/bin:${PATH}" ############################################################################################# #COPY__START -COPY --from=shfmt /bin/shfmt /usr/bin/ -COPY --from=hadolint /bin/hadolint /usr/bin/hadolint -COPY --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker -COPY --from=protolint /usr/local/bin/protolint /usr/bin/ -COPY --from=gitleaks /usr/bin/gitleaks /usr/bin/ +COPY --link --from=actionlint /usr/local/bin/actionlint /usr/bin/actionlint +# shellcheck is a dependency for actionlint + +COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck +# Next COPY line commented because already managed by another linter +# COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck +COPY --link --from=shfmt /bin/shfmt /usr/bin/ +COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint +COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker +COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ +COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ #COPY__END ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #OTHER__START -RUN rc-update add docker boot && rc-service docker start || true +RUN rc-update add docker boot && rc-service docker start || true \ # actionlint installation -ENV GO111MODULE=on -RUN go install github.com/rhysd/actionlint/cmd/actionlint@latest && go clean --cache \ +# Managed with COPY --link --from=actionlint /usr/local/bin/actionlint /usr/bin/actionlint +# # shellcheck is a dependency for actionlint +# Managed with COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck # bash-exec installation && printf '#!/bin/bash \n\nif [[ -x "$1" ]]; then exit 0; else echo "Error: File:[$1] is not executable"; exit 1; fi' > /usr/bin/bash-exec \ && chmod +x /usr/bin/bash-exec \ # shellcheck installation - && ML_THIRD_PARTY_DIR="/third-party/shellcheck" \ - && mkdir -p ${ML_THIRD_PARTY_DIR} \ - && wget -qO- "https://github.com/koalaman/shellcheck/releases/download/stable/shellcheck-stable.linux.x86_64.tar.xz" | tar -xJv --directory ${ML_THIRD_PARTY_DIR} \ - && mv "${ML_THIRD_PARTY_DIR}/shellcheck-stable/shellcheck" /usr/bin/ \ - && find ${ML_THIRD_PARTY_DIR} -type f -not -name 'LICENSE*' -delete -o -type d -empty -delete \ +# Managed with # Next COPY line commented because already managed by another linter +# # COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck # shfmt installation -# Managed with COPY --from=shfmt /bin/shfmt /usr/bin/ +# Managed with COPY --link --from=shfmt /bin/shfmt /usr/bin/ # hadolint installation -# Managed with COPY --from=hadolint /bin/hadolint /usr/bin/hadolint +# Managed with COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint # editorconfig-checker installation -# Managed with COPY --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker +# Managed with COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker # dotenv-linter installation && wget -q -O - https://raw.githubusercontent.com/dotenv-linter/dotenv-linter/master/install.sh | sh -s \ @@ -257,10 +268,10 @@ RUN go install github.com/rhysd/actionlint/cmd/actionlint@latest && go clean --c && find ${ML_THIRD_PARTY_DIR} -type f -not -name 'LICENSE*' -delete -o -type d -empty -delete \ # protolint installation -# Managed with COPY --from=protolint /usr/local/bin/protolint /usr/bin/ +# Managed with COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ # gitleaks installation -# Managed with COPY --from=gitleaks /usr/bin/gitleaks /usr/bin/ +# Managed with COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ # trivy installation && wget --tries=5 -q -O - https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin \ diff --git a/flavors/swift/flavor.json b/flavors/swift/flavor.json index bde47f2e467..53910bb7a7a 100644 --- a/flavors/swift/flavor.json +++ b/flavors/swift/flavor.json @@ -1,6 +1,5 @@ { "descriptors": [ - "ACTION", "BASH", "KOTLIN" ], diff --git a/flavors/terraform/Dockerfile b/flavors/terraform/Dockerfile index cb0b6cdd1d0..5cdc7ffca7e 100644 --- a/flavors/terraform/Dockerfile +++ b/flavors/terraform/Dockerfile @@ -1,4 +1,5 @@ -# MEGA-LINTER FLAVOR [terraform]: Optimized for TERRAFORM based projects +# syntax=docker/dockerfile:1 +# MEGALINTER FLAVOR [terraform]: Optimized for TERRAFORM based projects ########################################### ########################################### ## Dockerfile to run MegaLinter ## @@ -11,6 +12,12 @@ ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #FROM__START +FROM rhysd/actionlint:latest as actionlint +# shellcheck is a dependency for actionlint + +FROM koalaman/shellcheck:stable as shellcheck +# Next FROM line commented because already managed by another linter +# FROM koalaman/shellcheck:stable as shellcheck FROM mvdan/shfmt:latest-alpine as shfmt FROM hadolint/hadolint:v2.12.0-alpine as hadolint FROM mstruebing/editorconfig-checker:2.7.0 as editorconfig-checker @@ -19,6 +26,8 @@ FROM zricethezav/gitleaks:v8.15.3 as gitleaks FROM ghcr.io/terraform-linters/tflint:v0.45.0 as tflint FROM tenable/terrascan:1.18.0 as terrascan FROM alpine/terragrunt:latest as terragrunt +# Next FROM line commented because already managed by another linter +# FROM alpine/terragrunt:latest as terragrunt FROM checkmarx/kics:alpine as kics #FROM__END @@ -56,8 +65,8 @@ RUN apk add --update --no-cache \ make \ musl-dev \ openssh \ - go \ openjdk11 \ + py3-pyflakes \ nodejs \ npm \ yarn \ @@ -195,16 +204,22 @@ ENV PATH="/root/.cargo/bin:${PATH}" ############################################################################################# #COPY__START -COPY --from=shfmt /bin/shfmt /usr/bin/ -COPY --from=hadolint /bin/hadolint /usr/bin/hadolint -COPY --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker -COPY --from=protolint /usr/local/bin/protolint /usr/bin/ -COPY --from=gitleaks /usr/bin/gitleaks /usr/bin/ -COPY --from=tflint /usr/local/bin/tflint /usr/bin/ -COPY --from=terrascan /go/bin/terrascan /usr/bin/ -COPY --from=terragrunt /usr/local/bin/terragrunt /usr/bin/ -COPY --from=terragrunt /bin/terraform /usr/bin/ -COPY --from=kics /app/bin/kics /usr/bin/ +COPY --link --from=actionlint /usr/local/bin/actionlint /usr/bin/actionlint +# shellcheck is a dependency for actionlint + +COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck +# Next COPY line commented because already managed by another linter +# COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck +COPY --link --from=shfmt /bin/shfmt /usr/bin/ +COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint +COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker +COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ +COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ +COPY --link --from=tflint /usr/local/bin/tflint /usr/bin/ +COPY --link --from=terrascan /go/bin/terrascan /usr/bin/ +COPY --link --from=terragrunt /usr/local/bin/terragrunt /usr/bin/ +COPY --link --from=terragrunt /bin/terraform /usr/bin/ +COPY --link --from=kics /app/bin/kics /usr/bin/ COPY --from=kics /app/bin/assets /opt/kics/assets/ #COPY__END @@ -213,28 +228,26 @@ COPY --from=kics /app/bin/assets /opt/kics/assets/ ############################################################################################# #OTHER__START # actionlint installation -ENV GO111MODULE=on -RUN go install github.com/rhysd/actionlint/cmd/actionlint@latest && go clean --cache \ +# Managed with COPY --link --from=actionlint /usr/local/bin/actionlint /usr/bin/actionlint +# # shellcheck is a dependency for actionlint +# Managed with COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck # bash-exec installation - && printf '#!/bin/bash \n\nif [[ -x "$1" ]]; then exit 0; else echo "Error: File:[$1] is not executable"; exit 1; fi' > /usr/bin/bash-exec \ +RUN printf '#!/bin/bash \n\nif [[ -x "$1" ]]; then exit 0; else echo "Error: File:[$1] is not executable"; exit 1; fi' > /usr/bin/bash-exec \ && chmod +x /usr/bin/bash-exec \ # shellcheck installation - && ML_THIRD_PARTY_DIR="/third-party/shellcheck" \ - && mkdir -p ${ML_THIRD_PARTY_DIR} \ - && wget -qO- "https://github.com/koalaman/shellcheck/releases/download/stable/shellcheck-stable.linux.x86_64.tar.xz" | tar -xJv --directory ${ML_THIRD_PARTY_DIR} \ - && mv "${ML_THIRD_PARTY_DIR}/shellcheck-stable/shellcheck" /usr/bin/ \ - && find ${ML_THIRD_PARTY_DIR} -type f -not -name 'LICENSE*' -delete -o -type d -empty -delete \ +# Managed with # Next COPY line commented because already managed by another linter +# # COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck # shfmt installation -# Managed with COPY --from=shfmt /bin/shfmt /usr/bin/ +# Managed with COPY --link --from=shfmt /bin/shfmt /usr/bin/ # hadolint installation -# Managed with COPY --from=hadolint /bin/hadolint /usr/bin/hadolint +# Managed with COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint # editorconfig-checker installation -# Managed with COPY --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker +# Managed with COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker # dotenv-linter installation && wget -q -O - https://raw.githubusercontent.com/dotenv-linter/dotenv-linter/master/install.sh | sh -s \ @@ -264,10 +277,10 @@ RUN go install github.com/rhysd/actionlint/cmd/actionlint@latest && go clean --c && find ${ML_THIRD_PARTY_DIR} -type f -not -name 'LICENSE*' -delete -o -type d -empty -delete \ # protolint installation -# Managed with COPY --from=protolint /usr/local/bin/protolint /usr/bin/ +# Managed with COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ # gitleaks installation -# Managed with COPY --from=gitleaks /usr/bin/gitleaks /usr/bin/ +# Managed with COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ # trivy installation && wget --tries=5 -q -O - https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin \ @@ -281,19 +294,19 @@ RUN go install github.com/rhysd/actionlint/cmd/actionlint@latest && go clean --c && find /tmp -path '/tmp/tmp.*' -type f -name 'misspell*' -delete -o -type d -empty -delete \ # tflint installation -# Managed with COPY --from=tflint /usr/local/bin/tflint /usr/bin/ +# Managed with COPY --link --from=tflint /usr/local/bin/tflint /usr/bin/ # terrascan installation -# Managed with COPY --from=terrascan /go/bin/terrascan /usr/bin/ +# Managed with COPY --link --from=terrascan /go/bin/terrascan /usr/bin/ # terragrunt installation -# Managed with COPY --from=terragrunt /usr/local/bin/terragrunt /usr/bin/ +# Managed with COPY --link --from=terragrunt /usr/local/bin/terragrunt /usr/bin/ # terraform-fmt installation -# Managed with COPY --from=terragrunt /bin/terraform /usr/bin/ +# Managed with COPY --link --from=terragrunt /bin/terraform /usr/bin/ # kics installation -# Managed with COPY --from=kics /app/bin/kics /usr/bin/ +# Managed with COPY --link --from=kics /app/bin/kics /usr/bin/ && mkdir -p /opt/kics/assets ENV KICS_QUERIES_PATH=/opt/kics/assets/queries KICS_LIBRARIES_PATH=/opt/kics/assets/libraries # Managed with COPY --from=kics /app/bin/assets /opt/kics/assets/ diff --git a/flavors/terraform/flavor.json b/flavors/terraform/flavor.json index 5596117063a..c5a025be188 100644 --- a/flavors/terraform/flavor.json +++ b/flavors/terraform/flavor.json @@ -1,6 +1,5 @@ { "descriptors": [ - "ACTION", "BASH", "KOTLIN" ], diff --git a/linters/action_actionlint/Dockerfile b/linters/action_actionlint/Dockerfile index 9637ac63a03..dd3fbe89b1e 100644 --- a/linters/action_actionlint/Dockerfile +++ b/linters/action_actionlint/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## @@ -10,7 +11,10 @@ ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #FROM__START +FROM rhysd/actionlint:latest as actionlint +# shellcheck is a dependency for actionlint +FROM koalaman/shellcheck:stable as shellcheck #FROM__END ################## @@ -47,7 +51,7 @@ RUN apk add --update --no-cache \ make \ musl-dev \ openssh \ - go \ + py3-pyflakes \ && git config --global core.autocrlf true #APK__END @@ -115,7 +119,10 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ ############################################################################################# #COPY__START +COPY --link --from=actionlint /usr/local/bin/actionlint /usr/bin/actionlint +# shellcheck is a dependency for actionlint +COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck #COPY__END ############################################################################################# @@ -123,8 +130,9 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ ############################################################################################# #OTHER__START # actionlint installation -ENV GO111MODULE=on -RUN go install github.com/rhysd/actionlint/cmd/actionlint@latest && go clean --cache +# Managed with COPY --link --from=actionlint /usr/local/bin/actionlint /usr/bin/actionlint +# # shellcheck is a dependency for actionlint +# Managed with COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck #OTHER__END diff --git a/linters/ansible_ansible_lint/Dockerfile b/linters/ansible_ansible_lint/Dockerfile index e9ffd2cb21b..b6d7a2998df 100644 --- a/linters/ansible_ansible_lint/Dockerfile +++ b/linters/ansible_ansible_lint/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/arm_arm_ttk/Dockerfile b/linters/arm_arm_ttk/Dockerfile index 97f891e9194..aad31853a9d 100644 --- a/linters/arm_arm_ttk/Dockerfile +++ b/linters/arm_arm_ttk/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/bash_exec/Dockerfile b/linters/bash_exec/Dockerfile index 7350258ac55..8ade4f870af 100644 --- a/linters/bash_exec/Dockerfile +++ b/linters/bash_exec/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/bash_shellcheck/Dockerfile b/linters/bash_shellcheck/Dockerfile index a1041914778..4991a003210 100644 --- a/linters/bash_shellcheck/Dockerfile +++ b/linters/bash_shellcheck/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## @@ -10,7 +11,7 @@ ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #FROM__START - +FROM koalaman/shellcheck:stable as shellcheck #FROM__END ################## @@ -118,7 +119,7 @@ ENV PATH="/root/.cargo/bin:${PATH}" ############################################################################################# #COPY__START - +COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck #COPY__END ############################################################################################# @@ -126,12 +127,7 @@ ENV PATH="/root/.cargo/bin:${PATH}" ############################################################################################# #OTHER__START # shellcheck installation -RUN ML_THIRD_PARTY_DIR="/third-party/shellcheck" \ - && mkdir -p ${ML_THIRD_PARTY_DIR} \ - && wget -qO- "https://github.com/koalaman/shellcheck/releases/download/stable/shellcheck-stable.linux.x86_64.tar.xz" | tar -xJv --directory ${ML_THIRD_PARTY_DIR} \ - && mv "${ML_THIRD_PARTY_DIR}/shellcheck-stable/shellcheck" /usr/bin/ \ - && find ${ML_THIRD_PARTY_DIR} -type f -not -name 'LICENSE*' -delete -o -type d -empty -delete - +# Managed with COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck #OTHER__END diff --git a/linters/bash_shfmt/Dockerfile b/linters/bash_shfmt/Dockerfile index b4634319892..4bf3553df2a 100644 --- a/linters/bash_shfmt/Dockerfile +++ b/linters/bash_shfmt/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## @@ -114,7 +115,7 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ ############################################################################################# #COPY__START -COPY --from=shfmt /bin/shfmt /usr/bin/ +COPY --link --from=shfmt /bin/shfmt /usr/bin/ #COPY__END ############################################################################################# @@ -122,7 +123,7 @@ COPY --from=shfmt /bin/shfmt /usr/bin/ ############################################################################################# #OTHER__START # shfmt installation -# Managed with COPY --from=shfmt /bin/shfmt /usr/bin/ +# Managed with COPY --link --from=shfmt /bin/shfmt /usr/bin/ #OTHER__END diff --git a/linters/bicep_bicep_linter/Dockerfile b/linters/bicep_bicep_linter/Dockerfile index 327a410f786..7760d64a501 100644 --- a/linters/bicep_bicep_linter/Dockerfile +++ b/linters/bicep_bicep_linter/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/c_cpplint/Dockerfile b/linters/c_cpplint/Dockerfile index ffaa660617f..18fccfd0498 100644 --- a/linters/c_cpplint/Dockerfile +++ b/linters/c_cpplint/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/clojure_clj_kondo/Dockerfile b/linters/clojure_clj_kondo/Dockerfile index 69095636e00..7bd99e50199 100644 --- a/linters/clojure_clj_kondo/Dockerfile +++ b/linters/clojure_clj_kondo/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/cloudformation_cfn_lint/Dockerfile b/linters/cloudformation_cfn_lint/Dockerfile index 79ea861b771..d619c576045 100644 --- a/linters/cloudformation_cfn_lint/Dockerfile +++ b/linters/cloudformation_cfn_lint/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/coffee_coffeelint/Dockerfile b/linters/coffee_coffeelint/Dockerfile index 254f8e83280..de13718f1a8 100644 --- a/linters/coffee_coffeelint/Dockerfile +++ b/linters/coffee_coffeelint/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/copypaste_jscpd/Dockerfile b/linters/copypaste_jscpd/Dockerfile index 0ae8b9c358c..be722efb34e 100644 --- a/linters/copypaste_jscpd/Dockerfile +++ b/linters/copypaste_jscpd/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/cpp_cpplint/Dockerfile b/linters/cpp_cpplint/Dockerfile index 2e62cd0235e..c79b99f77ee 100644 --- a/linters/cpp_cpplint/Dockerfile +++ b/linters/cpp_cpplint/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/csharp_csharpier/Dockerfile b/linters/csharp_csharpier/Dockerfile index a05fa9000ac..516a286079a 100644 --- a/linters/csharp_csharpier/Dockerfile +++ b/linters/csharp_csharpier/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/csharp_dotnet_format/Dockerfile b/linters/csharp_dotnet_format/Dockerfile index 091728b6864..aa932b33e94 100644 --- a/linters/csharp_dotnet_format/Dockerfile +++ b/linters/csharp_dotnet_format/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/css_scss_lint/Dockerfile b/linters/css_scss_lint/Dockerfile index 79c8066286c..1df1dc7f3d7 100644 --- a/linters/css_scss_lint/Dockerfile +++ b/linters/css_scss_lint/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/css_stylelint/Dockerfile b/linters/css_stylelint/Dockerfile index 6b3c6ed7848..38041fbc098 100644 --- a/linters/css_stylelint/Dockerfile +++ b/linters/css_stylelint/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/dart_dartanalyzer/Dockerfile b/linters/dart_dartanalyzer/Dockerfile index 3500bca11a6..032d6bc312b 100644 --- a/linters/dart_dartanalyzer/Dockerfile +++ b/linters/dart_dartanalyzer/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/dockerfile_hadolint/Dockerfile b/linters/dockerfile_hadolint/Dockerfile index faf802e2b88..5b68a6105a1 100644 --- a/linters/dockerfile_hadolint/Dockerfile +++ b/linters/dockerfile_hadolint/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## @@ -114,7 +115,7 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ ############################################################################################# #COPY__START -COPY --from=hadolint /bin/hadolint /usr/bin/hadolint +COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint #COPY__END ############################################################################################# @@ -122,7 +123,7 @@ COPY --from=hadolint /bin/hadolint /usr/bin/hadolint ############################################################################################# #OTHER__START # hadolint installation -# Managed with COPY --from=hadolint /bin/hadolint /usr/bin/hadolint +# Managed with COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint #OTHER__END diff --git a/linters/editorconfig_editorconfig_checker/Dockerfile b/linters/editorconfig_editorconfig_checker/Dockerfile index 9188e66a5e6..083951678f4 100644 --- a/linters/editorconfig_editorconfig_checker/Dockerfile +++ b/linters/editorconfig_editorconfig_checker/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## @@ -114,7 +115,7 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ ############################################################################################# #COPY__START -COPY --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker +COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker #COPY__END ############################################################################################# @@ -122,7 +123,7 @@ COPY --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker ############################################################################################# #OTHER__START # editorconfig-checker installation -# Managed with COPY --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker +# Managed with COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker #OTHER__END diff --git a/linters/env_dotenv_linter/Dockerfile b/linters/env_dotenv_linter/Dockerfile index 7023184beba..49ebc6542f9 100644 --- a/linters/env_dotenv_linter/Dockerfile +++ b/linters/env_dotenv_linter/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/gherkin_gherkin_lint/Dockerfile b/linters/gherkin_gherkin_lint/Dockerfile index cad1d9fe928..452b819b210 100644 --- a/linters/gherkin_gherkin_lint/Dockerfile +++ b/linters/gherkin_gherkin_lint/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/go_golangci_lint/Dockerfile b/linters/go_golangci_lint/Dockerfile index 712074a301b..a68b9a74455 100644 --- a/linters/go_golangci_lint/Dockerfile +++ b/linters/go_golangci_lint/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/go_revive/Dockerfile b/linters/go_revive/Dockerfile index 1aac056468e..3ca98b6d4ee 100644 --- a/linters/go_revive/Dockerfile +++ b/linters/go_revive/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## @@ -10,6 +11,11 @@ ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #FROM__START +FROM golang:1.19-alpine as revive +## The golang image used as a builder is a temporary workaround +## for the released revive binaries not returning version numbers (devel). +## The install command should then be what is commented in the go.megalinter-descriptor.yml +RUN GOBIN=/usr/bin go install github.com/mgechev/revive@latest #FROM__END @@ -47,7 +53,6 @@ RUN apk add --update --no-cache \ make \ musl-dev \ openssh \ - go \ && git config --global core.autocrlf true #APK__END @@ -115,7 +120,7 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ ############################################################################################# #COPY__START - +COPY --link --from=revive /usr/bin/revive /usr/bin/revive #COPY__END ############################################################################################# @@ -123,7 +128,7 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ ############################################################################################# #OTHER__START # revive installation -RUN go install github.com/mgechev/revive@latest && go clean --cache +# Managed with COPY --link --from=revive /usr/bin/revive /usr/bin/revive #OTHER__END diff --git a/linters/graphql_graphql_schema_linter/Dockerfile b/linters/graphql_graphql_schema_linter/Dockerfile index 565b5a23c67..c4f86cf8a0a 100644 --- a/linters/graphql_graphql_schema_linter/Dockerfile +++ b/linters/graphql_graphql_schema_linter/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/groovy_npm_groovy_lint/Dockerfile b/linters/groovy_npm_groovy_lint/Dockerfile index db1f949926a..801738f040b 100644 --- a/linters/groovy_npm_groovy_lint/Dockerfile +++ b/linters/groovy_npm_groovy_lint/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/html_djlint/Dockerfile b/linters/html_djlint/Dockerfile index 24d1561f6e4..09d5ad59da4 100644 --- a/linters/html_djlint/Dockerfile +++ b/linters/html_djlint/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/html_htmlhint/Dockerfile b/linters/html_htmlhint/Dockerfile index dd248e25044..6472fe66e5e 100644 --- a/linters/html_htmlhint/Dockerfile +++ b/linters/html_htmlhint/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/java_checkstyle/Dockerfile b/linters/java_checkstyle/Dockerfile index 03cc8782e38..dfd59dd1fe8 100644 --- a/linters/java_checkstyle/Dockerfile +++ b/linters/java_checkstyle/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/java_pmd/Dockerfile b/linters/java_pmd/Dockerfile index ad901d1efc9..c0971faaf76 100644 --- a/linters/java_pmd/Dockerfile +++ b/linters/java_pmd/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/javascript_es/Dockerfile b/linters/javascript_es/Dockerfile index 3db6230960d..a275479f2a7 100644 --- a/linters/javascript_es/Dockerfile +++ b/linters/javascript_es/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/javascript_prettier/Dockerfile b/linters/javascript_prettier/Dockerfile index 6d974a979ed..59b90a737af 100644 --- a/linters/javascript_prettier/Dockerfile +++ b/linters/javascript_prettier/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/javascript_standard/Dockerfile b/linters/javascript_standard/Dockerfile index ef0fde8c332..c964b66310e 100644 --- a/linters/javascript_standard/Dockerfile +++ b/linters/javascript_standard/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/json_eslint_plugin_jsonc/Dockerfile b/linters/json_eslint_plugin_jsonc/Dockerfile index 9869f226d98..4452aa39319 100644 --- a/linters/json_eslint_plugin_jsonc/Dockerfile +++ b/linters/json_eslint_plugin_jsonc/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/json_jsonlint/Dockerfile b/linters/json_jsonlint/Dockerfile index 90422e71b2a..557553d0ca9 100644 --- a/linters/json_jsonlint/Dockerfile +++ b/linters/json_jsonlint/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/json_npm_package_json_lint/Dockerfile b/linters/json_npm_package_json_lint/Dockerfile index d89e4b82670..0d919c0f9e9 100644 --- a/linters/json_npm_package_json_lint/Dockerfile +++ b/linters/json_npm_package_json_lint/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/json_prettier/Dockerfile b/linters/json_prettier/Dockerfile index ccea1450e3f..a17c586a923 100644 --- a/linters/json_prettier/Dockerfile +++ b/linters/json_prettier/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/json_v8r/Dockerfile b/linters/json_v8r/Dockerfile index 9a8df024577..fc5f4a7892e 100644 --- a/linters/json_v8r/Dockerfile +++ b/linters/json_v8r/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/jsx_eslint/Dockerfile b/linters/jsx_eslint/Dockerfile index f801ba488d5..4ff8cc764c2 100644 --- a/linters/jsx_eslint/Dockerfile +++ b/linters/jsx_eslint/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/kotlin_ktlint/Dockerfile b/linters/kotlin_ktlint/Dockerfile index 5183f27daa9..29d6abbf90f 100644 --- a/linters/kotlin_ktlint/Dockerfile +++ b/linters/kotlin_ktlint/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/kubernetes_kubeconform/Dockerfile b/linters/kubernetes_kubeconform/Dockerfile index f092e5128cc..d2f700f0c04 100644 --- a/linters/kubernetes_kubeconform/Dockerfile +++ b/linters/kubernetes_kubeconform/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/kubernetes_kubeval/Dockerfile b/linters/kubernetes_kubeval/Dockerfile index fc7dfe8a21d..6da11c262f8 100644 --- a/linters/kubernetes_kubeval/Dockerfile +++ b/linters/kubernetes_kubeval/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/latex_chktex/Dockerfile b/linters/latex_chktex/Dockerfile index 1b95712b4b7..9aaff70b691 100644 --- a/linters/latex_chktex/Dockerfile +++ b/linters/latex_chktex/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## @@ -114,7 +115,7 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ ############################################################################################# #COPY__START -COPY --from=chktex /usr/bin/chktex /usr/bin/ +COPY --link --from=chktex /usr/bin/chktex /usr/bin/ #COPY__END ############################################################################################# @@ -122,7 +123,7 @@ COPY --from=chktex /usr/bin/chktex /usr/bin/ ############################################################################################# #OTHER__START # chktex installation -# Managed with COPY --from=chktex /usr/bin/chktex /usr/bin/ +# Managed with COPY --link --from=chktex /usr/bin/chktex /usr/bin/ RUN cd ~ && touch .chktexrc && cd / #OTHER__END diff --git a/linters/lua_luacheck/Dockerfile b/linters/lua_luacheck/Dockerfile index 76fc2fb94e1..3fa34d6f0c9 100644 --- a/linters/lua_luacheck/Dockerfile +++ b/linters/lua_luacheck/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/makefile_checkmake/Dockerfile b/linters/makefile_checkmake/Dockerfile index b6a85be7ba2..c063e42ec6d 100644 --- a/linters/makefile_checkmake/Dockerfile +++ b/linters/makefile_checkmake/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## @@ -10,7 +11,7 @@ ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #FROM__START - +FROM mrtazz/checkmake:latest as checkmake #FROM__END ################## @@ -114,7 +115,7 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ ############################################################################################# #COPY__START - +COPY --link --from=checkmake /checkmake /usr/bin/checkmake #COPY__END ############################################################################################# @@ -122,10 +123,7 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ ############################################################################################# #OTHER__START # checkmake installation -RUN ( [ -d /usr/local/bin ] || mkdir -p /usr/local/bin ) \ - && wget -q "https://github.com/mrtazz/checkmake/releases/download/0.2.1/checkmake-0.2.1.linux.amd64" -O /usr/local/bin/checkmake \ - && chmod 755 /usr/local/bin/checkmake - +# Managed with COPY --link --from=checkmake /checkmake /usr/bin/checkmake #OTHER__END diff --git a/linters/markdown_markdown_link_check/Dockerfile b/linters/markdown_markdown_link_check/Dockerfile index 2d29db31fd6..6e7f600643a 100644 --- a/linters/markdown_markdown_link_check/Dockerfile +++ b/linters/markdown_markdown_link_check/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/markdown_markdown_table_formatter/Dockerfile b/linters/markdown_markdown_table_formatter/Dockerfile index 4ddac0f0078..e1592d21770 100644 --- a/linters/markdown_markdown_table_formatter/Dockerfile +++ b/linters/markdown_markdown_table_formatter/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/markdown_markdownlint/Dockerfile b/linters/markdown_markdownlint/Dockerfile index 37fd7b1bbe2..7965e9d7613 100644 --- a/linters/markdown_markdownlint/Dockerfile +++ b/linters/markdown_markdownlint/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/markdown_remark_lint/Dockerfile b/linters/markdown_remark_lint/Dockerfile index d403e69b831..a51d3afdb37 100644 --- a/linters/markdown_remark_lint/Dockerfile +++ b/linters/markdown_remark_lint/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/openapi_spectral/Dockerfile b/linters/openapi_spectral/Dockerfile index 8186b1604dc..a1b18f8e6ff 100644 --- a/linters/openapi_spectral/Dockerfile +++ b/linters/openapi_spectral/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/perl_perlcritic/Dockerfile b/linters/perl_perlcritic/Dockerfile index bfae4ff795c..99a82b6c376 100644 --- a/linters/perl_perlcritic/Dockerfile +++ b/linters/perl_perlcritic/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/php_phpcs/Dockerfile b/linters/php_phpcs/Dockerfile index a5950c0f701..9a2c7cbd1d4 100644 --- a/linters/php_phpcs/Dockerfile +++ b/linters/php_phpcs/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/php_phplint/Dockerfile b/linters/php_phplint/Dockerfile index d54e64ec2fa..6a46899a170 100644 --- a/linters/php_phplint/Dockerfile +++ b/linters/php_phplint/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/php_phpstan/Dockerfile b/linters/php_phpstan/Dockerfile index c0dc5c090a3..e299aace5a5 100644 --- a/linters/php_phpstan/Dockerfile +++ b/linters/php_phpstan/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/php_psalm/Dockerfile b/linters/php_psalm/Dockerfile index 706c947f319..d09a6e77026 100644 --- a/linters/php_psalm/Dockerfile +++ b/linters/php_psalm/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/powershell_powershell/Dockerfile b/linters/powershell_powershell/Dockerfile index aaeb579ea05..2eea5f161e9 100644 --- a/linters/powershell_powershell/Dockerfile +++ b/linters/powershell_powershell/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/powershell_powershell_formatter/Dockerfile b/linters/powershell_powershell_formatter/Dockerfile index 84f62455be0..65ec2453315 100644 --- a/linters/powershell_powershell_formatter/Dockerfile +++ b/linters/powershell_powershell_formatter/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/protobuf_protolint/Dockerfile b/linters/protobuf_protolint/Dockerfile index 2092d97336e..6ca24ed1c14 100644 --- a/linters/protobuf_protolint/Dockerfile +++ b/linters/protobuf_protolint/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## @@ -114,7 +115,7 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ ############################################################################################# #COPY__START -COPY --from=protolint /usr/local/bin/protolint /usr/bin/ +COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ #COPY__END ############################################################################################# @@ -122,7 +123,7 @@ COPY --from=protolint /usr/local/bin/protolint /usr/bin/ ############################################################################################# #OTHER__START # protolint installation -# Managed with COPY --from=protolint /usr/local/bin/protolint /usr/bin/ +# Managed with COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ #OTHER__END diff --git a/linters/puppet_puppet_lint/Dockerfile b/linters/puppet_puppet_lint/Dockerfile index 3c8191a8395..72d07f0eb77 100644 --- a/linters/puppet_puppet_lint/Dockerfile +++ b/linters/puppet_puppet_lint/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/python_bandit/Dockerfile b/linters/python_bandit/Dockerfile index 63c85e511da..11fc1088852 100644 --- a/linters/python_bandit/Dockerfile +++ b/linters/python_bandit/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/python_black/Dockerfile b/linters/python_black/Dockerfile index b366527492d..79e413f2044 100644 --- a/linters/python_black/Dockerfile +++ b/linters/python_black/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/python_flake8/Dockerfile b/linters/python_flake8/Dockerfile index c0fdf8685d7..f8920d93e4c 100644 --- a/linters/python_flake8/Dockerfile +++ b/linters/python_flake8/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/python_isort/Dockerfile b/linters/python_isort/Dockerfile index fcf914c93f2..251f475b6ad 100644 --- a/linters/python_isort/Dockerfile +++ b/linters/python_isort/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/python_mypy/Dockerfile b/linters/python_mypy/Dockerfile index c7b4114ba7f..ea0a191a58b 100644 --- a/linters/python_mypy/Dockerfile +++ b/linters/python_mypy/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/python_pylint/Dockerfile b/linters/python_pylint/Dockerfile index 7c8cd2869aa..d1e235daa50 100644 --- a/linters/python_pylint/Dockerfile +++ b/linters/python_pylint/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/python_pyright/Dockerfile b/linters/python_pyright/Dockerfile index 8ff2432e11f..fcd2281f75d 100644 --- a/linters/python_pyright/Dockerfile +++ b/linters/python_pyright/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/r_lintr/Dockerfile b/linters/r_lintr/Dockerfile index 16b84aeddda..377eccc00e5 100644 --- a/linters/r_lintr/Dockerfile +++ b/linters/r_lintr/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/raku_raku/Dockerfile b/linters/raku_raku/Dockerfile index d22de046e56..1f83d2a5683 100644 --- a/linters/raku_raku/Dockerfile +++ b/linters/raku_raku/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/repository_checkov/Dockerfile b/linters/repository_checkov/Dockerfile index e8b1a14c843..a895c67c99b 100644 --- a/linters/repository_checkov/Dockerfile +++ b/linters/repository_checkov/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/repository_devskim/Dockerfile b/linters/repository_devskim/Dockerfile index e8b8fcf202c..0add853ac2a 100644 --- a/linters/repository_devskim/Dockerfile +++ b/linters/repository_devskim/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/repository_dustilock/Dockerfile b/linters/repository_dustilock/Dockerfile index a0884349cc7..93fcc54c11d 100644 --- a/linters/repository_dustilock/Dockerfile +++ b/linters/repository_dustilock/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## @@ -10,6 +11,8 @@ ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #FROM__START +FROM golang:alpine as dustilock +RUN GOBIN=/usr/bin go install github.com/checkmarx/dustilock@v1.2.0 #FROM__END @@ -47,7 +50,6 @@ RUN apk add --update --no-cache \ make \ musl-dev \ openssh \ - go \ && git config --global core.autocrlf true #APK__END @@ -115,7 +117,7 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ ############################################################################################# #COPY__START - +COPY --link --from=dustilock /usr/bin/dustilock /usr/bin/dustilock #COPY__END ############################################################################################# @@ -123,16 +125,7 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ ############################################################################################# #OTHER__START # dustilock installation -RUN ML_THIRD_PARTY_DIR=/download/dustilock && \ - mkdir -p ${ML_THIRD_PARTY_DIR} && \ - git clone https://github.com/Checkmarx/dustilock.git ${ML_THIRD_PARTY_DIR} && \ - cd ${ML_THIRD_PARTY_DIR} && \ - go build && go clean --cache && \ - chmod +x dustilock && \ - mv "${ML_THIRD_PARTY_DIR}/dustilock" /usr/bin/ && \ - find ${ML_THIRD_PARTY_DIR} -type f -not -name 'LICENSE*' -delete -o -type d -empty -delete && \ - cd / - +# Managed with COPY --link --from=dustilock /usr/bin/dustilock /usr/bin/dustilock #OTHER__END diff --git a/linters/repository_git_diff/Dockerfile b/linters/repository_git_diff/Dockerfile index c4e2543e76e..ce4c9ebd794 100644 --- a/linters/repository_git_diff/Dockerfile +++ b/linters/repository_git_diff/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/repository_gitleaks/Dockerfile b/linters/repository_gitleaks/Dockerfile index d290de3dd97..ae44a0f9cf8 100644 --- a/linters/repository_gitleaks/Dockerfile +++ b/linters/repository_gitleaks/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## @@ -114,7 +115,7 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ ############################################################################################# #COPY__START -COPY --from=gitleaks /usr/bin/gitleaks /usr/bin/ +COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ #COPY__END ############################################################################################# @@ -122,7 +123,7 @@ COPY --from=gitleaks /usr/bin/gitleaks /usr/bin/ ############################################################################################# #OTHER__START # gitleaks installation -# Managed with COPY --from=gitleaks /usr/bin/gitleaks /usr/bin/ +# Managed with COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ #OTHER__END diff --git a/linters/repository_goodcheck/Dockerfile b/linters/repository_goodcheck/Dockerfile index 77acbf553bc..e29026ce481 100644 --- a/linters/repository_goodcheck/Dockerfile +++ b/linters/repository_goodcheck/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/repository_secretlint/Dockerfile b/linters/repository_secretlint/Dockerfile index 0ee31d169c3..76797686215 100644 --- a/linters/repository_secretlint/Dockerfile +++ b/linters/repository_secretlint/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/repository_semgrep/Dockerfile b/linters/repository_semgrep/Dockerfile index c9f889d4df7..11467848ae0 100644 --- a/linters/repository_semgrep/Dockerfile +++ b/linters/repository_semgrep/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/repository_syft/Dockerfile b/linters/repository_syft/Dockerfile index 2442d1da2cb..af2950d5d2e 100644 --- a/linters/repository_syft/Dockerfile +++ b/linters/repository_syft/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/repository_trivy/Dockerfile b/linters/repository_trivy/Dockerfile index fbf59e8a489..29f59a4a3c7 100644 --- a/linters/repository_trivy/Dockerfile +++ b/linters/repository_trivy/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/rst_rst_lint/Dockerfile b/linters/rst_rst_lint/Dockerfile index ce68a79a94b..4415755483d 100644 --- a/linters/rst_rst_lint/Dockerfile +++ b/linters/rst_rst_lint/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/rst_rstcheck/Dockerfile b/linters/rst_rstcheck/Dockerfile index bc4d1534709..acb916d949e 100644 --- a/linters/rst_rstcheck/Dockerfile +++ b/linters/rst_rstcheck/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/rst_rstfmt/Dockerfile b/linters/rst_rstfmt/Dockerfile index 0ca3d9b1466..6bbe2e8814b 100644 --- a/linters/rst_rstfmt/Dockerfile +++ b/linters/rst_rstfmt/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/ruby_rubocop/Dockerfile b/linters/ruby_rubocop/Dockerfile index 17dea4378dd..b6fa916a2be 100644 --- a/linters/ruby_rubocop/Dockerfile +++ b/linters/ruby_rubocop/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/rust_clippy/Dockerfile b/linters/rust_clippy/Dockerfile index 1bc8e4c6bab..69acbba42bd 100644 --- a/linters/rust_clippy/Dockerfile +++ b/linters/rust_clippy/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/salesforce_sfdx_scanner_apex/Dockerfile b/linters/salesforce_sfdx_scanner_apex/Dockerfile index c9373bb6485..cb426800784 100644 --- a/linters/salesforce_sfdx_scanner_apex/Dockerfile +++ b/linters/salesforce_sfdx_scanner_apex/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/salesforce_sfdx_scanner_aura/Dockerfile b/linters/salesforce_sfdx_scanner_aura/Dockerfile index b58a6b1c051..460d30f0f81 100644 --- a/linters/salesforce_sfdx_scanner_aura/Dockerfile +++ b/linters/salesforce_sfdx_scanner_aura/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/salesforce_sfdx_scanner_lwc/Dockerfile b/linters/salesforce_sfdx_scanner_lwc/Dockerfile index 20aab7283a5..9b2805e59a0 100644 --- a/linters/salesforce_sfdx_scanner_lwc/Dockerfile +++ b/linters/salesforce_sfdx_scanner_lwc/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/scala_scalafix/Dockerfile b/linters/scala_scalafix/Dockerfile index 08646defafe..3bef468b3d0 100644 --- a/linters/scala_scalafix/Dockerfile +++ b/linters/scala_scalafix/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/snakemake_lint/Dockerfile b/linters/snakemake_lint/Dockerfile index 44d30d27641..f00851ca243 100644 --- a/linters/snakemake_lint/Dockerfile +++ b/linters/snakemake_lint/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/snakemake_snakefmt/Dockerfile b/linters/snakemake_snakefmt/Dockerfile index 3a3576a00c2..347ab6d018b 100644 --- a/linters/snakemake_snakefmt/Dockerfile +++ b/linters/snakemake_snakefmt/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/spell_cspell/Dockerfile b/linters/spell_cspell/Dockerfile index 3b0e5095ebf..7e45baeeb63 100644 --- a/linters/spell_cspell/Dockerfile +++ b/linters/spell_cspell/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/spell_misspell/Dockerfile b/linters/spell_misspell/Dockerfile index 495b16be067..8ec5c664fb5 100644 --- a/linters/spell_misspell/Dockerfile +++ b/linters/spell_misspell/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/spell_proselint/Dockerfile b/linters/spell_proselint/Dockerfile index 89a815e035b..9d3da7c7d4b 100644 --- a/linters/spell_proselint/Dockerfile +++ b/linters/spell_proselint/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/sql_sql_lint/Dockerfile b/linters/sql_sql_lint/Dockerfile index ccf760202f3..c9d91cdee1a 100644 --- a/linters/sql_sql_lint/Dockerfile +++ b/linters/sql_sql_lint/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/sql_sqlfluff/Dockerfile b/linters/sql_sqlfluff/Dockerfile index 27c551398cd..78d15c5f939 100644 --- a/linters/sql_sqlfluff/Dockerfile +++ b/linters/sql_sqlfluff/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/sql_tsqllint/Dockerfile b/linters/sql_tsqllint/Dockerfile index 7e26f110858..bdb494fd0fe 100644 --- a/linters/sql_tsqllint/Dockerfile +++ b/linters/sql_tsqllint/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/swift_swiftlint/Dockerfile b/linters/swift_swiftlint/Dockerfile index 7379fe416da..34795731aa5 100644 --- a/linters/swift_swiftlint/Dockerfile +++ b/linters/swift_swiftlint/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/tekton_tekton_lint/Dockerfile b/linters/tekton_tekton_lint/Dockerfile index 543849650ab..f0a1fc24075 100644 --- a/linters/tekton_tekton_lint/Dockerfile +++ b/linters/tekton_tekton_lint/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/terraform_checkov/Dockerfile b/linters/terraform_checkov/Dockerfile index 851f2bcb835..4c30fbb6cfe 100644 --- a/linters/terraform_checkov/Dockerfile +++ b/linters/terraform_checkov/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/terraform_kics/Dockerfile b/linters/terraform_kics/Dockerfile index 6870c31f55b..91eb32c663b 100644 --- a/linters/terraform_kics/Dockerfile +++ b/linters/terraform_kics/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## @@ -114,7 +115,7 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ ############################################################################################# #COPY__START -COPY --from=kics /app/bin/kics /usr/bin/ +COPY --link --from=kics /app/bin/kics /usr/bin/ COPY --from=kics /app/bin/assets /opt/kics/assets/ #COPY__END @@ -123,7 +124,7 @@ COPY --from=kics /app/bin/assets /opt/kics/assets/ ############################################################################################# #OTHER__START # kics installation -# Managed with COPY --from=kics /app/bin/kics /usr/bin/ +# Managed with COPY --link --from=kics /app/bin/kics /usr/bin/ RUN mkdir -p /opt/kics/assets ENV KICS_QUERIES_PATH=/opt/kics/assets/queries KICS_LIBRARIES_PATH=/opt/kics/assets/libraries # Managed with COPY --from=kics /app/bin/assets /opt/kics/assets/ diff --git a/linters/terraform_terraform_fmt/Dockerfile b/linters/terraform_terraform_fmt/Dockerfile index af131523b29..b411240261f 100644 --- a/linters/terraform_terraform_fmt/Dockerfile +++ b/linters/terraform_terraform_fmt/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## @@ -114,7 +115,7 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ ############################################################################################# #COPY__START -COPY --from=terragrunt /bin/terraform /usr/bin/ +COPY --link --from=terragrunt /bin/terraform /usr/bin/ #COPY__END ############################################################################################# @@ -122,7 +123,7 @@ COPY --from=terragrunt /bin/terraform /usr/bin/ ############################################################################################# #OTHER__START # terraform-fmt installation -# Managed with COPY --from=terragrunt /bin/terraform /usr/bin/ +# Managed with COPY --link --from=terragrunt /bin/terraform /usr/bin/ #OTHER__END diff --git a/linters/terraform_terragrunt/Dockerfile b/linters/terraform_terragrunt/Dockerfile index 03ca23eb79f..b8bd75873ee 100644 --- a/linters/terraform_terragrunt/Dockerfile +++ b/linters/terraform_terragrunt/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## @@ -114,7 +115,7 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ ############################################################################################# #COPY__START -COPY --from=terragrunt /usr/local/bin/terragrunt /usr/bin/ +COPY --link --from=terragrunt /usr/local/bin/terragrunt /usr/bin/ #COPY__END ############################################################################################# @@ -122,7 +123,7 @@ COPY --from=terragrunt /usr/local/bin/terragrunt /usr/bin/ ############################################################################################# #OTHER__START # terragrunt installation -# Managed with COPY --from=terragrunt /usr/local/bin/terragrunt /usr/bin/ +# Managed with COPY --link --from=terragrunt /usr/local/bin/terragrunt /usr/bin/ #OTHER__END diff --git a/linters/terraform_terrascan/Dockerfile b/linters/terraform_terrascan/Dockerfile index edf3d49470f..b0020f3ccd9 100644 --- a/linters/terraform_terrascan/Dockerfile +++ b/linters/terraform_terrascan/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## @@ -114,7 +115,7 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ ############################################################################################# #COPY__START -COPY --from=terrascan /go/bin/terrascan /usr/bin/ +COPY --link --from=terrascan /go/bin/terrascan /usr/bin/ #COPY__END ############################################################################################# @@ -122,7 +123,7 @@ COPY --from=terrascan /go/bin/terrascan /usr/bin/ ############################################################################################# #OTHER__START # terrascan installation -# Managed with COPY --from=terrascan /go/bin/terrascan /usr/bin/ +# Managed with COPY --link --from=terrascan /go/bin/terrascan /usr/bin/ #OTHER__END diff --git a/linters/terraform_tflint/Dockerfile b/linters/terraform_tflint/Dockerfile index a50a6af5f9e..b31266d2f3d 100644 --- a/linters/terraform_tflint/Dockerfile +++ b/linters/terraform_tflint/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## @@ -114,7 +115,7 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ ############################################################################################# #COPY__START -COPY --from=tflint /usr/local/bin/tflint /usr/bin/ +COPY --link --from=tflint /usr/local/bin/tflint /usr/bin/ #COPY__END ############################################################################################# @@ -122,7 +123,7 @@ COPY --from=tflint /usr/local/bin/tflint /usr/bin/ ############################################################################################# #OTHER__START # tflint installation -# Managed with COPY --from=tflint /usr/local/bin/tflint /usr/bin/ +# Managed with COPY --link --from=tflint /usr/local/bin/tflint /usr/bin/ #OTHER__END diff --git a/linters/tsx_eslint/Dockerfile b/linters/tsx_eslint/Dockerfile index 8cb9a88e5d1..6534bec4231 100644 --- a/linters/tsx_eslint/Dockerfile +++ b/linters/tsx_eslint/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/typescript_es/Dockerfile b/linters/typescript_es/Dockerfile index 3d36dcac919..b93c1a7ab2c 100644 --- a/linters/typescript_es/Dockerfile +++ b/linters/typescript_es/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/typescript_prettier/Dockerfile b/linters/typescript_prettier/Dockerfile index 0a430d0cc38..4bbb2e866b6 100644 --- a/linters/typescript_prettier/Dockerfile +++ b/linters/typescript_prettier/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/typescript_standard/Dockerfile b/linters/typescript_standard/Dockerfile index c759177903c..60a893ffeaa 100644 --- a/linters/typescript_standard/Dockerfile +++ b/linters/typescript_standard/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/vbdotnet_dotnet_format/Dockerfile b/linters/vbdotnet_dotnet_format/Dockerfile index 38a36de80ff..ba218d4633a 100644 --- a/linters/vbdotnet_dotnet_format/Dockerfile +++ b/linters/vbdotnet_dotnet_format/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/xml_xmllint/Dockerfile b/linters/xml_xmllint/Dockerfile index 4e06dad8435..bc45cb6d7a9 100644 --- a/linters/xml_xmllint/Dockerfile +++ b/linters/xml_xmllint/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/yaml_prettier/Dockerfile b/linters/yaml_prettier/Dockerfile index 0af5d325cc0..219c643d1e5 100644 --- a/linters/yaml_prettier/Dockerfile +++ b/linters/yaml_prettier/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/yaml_v8r/Dockerfile b/linters/yaml_v8r/Dockerfile index c3d8f994b1f..8afd83cf6fb 100644 --- a/linters/yaml_v8r/Dockerfile +++ b/linters/yaml_v8r/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/linters/yaml_yamllint/Dockerfile b/linters/yaml_yamllint/Dockerfile index fd3fcdf8852..5d6ef5787c6 100644 --- a/linters/yaml_yamllint/Dockerfile +++ b/linters/yaml_yamllint/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ########################################### ########################################### ## Dockerfile to run MegaLinter ## diff --git a/megalinter/descriptors/action.megalinter-descriptor.yml b/megalinter/descriptors/action.megalinter-descriptor.yml index 32ae1c4e060..4681db1e0ec 100644 --- a/megalinter/descriptors/action.megalinter-descriptor.yml +++ b/megalinter/descriptors/action.megalinter-descriptor.yml @@ -7,9 +7,6 @@ files_sub_directory: .github/workflows file_extensions: - ".yml" - ".yaml" -install: - apk: - - go test_folder: action linters: # ACTIONLINT @@ -27,6 +24,15 @@ linters: examples: - "actionlint /path/to/workflow1.yml /path/to/workflow2.yaml" install: + # actionlint requires shellcheck and pyflakes + apk: + - py3-pyflakes dockerfile: - - ENV GO111MODULE=on - - RUN go install github.com/rhysd/actionlint/cmd/actionlint@latest && go clean --cache + - | + FROM rhysd/actionlint:latest as actionlint + # shellcheck is a dependency for actionlint + - FROM koalaman/shellcheck:stable as shellcheck + - | + COPY --link --from=actionlint /usr/local/bin/actionlint /usr/bin/actionlint + # shellcheck is a dependency for actionlint + - COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck \ No newline at end of file diff --git a/megalinter/descriptors/all_flavors.json b/megalinter/descriptors/all_flavors.json index f4a9409dce5..dc713405561 100644 --- a/megalinter/descriptors/all_flavors.json +++ b/megalinter/descriptors/all_flavors.json @@ -29,9 +29,7 @@ }, "cupcake": { "descriptors": [ - "ACTION", "BASH", - "GO", "JAVA", "KOTLIN", "PHP", @@ -123,7 +121,6 @@ }, "documentation": { "descriptors": [ - "ACTION", "BASH", "KOTLIN" ], @@ -180,7 +177,6 @@ }, "dotnet": { "descriptors": [ - "ACTION", "ARM", "BASH", "CSHARP", @@ -253,9 +249,7 @@ }, "go": { "descriptors": [ - "ACTION", "BASH", - "GO", "KOTLIN" ], "label": "Optimized for GO based projects", @@ -313,7 +307,6 @@ }, "java": { "descriptors": [ - "ACTION", "BASH", "JAVA", "KOTLIN" @@ -374,7 +367,6 @@ }, "javascript": { "descriptors": [ - "ACTION", "BASH", "KOTLIN", "TYPESCRIPT" @@ -441,7 +433,6 @@ }, "php": { "descriptors": [ - "ACTION", "BASH", "KOTLIN", "PHP" @@ -502,7 +493,6 @@ }, "python": { "descriptors": [ - "ACTION", "BASH", "KOTLIN" ], @@ -569,7 +559,6 @@ }, "ruby": { "descriptors": [ - "ACTION", "BASH", "KOTLIN" ], @@ -626,7 +615,6 @@ }, "rust": { "descriptors": [ - "ACTION", "BASH", "KOTLIN" ], @@ -683,7 +671,6 @@ }, "salesforce": { "descriptors": [ - "ACTION", "BASH", "KOTLIN", "SALESFORCE" @@ -771,7 +758,6 @@ }, "swift": { "descriptors": [ - "ACTION", "BASH", "KOTLIN" ], @@ -828,7 +814,6 @@ }, "terraform": { "descriptors": [ - "ACTION", "BASH", "KOTLIN" ], diff --git a/megalinter/descriptors/bash.megalinter-descriptor.yml b/megalinter/descriptors/bash.megalinter-descriptor.yml index fa1af947406..cf7d39aafa1 100644 --- a/megalinter/descriptors/bash.megalinter-descriptor.yml +++ b/megalinter/descriptors/bash.megalinter-descriptor.yml @@ -73,12 +73,9 @@ linters: cargo: - shellcheck-sarif dockerfile: - - | - RUN ML_THIRD_PARTY_DIR="/third-party/shellcheck" \ - && mkdir -p ${ML_THIRD_PARTY_DIR} \ - && wget -qO- "https://github.com/koalaman/shellcheck/releases/download/stable/shellcheck-stable.linux.x86_64.tar.xz" | tar -xJv --directory ${ML_THIRD_PARTY_DIR} \ - && mv "${ML_THIRD_PARTY_DIR}/shellcheck-stable/shellcheck" /usr/bin/ \ - && find ${ML_THIRD_PARTY_DIR} -type f -not -name 'LICENSE*' -delete -o -type d -empty -delete + # Also update shellcheck version in action.megalinter-descriptor.yml + - FROM koalaman/shellcheck:stable as shellcheck + - COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck ide: atom: - name: linter-shellcheck @@ -124,7 +121,7 @@ linters: install: dockerfile: - FROM mvdan/shfmt:latest-alpine as shfmt - - COPY --from=shfmt /bin/shfmt /usr/bin/ + - COPY --link --from=shfmt /bin/shfmt /usr/bin/ ide: atom: - name: format-shell diff --git a/megalinter/descriptors/dockerfile.megalinter-descriptor.yml b/megalinter/descriptors/dockerfile.megalinter-descriptor.yml index 27391205a38..6c421773351 100644 --- a/megalinter/descriptors/dockerfile.megalinter-descriptor.yml +++ b/megalinter/descriptors/dockerfile.megalinter-descriptor.yml @@ -36,7 +36,7 @@ linters: install: dockerfile: - FROM hadolint/hadolint:v2.12.0-alpine as hadolint - - COPY --from=hadolint /bin/hadolint /usr/bin/hadolint + - COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint ide: atom: - name: linter-hadolint diff --git a/megalinter/descriptors/editorconfig.megalinter-descriptor.yml b/megalinter/descriptors/editorconfig.megalinter-descriptor.yml index 32b88b49766..6a3bfa55565 100644 --- a/megalinter/descriptors/editorconfig.megalinter-descriptor.yml +++ b/megalinter/descriptors/editorconfig.megalinter-descriptor.yml @@ -26,4 +26,4 @@ linters: install: dockerfile: - FROM mstruebing/editorconfig-checker:2.7.0 as editorconfig-checker - - COPY --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker + - COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker diff --git a/megalinter/descriptors/go.megalinter-descriptor.yml b/megalinter/descriptors/go.megalinter-descriptor.yml index a1ac0820fbf..8d8f934efe3 100644 --- a/megalinter/descriptors/go.megalinter-descriptor.yml +++ b/megalinter/descriptors/go.megalinter-descriptor.yml @@ -6,9 +6,6 @@ descriptor_flavors: file_extensions: - ".go" test_folder: golang -install: - apk: - - go linters: # GOLANG CI LINT - linter_name: golangci-lint @@ -28,6 +25,8 @@ linters: - "golangci-lint run myfile.go" - "golangci-lint run -c .golangci.yml myfile.go" install: + apk: + - go dockerfile: - | RUN wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh \ @@ -77,7 +76,16 @@ linters: - "revive -config myfile.go" install: dockerfile: - - RUN go install github.com/mgechev/revive@latest && go clean --cache + ## Until "FROM ghcr.io/mgechev/revive:1.2.5 as revive" is available, use + # - FROM ghcr.io/mgechev/revive:1.2.5 as revive + # - COPY --link --from=revive /usr/bin/revive /usr/bin/revive + - | + FROM golang:1.19-alpine as revive + ## The golang image used as a builder is a temporary workaround + ## for the released revive binaries not returning version numbers (devel). + ## The install command should then be what is commented in the go.megalinter-descriptor.yml + RUN GOBIN=/usr/bin go install github.com/mgechev/revive@latest + - COPY --link --from=revive /usr/bin/revive /usr/bin/revive ide: atom: - name: linter-revive diff --git a/megalinter/descriptors/latex.megalinter-descriptor.yml b/megalinter/descriptors/latex.megalinter-descriptor.yml index c406e950469..1af447b0010 100644 --- a/megalinter/descriptors/latex.megalinter-descriptor.yml +++ b/megalinter/descriptors/latex.megalinter-descriptor.yml @@ -20,7 +20,7 @@ linters: install: dockerfile: - FROM ghcr.io/assignuser/chktex-alpine:latest as chktex - - COPY --from=chktex /usr/bin/chktex /usr/bin/ + - COPY --link --from=chktex /usr/bin/chktex /usr/bin/ - RUN cd ~ && touch .chktexrc && cd / ide: atom: diff --git a/megalinter/descriptors/makefile.megalinter-descriptor.yml b/megalinter/descriptors/makefile.megalinter-descriptor.yml index 4b1474f197b..d2ac4686d4c 100644 --- a/megalinter/descriptors/makefile.megalinter-descriptor.yml +++ b/megalinter/descriptors/makefile.megalinter-descriptor.yml @@ -25,8 +25,12 @@ linters: - "checkmake Makefile" - "checkmake --config .checkmake.ini Makefile" install: + # make is included in the mrtazz/checkmake:latest image + # (DIGEST:sha256:eb6919b20b22d1701a976856e4a224627df0a74b118246101fb6cf5c2e03049f) + # It may not be a real dependency, like their pandoc mention in the README, + # that is not included in the docker image they provide. + apk: + - make dockerfile: - - | - RUN ( [ -d /usr/local/bin ] || mkdir -p /usr/local/bin ) \ - && wget -q "https://github.com/mrtazz/checkmake/releases/download/0.2.1/checkmake-0.2.1.linux.amd64" -O /usr/local/bin/checkmake \ - && chmod 755 /usr/local/bin/checkmake + - FROM mrtazz/checkmake:latest as checkmake + - COPY --link --from=checkmake /checkmake /usr/bin/checkmake diff --git a/megalinter/descriptors/protobuf.megalinter-descriptor.yml b/megalinter/descriptors/protobuf.megalinter-descriptor.yml index 9e32ca428af..f6d154ea77f 100644 --- a/megalinter/descriptors/protobuf.megalinter-descriptor.yml +++ b/megalinter/descriptors/protobuf.megalinter-descriptor.yml @@ -26,7 +26,7 @@ linters: install: dockerfile: - FROM yoheimuta/protolint:latest as protolint - - COPY --from=protolint /usr/local/bin/protolint /usr/bin/ + - COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ ide: idea: - name: Protocol Buffer Linter diff --git a/megalinter/descriptors/repository.megalinter-descriptor.yml b/megalinter/descriptors/repository.megalinter-descriptor.yml index ffe0592713c..2ce312eeefa 100644 --- a/megalinter/descriptors/repository.megalinter-descriptor.yml +++ b/megalinter/descriptors/repository.megalinter-descriptor.yml @@ -116,24 +116,18 @@ linters: - --recursive cli_lint_errors_count: regex_count cli_lint_errors_regex: "(error )" - linter_version_cache: "0.0.0" + linter_version_cache: "1.2.0" test_folder: dustilock examples: - "dustilock" install: - apk: - - go dockerfile: + # The golang image used as a builder is a temporary workaround + # Dustilock is not released as a binary or container - | - RUN ML_THIRD_PARTY_DIR=/download/dustilock && \ - mkdir -p ${ML_THIRD_PARTY_DIR} && \ - git clone https://github.com/Checkmarx/dustilock.git ${ML_THIRD_PARTY_DIR} && \ - cd ${ML_THIRD_PARTY_DIR} && \ - go build && go clean --cache && \ - chmod +x dustilock && \ - mv "${ML_THIRD_PARTY_DIR}/dustilock" /usr/bin/ && \ - find ${ML_THIRD_PARTY_DIR} -type f -not -name 'LICENSE*' -delete -o -type d -empty -delete && \ - cd / + FROM golang:alpine as dustilock + RUN GOBIN=/usr/bin go install github.com/checkmarx/dustilock@v1.2.0 + - COPY --link --from=dustilock /usr/bin/dustilock /usr/bin/dustilock # GIT_DIFF - linter_name: git_diff @@ -195,7 +189,7 @@ linters: install: dockerfile: - FROM zricethezav/gitleaks:v8.15.3 as gitleaks - - COPY --from=gitleaks /usr/bin/gitleaks /usr/bin/ + - COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ # GOODCHECK - linter_name: goodcheck diff --git a/megalinter/descriptors/terraform.megalinter-descriptor.yml b/megalinter/descriptors/terraform.megalinter-descriptor.yml index 65efabb7ad5..f68047b2854 100644 --- a/megalinter/descriptors/terraform.megalinter-descriptor.yml +++ b/megalinter/descriptors/terraform.megalinter-descriptor.yml @@ -30,7 +30,7 @@ linters: install: dockerfile: - FROM ghcr.io/terraform-linters/tflint:v0.45.0 as tflint - - COPY --from=tflint /usr/local/bin/tflint /usr/bin/ + - COPY --link --from=tflint /usr/local/bin/tflint /usr/bin/ # TERRASCAN - class: TerrascanLinter linter_name: terrascan @@ -67,7 +67,7 @@ linters: install: dockerfile: - FROM tenable/terrascan:1.18.0 as terrascan - - COPY --from=terrascan /go/bin/terrascan /usr/bin/ + - COPY --link --from=terrascan /go/bin/terrascan /usr/bin/ # TERRAGRUNT - linter_name: terragrunt name: TERRAFORM_TERRAGRUNT @@ -100,7 +100,7 @@ linters: install: dockerfile: - FROM alpine/terragrunt:latest as terragrunt - - COPY --from=terragrunt /usr/local/bin/terragrunt /usr/bin/ + - COPY --link --from=terragrunt /usr/local/bin/terragrunt /usr/bin/ # TERRAFORM_FMT - linter_name: terraform-fmt name: TERRAFORM_TERRAFORM_FMT @@ -122,7 +122,7 @@ linters: install: dockerfile: - FROM alpine/terragrunt:latest as terragrunt - - COPY --from=terragrunt /bin/terraform /usr/bin/ + - COPY --link --from=terragrunt /bin/terraform /usr/bin/ ide: atom: - name: terraform-fmt @@ -194,7 +194,7 @@ linters: install: dockerfile: - FROM checkmarx/kics:alpine as kics - - COPY --from=kics /app/bin/kics /usr/bin/ + - COPY --link --from=kics /app/bin/kics /usr/bin/ - RUN mkdir -p /opt/kics/assets - ENV KICS_QUERIES_PATH=/opt/kics/assets/queries KICS_LIBRARIES_PATH=/opt/kics/assets/libraries - COPY --from=kics /app/bin/assets /opt/kics/assets/