From 4cff96bf54a6925373ab6d281dfd11b24c4e5fa0 Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Tue, 11 Apr 2023 09:01:58 -0500 Subject: [PATCH 001/105] Add the ability to native build cargo packages --- .automation/build.py | 97 ++++++++++++++++++++++++++++++-------------- 1 file changed, 67 insertions(+), 30 deletions(-) diff --git a/.automation/build.py b/.automation/build.py index 8e08a5d5639..f2f94b8b9df 100644 --- a/.automation/build.py +++ b/.automation/build.py @@ -69,7 +69,6 @@ else: VERSION_URL_SEGMENT = VERSION - MKDOCS_URL_ROOT = ML_DOC_URL_BASE + VERSION_URL_SEGMENT BRANCH = "main" @@ -419,31 +418,6 @@ def build_dockerfile( if len(gem_packages) > 0: apk_packages += ["ruby", "ruby-dev", "ruby-bundler", "ruby-rdoc"] # Replace between tags in Dockerfile - # Commands - replace_in_file( - dockerfile, - "#FROM__START", - "#FROM__END", - "\n".join(list(dict.fromkeys(docker_from))), - ) - replace_in_file( - dockerfile, - "#ARG__START", - "#ARG__END", - "\n".join(list(dict.fromkeys(docker_arg))), - ) - replace_in_file( - dockerfile, - "#COPY__START", - "#COPY__END", - "\n".join(docker_copy), - ) - replace_in_file( - dockerfile, - "#OTHER__START", - "#OTHER__END", - "\n".join(docker_other), - ) # apk packages apk_install_command = "" if len(apk_packages) > 0: @@ -455,6 +429,44 @@ def build_dockerfile( replace_in_file(dockerfile, "#APK__START", "#APK__END", apk_install_command) # cargo packages cargo_install_command = "" + # Pre-building packages + prebuild_list = set(cargo_packages) & {"shellcheck-sarif", "sarif-fmt"} + cargo_packages = set(cargo_packages) - prebuild_list + if len(prebuild_list) > 0: + docker_from += [ + "FROM --platform=$BUILDPLATFORM alpine:3 AS cargo-build\n" + + "WORKDIR /cargo\n" + + "ENV HOME=/cargo\n" + + "USER 0\n" + + "RUN --mount=type=cache,target=/var/cache/apk,id=apk-${BUILDARCH},sharing=locked \\\n" + + " apk add --update \\\n" + + " gcc \\\n" + + " rustup \\\n" + + " bash \\\n" + + " git \\\n" + + " musl-dev \\\n" + + " llvm \\\n" + + " clang\n" + + "RUN chown 63425:63425 /cargo\n" + + "USER 63425\n" + + "ENV CC_aarch64_unknown_linux_musl=clang \\\n" + + " AR_aarch64_unknown_linux_musl=llvm-ar \\\n" + + ' CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_RUSTFLAGS="-Clink-self-contained=yes -Clinker=rust-lld" \\\n' + + " CC_x86_64_unknown_linux_musl=clang \\\n" + + " AR_x86_64_unknown_linux_musl=llvm-ar \\\n" + + ' CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_RUSTFLAGS="-Clink-self-contained=yes -Clinker=rust-lld"\n' + + "ARG TARGETARCH\n" + + 'RUN rustup-init -y --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl")\n' + + "\n" + + "RUN --mount=type=cache,id=cargo-${TARGETARCH},sharing=locked,target=/cargo/.cargo/registry/,uid=63425 \\\n" + + " . /cargo/.cargo/env \\\n" + + f' && cargo install {" ".join(prebuild_list)} --root /tmp --target $([[ "${{TARGETARCH}}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") \n' + + "\n" + + "FROM scratch AS cargo\n" + + "COPY --link --from=cargo-build /tmp/bin/* /bin/\n" + + f'RUN ["/bin/' + '", "--help"]\nRUN ["/bin/'.join(prebuild_list) + '", "--help"]\n' + ] + docker_copy += [f"COPY --from=cargo /bin/* /usr/bin/"] keep_rustup = False if len(cargo_packages) > 0: rust_commands = [] @@ -561,6 +573,31 @@ def build_dockerfile( + " \\\n ".join(list(dict.fromkeys(gem_packages))) ) replace_in_file(dockerfile, "#GEM__START", "#GEM__END", gem_install_command) + # Commands + replace_in_file( + dockerfile, + "#FROM__START", + "#FROM__END", + "\n".join(list(dict.fromkeys(docker_from))), + ) + replace_in_file( + dockerfile, + "#ARG__START", + "#ARG__END", + "\n".join(list(dict.fromkeys(docker_arg))), + ) + replace_in_file( + dockerfile, + "#COPY__START", + "#COPY__END", + "\n".join(docker_copy), + ) + replace_in_file( + dockerfile, + "#OTHER__START", + "#OTHER__END", + "\n".join(docker_other), + ) flavor_env = f"ENV MEGALINTER_FLAVOR={flavor}" replace_in_file(dockerfile, "#FLAVOR__START", "#FLAVOR__END", flavor_env) replace_in_file( @@ -1441,12 +1478,12 @@ def process_type(linters_by_type, type1, type_label, linters_tables_md): # Pre/post commands & unsecured variables linter_doc_md += [ f"| {linter.name}_PRE_COMMANDS | List of bash commands to run before the linter" - f"| {dump_as_json(linter.pre_commands,'None')} |", + f"| {dump_as_json(linter.pre_commands, 'None')} |", f"| {linter.name}_POST_COMMANDS | List of bash commands to run after the linter" f"| {dump_as_json(linter.post_commands,'None')} |", f"| {linter.name}_UNSECURED_ENV_VARIABLES | List of env variables explicitly " + f"not filtered before calling {linter.name} and its pre/post commands" - f"| {dump_as_json(linter.post_commands,'None')} |", + f"| {dump_as_json(linter.post_commands, 'None')} |", ] add_in_config_schema_file( [ @@ -2484,7 +2521,7 @@ def finalize_doc_build(): [![GitHub stars](https://img.shields.io/github/stars/oxsecurity/megalinter?cacheSeconds=3600&color=%23FD80CD)](https://github.com/oxsecurity/megalinter/stargazers/) [![Dependents](https://img.shields.io/static/v1?label=Used%20by&message=2180&color=%23FD80CD&logo=slickpic)](https://github.com/oxsecurity/megalinter/network/dependents) [![GitHub contributors](https://img.shields.io/github/contributors/oxsecurity/megalinter.svg?color=%23FD80CD)](https://github.com/oxsecurity/megalinter/graphs/contributors/) -[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square&color=%23FD80CD)](http://makeapullrequest.com)""", # noqa: E501 +[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square&color=%23FD80CD)](http://makeapullrequest.com)""", # noqa: E501 ) # Remove TOC in target file @@ -3239,7 +3276,7 @@ def update_workflow_linters(file_path, linters): file_content = f.read() file_content = re.sub( r"(linter:\s+\[\s*)([^\[\]]*?)(\s*\])", - rf"\1{re.escape(linters).replace(chr(92),'').strip()}\3", + rf"\1{re.escape(linters).replace(chr(92), '').strip()}\3", file_content, ) From d2d262ac8fa687aa8cef1b19d214372f0ff514cf Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Tue, 11 Apr 2023 11:14:51 -0500 Subject: [PATCH 002/105] Add --link --- .automation/build.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.automation/build.py b/.automation/build.py index f2f94b8b9df..a21b3c6388a 100644 --- a/.automation/build.py +++ b/.automation/build.py @@ -466,7 +466,7 @@ def build_dockerfile( + "COPY --link --from=cargo-build /tmp/bin/* /bin/\n" + f'RUN ["/bin/' + '", "--help"]\nRUN ["/bin/'.join(prebuild_list) + '", "--help"]\n' ] - docker_copy += [f"COPY --from=cargo /bin/* /usr/bin/"] + docker_copy += [f"COPY --link --from=cargo /bin/* /usr/bin/"] keep_rustup = False if len(cargo_packages) > 0: rust_commands = [] From 8cfee332aac87cfc63b24b7db522412b331249d5 Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Tue, 11 Apr 2023 11:21:41 -0500 Subject: [PATCH 003/105] Attempting to fix CI --- .github/workflows/deploy-DEV.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy-DEV.yml b/.github/workflows/deploy-DEV.yml index b84d1786f11..a623ca3bfd3 100644 --- a/.github/workflows/deploy-DEV.yml +++ b/.github/workflows/deploy-DEV.yml @@ -151,13 +151,19 @@ jobs: BUILD_DATE=${{ env.BUILD_DATE }} BUILD_REVISION=${{ github.sha }} BUILD_VERSION=${{ steps.image_tag.outputs.tag }} - load: true + load: false push: false secrets: | GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} tags: | oxsecurity/megalinter:${{ steps.image_tag.outputs.tag }} + outputs: type=oci,dest=/tmp/image.tar timeout-minutes: 90 + - name: Load OCI + shell: bash + run: | + docker load --input /tmp/image.tar + rm -f /tmp/image.tar #################################### # Build image (full for main repo) # From b6a8899bf570c54d765759915d77408e0a302331 Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Wed, 12 Apr 2023 14:35:00 -0500 Subject: [PATCH 004/105] Finished moving pip venvs into cross-compiled layer --- .automation/build.py | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/.automation/build.py b/.automation/build.py index a21b3c6388a..4b72893f7bc 100644 --- a/.automation/build.py +++ b/.automation/build.py @@ -534,35 +534,53 @@ def build_dockerfile( replace_in_file(dockerfile, "#PIP__START", "#PIP__END", pip_install_command) # Python packages in venv if len(pipvenv_packages.items()) > 0: - pipenv_install_command = ( + pipenv_download_command = ( "RUN PYTHONDONTWRITEBYTECODE=1 pip3 install" - " --no-cache-dir --upgrade pip virtualenv \\\n" + " --no-cache-dir --upgrade pip crossenv \\\n" + ) + pipenv_install_command = ( + "RUN echo \\\n" ) - env_path_command = 'ENV PATH="${PATH}"' + pipenv_path_command = 'ENV PATH="${PATH}"' for pip_linter, pip_linter_packages in pipvenv_packages.items(): + pipenv_download_command += ( + f' && mkdir -p "/download/{pip_linter}" ' + + f'&& pip download -d "/download/{pip_linter}" ' + + (" ".join(pip_linter_packages)) + + " \\\n" + ) pipenv_install_command += ( f' && mkdir -p "/venvs/{pip_linter}" ' + f'&& cd "/venvs/{pip_linter}" ' - + "&& virtualenv . " + + "&& python3 -m crossenv /usr/local/bin/target-python3 . " + "&& source bin/activate " - + "&& PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir " + + f"&& PYTHONDONTWRITEBYTECODE=1 pip3 install --find-links /download/{pip_linter} --no-cache-dir " + (" ".join(pip_linter_packages)) + " " + "&& deactivate " + "&& cd ./../.. \\\n" ) - env_path_command += f":/venvs/{pip_linter}/bin" + pipenv_path_command += f":/venvs/{pip_linter}/bin" pipenv_install_command = pipenv_install_command[:-2] # remove last \ + pipenv_download_command = pipenv_download_command[:-2] # remove last \ pipenv_install_command += ( ' \\\n && find . | grep -E "(/__pycache__$|\\.pyc$|\\.pyo$)" | xargs rm -rf ' + "&& rm -rf /root/.cache\n" - + env_path_command ) + pipenv_download_command += "\n" else: pipenv_install_command = "" + pipenv_download_command = "" + pipenv_path_command = "" replace_in_file( dockerfile, "#PIPVENV__START", "#PIPVENV__END", pipenv_install_command ) + replace_in_file( + dockerfile, "#PIPVENV_DOWNLOAD__START", "#PIPVENV_DOWNLOAD__END", pipenv_download_command + ) + replace_in_file( + dockerfile, "#PIPVENV_PATH__START", "#PIPVENV_PATH__END", pipenv_path_command + ) # Ruby gem packages gem_install_command = "" From 9074ee9d9269dccfabbda80f28cc2b21effccd22 Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Thu, 13 Apr 2023 10:24:50 -0500 Subject: [PATCH 005/105] Shrinking the dockerfile a bit --- .automation/build.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.automation/build.py b/.automation/build.py index 4b72893f7bc..a38c697b662 100644 --- a/.automation/build.py +++ b/.automation/build.py @@ -315,7 +315,8 @@ def build_dockerfile( # Collect Dockerfile items if "dockerfile" in item["install"]: item_label = item.get("linter_name", item.get("descriptor_id", "")) - docker_other += [f"# {item_label} installation"] + install_comment = f"# {item_label} installation" + docker_other += [install_comment] for dockerfile_item in item["install"]["dockerfile"]: # FROM if dockerfile_item.startswith("FROM"): @@ -336,10 +337,6 @@ def build_dockerfile( "# " + "\n# ".join(dockerfile_item.splitlines()) ) docker_copy += [dockerfile_item] - docker_other += [ - "# Managed with " - + "\n# ".join(dockerfile_item.splitlines()) - ] # Already used item elif ( dockerfile_item in all_dockerfile_items @@ -392,7 +389,11 @@ def build_dockerfile( is_docker_other_run = False docker_other += [dockerfile_item] all_dockerfile_items += [dockerfile_item] - docker_other += [""] + # Removing comment if no install was needed + if docker_other[-1] == install_comment: + docker_other.pop() + else: + docker_other += ["#"] # Collect python packages if "apk" in item["install"]: apk_packages += item["install"]["apk"] From 360804ab056af3b0d438608bea3b05952726f22a Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Thu, 13 Apr 2023 10:29:46 -0500 Subject: [PATCH 006/105] Moving chmod to copy command to reduce layer count --- .automation/build.py | 3 +-- megalinter/descriptors/php.megalinter-descriptor.yml | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.automation/build.py b/.automation/build.py index a38c697b662..bc5b590a623 100644 --- a/.automation/build.py +++ b/.automation/build.py @@ -265,8 +265,7 @@ def generate_flavor(flavor, flavor_info): file.write(action_yml) logging.info(f"Updated {flavor_action_yml}") extra_lines = [ - "COPY entrypoint.sh /entrypoint.sh", - "RUN chmod +x entrypoint.sh", + "COPY --chmod=755 entrypoint.sh /entrypoint.sh", 'ENTRYPOINT ["/bin/bash", "/entrypoint.sh"]', ] build_dockerfile( diff --git a/megalinter/descriptors/php.megalinter-descriptor.yml b/megalinter/descriptors/php.megalinter-descriptor.yml index e4a28d933c9..d8631fed22b 100644 --- a/megalinter/descriptors/php.megalinter-descriptor.yml +++ b/megalinter/descriptors/php.megalinter-descriptor.yml @@ -106,8 +106,7 @@ linters: install: dockerfile: - FROM ghcr.io/phpstan/phpstan:latest-php8.1 as phpstan - - COPY --link --from=phpstan /composer/vendor/phpstan/phpstan/phpstan.phar /usr/bin/phpstan - - RUN chmod +x /usr/bin/phpstan + - COPY --link --chmod=755 --from=phpstan /composer/vendor/phpstan/phpstan/phpstan.phar /usr/bin/phpstan idea: - name: PHPStan / Psalm / Generics url: https://plugins.jetbrains.com/plugin/12754-phpstan--psalm--generics From c5b6da9f627efa6b93139a45ec919afb4c4faba6 Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Thu, 13 Apr 2023 11:02:52 -0500 Subject: [PATCH 007/105] Add build platform layer, move scalafix to that layer --- .automation/build.py | 71 +++++++++++++++++++ .../scala.megalinter-descriptor.yml | 6 +- 2 files changed, 75 insertions(+), 2 deletions(-) diff --git a/.automation/build.py b/.automation/build.py index bc5b590a623..43730e1a034 100644 --- a/.automation/build.py +++ b/.automation/build.py @@ -293,7 +293,9 @@ def build_dockerfile( docker_arg = [] docker_copy = [] docker_other = [] + docker_build_platform_other = [] all_dockerfile_items = [] + all_build_platform_dockerfile_items = [] apk_packages = DEFAULT_DOCKERFILE_APK_PACKAGES.copy() npm_packages = [] pip_packages = [] @@ -301,6 +303,7 @@ def build_dockerfile( gem_packages = [] cargo_packages = [] if "cargo" not in extra_packages else extra_packages["cargo"] is_docker_other_run = False + is_docker_build_platform_other_run = False # Manage docker if requires_docker is True: apk_packages += ["docker", "openrc"] @@ -312,6 +315,68 @@ def build_dockerfile( if "install" not in item: item["install"] = {} # Collect Dockerfile items + if "build_platform_dockerfile" in item["install"]: + item_label = item.get("linter_name", item.get("descriptor_id", "")) + install_comment = f"# {item_label} installation" + docker_build_platform_other += [install_comment] + for dockerfile_item in item["install"]["build_platform_dockerfile"]: + # FROM + if ( + dockerfile_item in all_build_platform_dockerfile_items + or dockerfile_item.replace( + "RUN ", "RUN --mount=type=secret,id=GITHUB_TOKEN " + ) + in all_build_platform_dockerfile_items + ): + dockerfile_item = ( + "# Next line commented because already managed by another linter\n" + "# " + "\n# ".join(dockerfile_item.splitlines()) + ) + docker_build_platform_other += [dockerfile_item] + # RUN (standalone with GITHUB_TOKEN) + elif ( + dockerfile_item.startswith("RUN") + and "GITHUB_TOKEN" in dockerfile_item + ): + dockerfile_item_cmd = dockerfile_item.replace( + "RUN ", "RUN --mount=type=secret,id=GITHUB_TOKEN " + ) + docker_build_platform_other += [dockerfile_item_cmd] + is_docker_build_platform_other_run = False + # RUN (start) + elif dockerfile_item.startswith("RUN") and is_docker_build_platform_other_run is False: + docker_build_platform_other += [dockerfile_item] + is_docker_build_platform_other_run = True + # RUN (append) + elif dockerfile_item.startswith("RUN") and is_docker_build_platform_other_run is True: + dockerfile_item_cmd = dockerfile_item.replace("RUN", " &&") + # Add \ in previous instruction line + for index, prev_instruction_line in reversed( + list(enumerate(docker_build_platform_other)) + ): + if ( + prev_instruction_line.strip() != "" + and not prev_instruction_line.startswith("#") + ): + # Remove last char if \n + prev_instruction_line = ( + prev_instruction_line + if not prev_instruction_line.endswith("\n") + else prev_instruction_line[:-1] + ) + docker_build_platform_other[index] = prev_instruction_line + " \\" + break + docker_build_platform_other += [dockerfile_item_cmd] + # Other + else: + is_docker_build_platform_other_run = False + docker_build_platform_other += [dockerfile_item] + all_dockerfile_items += [dockerfile_item] + # Removing comment if no install was needed + if docker_build_platform_other[-1] == install_comment: + docker_build_platform_other.pop() + else: + docker_build_platform_other += ["#"] if "dockerfile" in item["install"]: item_label = item.get("linter_name", item.get("descriptor_id", "")) install_comment = f"# {item_label} installation" @@ -616,6 +681,12 @@ def build_dockerfile( "#OTHER__END", "\n".join(docker_other), ) + replace_in_file( + dockerfile, + "#BUILD_PLATFORM_OTHER__START", + "#BUILD_PLATFORM_OTHER__END", + "\n".join(docker_build_platform_other), + ) flavor_env = f"ENV MEGALINTER_FLAVOR={flavor}" replace_in_file(dockerfile, "#FLAVOR__START", "#FLAVOR__END", flavor_env) replace_in_file( diff --git a/megalinter/descriptors/scala.megalinter-descriptor.yml b/megalinter/descriptors/scala.megalinter-descriptor.yml index e9ad48b797c..b1dd0c711df 100644 --- a/megalinter/descriptors/scala.megalinter-descriptor.yml +++ b/megalinter/descriptors/scala.megalinter-descriptor.yml @@ -5,7 +5,7 @@ file_extensions: install: apk: - openjdk11 - dockerfile: + build_platform_dockerfile: - | RUN curl --retry-all-errors --retry 10 -fLo coursier https://git.io/coursier-cli && \ chmod +x coursier @@ -40,8 +40,10 @@ linters: - "scalafix --check --config .scalafix.conf myfile.scala" - "scalafix --config .scalafix.conf myfile.scala" # Fix install: - dockerfile: + build_platform_dockerfile: - RUN ./coursier install scalafix --quiet --install-dir /usr/bin && rm -rf /root/.cache + dockerfile: + - COPY --link --from=build-platform /usr/bin/scalafix /usr/bin supported_platforms: platform: - linux/amd64 From 3ac92b3cd9669e910776b1c1d78d6c127a004c57 Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Thu, 13 Apr 2023 11:05:37 -0500 Subject: [PATCH 008/105] Move bash_exec to build_platform --- megalinter/descriptors/bash.megalinter-descriptor.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/megalinter/descriptors/bash.megalinter-descriptor.yml b/megalinter/descriptors/bash.megalinter-descriptor.yml index bf698091bec..f575fe3951d 100644 --- a/megalinter/descriptors/bash.megalinter-descriptor.yml +++ b/megalinter/descriptors/bash.megalinter-descriptor.yml @@ -34,10 +34,12 @@ linters: examples: - "bash-exec myfile.sh" install: - dockerfile: + build_platform_dockerfile: - | 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 + dockerfile: + - COPY --link --from=build-platform /usr/bin/bash-exec /usr/bin/bash-exec supported_platforms: platform: - linux/amd64 From 13d9e5c1a6000107f5964059c509c4612a47f0ea Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Thu, 13 Apr 2023 11:12:36 -0500 Subject: [PATCH 009/105] Move dotenv linter to docker image --- megalinter/descriptors/env.megalinter-descriptor.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/megalinter/descriptors/env.megalinter-descriptor.yml b/megalinter/descriptors/env.megalinter-descriptor.yml index 07a10a85f91..87474853bac 100644 --- a/megalinter/descriptors/env.megalinter-descriptor.yml +++ b/megalinter/descriptors/env.megalinter-descriptor.yml @@ -20,7 +20,8 @@ linters: - "dotenv-linter fix myfile.env" install: dockerfile: - - RUN wget -q -O - https://raw.githubusercontent.com/dotenv-linter/dotenv-linter/master/install.sh | sh -s + - FROM dotenvlinter/dotenv-linter:latest as dotenvlinter + - COPY --link --from=actionlint /dotenv-linter /usr/bin/dotenv-linter supported_platforms: platform: - linux/amd64 From 51881a7da6426db640a4074824ccc70c122c0183 Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Thu, 13 Apr 2023 14:01:53 -0500 Subject: [PATCH 010/105] Added the ability to install into the build-platform stage --- .automation/build.py | 13 ++++++++++++- .../descriptors/scala.megalinter-descriptor.yml | 2 ++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/.automation/build.py b/.automation/build.py index 43730e1a034..e185ece4a60 100644 --- a/.automation/build.py +++ b/.automation/build.py @@ -297,6 +297,7 @@ def build_dockerfile( all_dockerfile_items = [] all_build_platform_dockerfile_items = [] apk_packages = DEFAULT_DOCKERFILE_APK_PACKAGES.copy() + apk_build_platform_packages = [] npm_packages = [] pip_packages = [] pipvenv_packages = {} @@ -458,9 +459,11 @@ def build_dockerfile( docker_other.pop() else: docker_other += ["#"] - # Collect python packages + # Collect apk packages if "apk" in item["install"]: apk_packages += item["install"]["apk"] + if "build_platform_apk" in item["install"]: + apk_build_platform_packages += item["install"]["build_platform_apk"] # Collect npm packages if "npm" in item["install"]: npm_packages += item["install"]["npm"] @@ -491,7 +494,15 @@ def build_dockerfile( + " \\\n ".join(list(dict.fromkeys(apk_packages))) + " \\\n && git config --global core.autocrlf true" ) + apk_build_platform_install_command = "" + if len(apk_build_platform_packages) > 0: + apk_build_platform_install_command = ( + "RUN apk add --update --no-cache \\\n " + + " \\\n ".join(list(dict.fromkeys(apk_build_platform_packages))) + + " \\\n && git config --global core.autocrlf true" + ) replace_in_file(dockerfile, "#APK__START", "#APK__END", apk_install_command) + replace_in_file(dockerfile, "#BUILD_PLATFORM_APK__START", "#BUILD_PLATFORM_APK__END", apk_build_platform_install_command) # cargo packages cargo_install_command = "" # Pre-building packages diff --git a/megalinter/descriptors/scala.megalinter-descriptor.yml b/megalinter/descriptors/scala.megalinter-descriptor.yml index b1dd0c711df..a06f6918de2 100644 --- a/megalinter/descriptors/scala.megalinter-descriptor.yml +++ b/megalinter/descriptors/scala.megalinter-descriptor.yml @@ -5,6 +5,8 @@ file_extensions: install: apk: - openjdk11 + build_platform_apk: + - curl build_platform_dockerfile: - | RUN curl --retry-all-errors --retry 10 -fLo coursier https://git.io/coursier-cli && \ From a6fa2581d1a7606f93d1abc54b638647809978da Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Thu, 13 Apr 2023 14:46:07 -0500 Subject: [PATCH 011/105] Bugfix --- .automation/build.py | 1 - 1 file changed, 1 deletion(-) diff --git a/.automation/build.py b/.automation/build.py index e185ece4a60..37b206beeb5 100644 --- a/.automation/build.py +++ b/.automation/build.py @@ -492,7 +492,6 @@ def build_dockerfile( apk_install_command = ( "RUN apk add --no-cache \\\n " + " \\\n ".join(list(dict.fromkeys(apk_packages))) - + " \\\n && git config --global core.autocrlf true" ) apk_build_platform_install_command = "" if len(apk_build_platform_packages) > 0: From 99b27820dc5b851b27c03767a1a70415eda46fa1 Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Thu, 13 Apr 2023 17:20:28 -0500 Subject: [PATCH 012/105] Bugfix --- .automation/build.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.automation/build.py b/.automation/build.py index 37b206beeb5..4af48accb6c 100644 --- a/.automation/build.py +++ b/.automation/build.py @@ -492,13 +492,13 @@ def build_dockerfile( apk_install_command = ( "RUN apk add --no-cache \\\n " + " \\\n ".join(list(dict.fromkeys(apk_packages))) + + " \\\n && git config --global core.autocrlf true" ) apk_build_platform_install_command = "" if len(apk_build_platform_packages) > 0: apk_build_platform_install_command = ( "RUN apk add --update --no-cache \\\n " + " \\\n ".join(list(dict.fromkeys(apk_build_platform_packages))) - + " \\\n && git config --global core.autocrlf true" ) replace_in_file(dockerfile, "#APK__START", "#APK__END", apk_install_command) replace_in_file(dockerfile, "#BUILD_PLATFORM_APK__START", "#BUILD_PLATFORM_APK__END", apk_build_platform_install_command) From 925606f9ee33d4c871f25f2f3313b1387d86ecb8 Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Thu, 13 Apr 2023 17:29:00 -0500 Subject: [PATCH 013/105] Moved megalinter to a venv --- entrypoint.sh | 4 ++++ megalinter/setup.py | 1 + 2 files changed, 5 insertions(+) diff --git a/entrypoint.sh b/entrypoint.sh index f9d09ebe325..f9f024dcbdf 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,5 +1,9 @@ #!/usr/bin/env bash +if [[ -d /venvs/megalinter ]]; then + source /venvs/megalinter/bin/activate +fi + PYTHONPATH=$PYTHONPATH:$(pwd) export PYTHONPATH diff --git a/megalinter/setup.py b/megalinter/setup.py index 6a28376efec..f38ad12dc9a 100644 --- a/megalinter/setup.py +++ b/megalinter/setup.py @@ -8,6 +8,7 @@ author="Nicolas Vuillamy", author_email="nicolas.vuillamy@gmail.com", license="MIT", + package_dir={"megalinter": ""}, packages=[ "megalinter", "megalinter.linters", From 08a8073560fc6bc798843d596b6ba786b4b2a70d Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Thu, 13 Apr 2023 17:40:30 -0500 Subject: [PATCH 014/105] Add dep --- megalinter/descriptors/scala.megalinter-descriptor.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/megalinter/descriptors/scala.megalinter-descriptor.yml b/megalinter/descriptors/scala.megalinter-descriptor.yml index a06f6918de2..9f71c920503 100644 --- a/megalinter/descriptors/scala.megalinter-descriptor.yml +++ b/megalinter/descriptors/scala.megalinter-descriptor.yml @@ -7,6 +7,7 @@ install: - openjdk11 build_platform_apk: - curl + - java build_platform_dockerfile: - | RUN curl --retry-all-errors --retry 10 -fLo coursier https://git.io/coursier-cli && \ From 02a8f0958eee501238957febe86c157894e4b48e Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Thu, 13 Apr 2023 17:50:44 -0500 Subject: [PATCH 015/105] fixed java package, started seperating node modules to it's own layer --- .automation/build.py | 10 ++++++++++ megalinter/descriptors/scala.megalinter-descriptor.yml | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.automation/build.py b/.automation/build.py index 4af48accb6c..6edb375e1b3 100644 --- a/.automation/build.py +++ b/.automation/build.py @@ -298,6 +298,7 @@ def build_dockerfile( all_build_platform_dockerfile_items = [] apk_packages = DEFAULT_DOCKERFILE_APK_PACKAGES.copy() apk_build_platform_packages = [] + apk_npm_packages = [] npm_packages = [] pip_packages = [] pipvenv_packages = {} @@ -464,6 +465,8 @@ def build_dockerfile( apk_packages += item["install"]["apk"] if "build_platform_apk" in item["install"]: apk_build_platform_packages += item["install"]["build_platform_apk"] + if "npm_apk" in item["install"]: + apk_npm_packages += item["install"]["npm_apk"] # Collect npm packages if "npm" in item["install"]: npm_packages += item["install"]["npm"] @@ -500,8 +503,15 @@ def build_dockerfile( "RUN apk add --update --no-cache \\\n " + " \\\n ".join(list(dict.fromkeys(apk_build_platform_packages))) ) + apk_npm_install_command = "" + if len(apk_npm_packages) > 0: + apk_npm_install_command = ( + "RUN apk add --update --no-cache \\\n " + + " \\\n ".join(list(dict.fromkeys(apk_npm_packages))) + ) replace_in_file(dockerfile, "#APK__START", "#APK__END", apk_install_command) replace_in_file(dockerfile, "#BUILD_PLATFORM_APK__START", "#BUILD_PLATFORM_APK__END", apk_build_platform_install_command) + replace_in_file(dockerfile, "#NPM_APK__START", "#NPM_APK__END", apk_npm_install_command) # cargo packages cargo_install_command = "" # Pre-building packages diff --git a/megalinter/descriptors/scala.megalinter-descriptor.yml b/megalinter/descriptors/scala.megalinter-descriptor.yml index 9f71c920503..d6e287a0932 100644 --- a/megalinter/descriptors/scala.megalinter-descriptor.yml +++ b/megalinter/descriptors/scala.megalinter-descriptor.yml @@ -7,7 +7,7 @@ install: - openjdk11 build_platform_apk: - curl - - java + - openjdk11 build_platform_dockerfile: - | RUN curl --retry-all-errors --retry 10 -fLo coursier https://git.io/coursier-cli && \ From 8d8ab0cb20d6982a557c2b314f02b8e8ac74ae4f Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Thu, 13 Apr 2023 18:00:13 -0500 Subject: [PATCH 016/105] Fixing node_modules --- .automation/build.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.automation/build.py b/.automation/build.py index 6edb375e1b3..0f09ed27b88 100644 --- a/.automation/build.py +++ b/.automation/build.py @@ -306,6 +306,7 @@ def build_dockerfile( cargo_packages = [] if "cargo" not in extra_packages else extra_packages["cargo"] is_docker_other_run = False is_docker_build_platform_other_run = False + has_npm_copy = False # Manage docker if requires_docker is True: apk_packages += ["docker", "openrc"] @@ -470,6 +471,9 @@ def build_dockerfile( # Collect npm packages if "npm" in item["install"]: npm_packages += item["install"]["npm"] + if not has_npm_copy: + has_npm_copy = True + docker_copy += ["COPY --link --from=node_modules /node-deps /node-deps"] # Collect python for venvs if "linter_name" in item and "pip" in item["install"]: pipvenv_packages[item["linter_name"]] = item["install"]["pip"] From a571efa9acf226515c533c8dbedcd12e7b3671cb Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Tue, 18 Apr 2023 14:09:50 -0500 Subject: [PATCH 017/105] Fixing python --- .automation/build.py | 14 ++++++++++++++ .../descriptors/python.megalinter-descriptor.yml | 2 ++ .../repository.megalinter-descriptor.yml | 6 ++++++ 3 files changed, 22 insertions(+) diff --git a/.automation/build.py b/.automation/build.py index 0f09ed27b88..cdef186e9a5 100644 --- a/.automation/build.py +++ b/.automation/build.py @@ -307,6 +307,8 @@ def build_dockerfile( is_docker_other_run = False is_docker_build_platform_other_run = False has_npm_copy = False + venv_builddeps_command = [] + venv_apk_builddeps = ["gcc", "libffi-dev", "musl-dev", "make", "curl", "openssl-dev"] # Manage docker if requires_docker is True: apk_packages += ["docker", "openrc"] @@ -464,6 +466,10 @@ def build_dockerfile( # Collect apk packages if "apk" in item["install"]: apk_packages += item["install"]["apk"] + if "pip_apk" in item["install"]: + venv_apk_builddeps += item["install"]["pip_apk"] + if "pip_builddep" in item["install"]: + venv_builddeps_command += item["install"]["pip_builddep"] if "build_platform_apk" in item["install"]: apk_build_platform_packages += item["install"]["build_platform_apk"] if "npm_apk" in item["install"]: @@ -513,6 +519,11 @@ def build_dockerfile( "RUN apk add --update --no-cache \\\n " + " \\\n ".join(list(dict.fromkeys(apk_npm_packages))) ) + if len(venv_apk_builddeps) > 0: + venv_builddeps_command = [( + "RUN apk add --update --no-cache \\\n " + + " \\\n ".join(list(dict.fromkeys(venv_apk_builddeps))) + )] + venv_builddeps_command replace_in_file(dockerfile, "#APK__START", "#APK__END", apk_install_command) replace_in_file(dockerfile, "#BUILD_PLATFORM_APK__START", "#BUILD_PLATFORM_APK__END", apk_build_platform_install_command) replace_in_file(dockerfile, "#NPM_APK__START", "#NPM_APK__END", apk_npm_install_command) @@ -667,6 +678,9 @@ def build_dockerfile( replace_in_file( dockerfile, "#PIPVENV_DOWNLOAD__START", "#PIPVENV_DOWNLOAD__END", pipenv_download_command ) + replace_in_file( + dockerfile, "#PIPVENV_BUILDDEPS__START", "#PIPVENV_BUILDDEPS__END", "\\n".join(venv_builddeps_command) + ) replace_in_file( dockerfile, "#PIPVENV_PATH__START", "#PIPVENV_PATH__END", pipenv_path_command ) diff --git a/megalinter/descriptors/python.megalinter-descriptor.yml b/megalinter/descriptors/python.megalinter-descriptor.yml index 6f9ec7b1e63..27d83f705f9 100644 --- a/megalinter/descriptors/python.megalinter-descriptor.yml +++ b/megalinter/descriptors/python.megalinter-descriptor.yml @@ -397,6 +397,8 @@ linters: - "ruff check myfile.py" - "ruff check --config .ruff.toml myfile.py" install: + pip_builddep: + - ENV CFLAGS=-mno-outline-atomics pip: - ruff ide: diff --git a/megalinter/descriptors/repository.megalinter-descriptor.yml b/megalinter/descriptors/repository.megalinter-descriptor.yml index 91d05585902..c8421685f6d 100644 --- a/megalinter/descriptors/repository.megalinter-descriptor.yml +++ b/megalinter/descriptors/repository.megalinter-descriptor.yml @@ -37,6 +37,9 @@ linters: - "checkov --directory ." - "checkov --directory . --output --sarif" install: + pip_apk: + - g++ + - cmake pip: - packaging - checkov @@ -428,6 +431,9 @@ linters: - "semgrep /tmp/lint" - "semgrep " install: + pip_apk: + - g++ + - cmake pip: - semgrep variables: From 4e4577357adae5c2f03b656eb7b3c92290b76471 Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Tue, 18 Apr 2023 15:19:59 -0500 Subject: [PATCH 018/105] Split per platform logic --- .automation/build.py | 12 ++++++++++++ .../descriptors/python.megalinter-descriptor.yml | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.automation/build.py b/.automation/build.py index cdef186e9a5..f09f1e3da04 100644 --- a/.automation/build.py +++ b/.automation/build.py @@ -308,6 +308,8 @@ def build_dockerfile( is_docker_build_platform_other_run = False has_npm_copy = False venv_builddeps_command = [] + venv_builddeps_arm_command = [] + venv_builddeps_amd_command = [] venv_apk_builddeps = ["gcc", "libffi-dev", "musl-dev", "make", "curl", "openssl-dev"] # Manage docker if requires_docker is True: @@ -470,6 +472,10 @@ def build_dockerfile( venv_apk_builddeps += item["install"]["pip_apk"] if "pip_builddep" in item["install"]: venv_builddeps_command += item["install"]["pip_builddep"] + if "pip_builddep_arm" in item["install"]: + venv_builddeps_arm_command += item["install"]["pip_builddep_arm"] + if "pip_builddep_amd" in item["install"]: + venv_builddeps_amd_command += item["install"]["pip_builddep_amd"] if "build_platform_apk" in item["install"]: apk_build_platform_packages += item["install"]["build_platform_apk"] if "npm_apk" in item["install"]: @@ -681,6 +687,12 @@ def build_dockerfile( replace_in_file( dockerfile, "#PIPVENV_BUILDDEPS__START", "#PIPVENV_BUILDDEPS__END", "\\n".join(venv_builddeps_command) ) + replace_in_file( + dockerfile, "#PIPVENV_BUILDDEPS_AMD__START", "#PIPVENV_BUILDDEPS_AMD__END", "\\n".join(venv_builddeps_amd_command) + ) + replace_in_file( + dockerfile, "#PIPVENV_BUILDDEPS_ARM__START", "#PIPVENV_BUILDDEPS_ARM__END", "\\n".join(venv_builddeps_arm_command) + ) replace_in_file( dockerfile, "#PIPVENV_PATH__START", "#PIPVENV_PATH__END", pipenv_path_command ) diff --git a/megalinter/descriptors/python.megalinter-descriptor.yml b/megalinter/descriptors/python.megalinter-descriptor.yml index 27d83f705f9..84604af4c8f 100644 --- a/megalinter/descriptors/python.megalinter-descriptor.yml +++ b/megalinter/descriptors/python.megalinter-descriptor.yml @@ -397,7 +397,7 @@ linters: - "ruff check myfile.py" - "ruff check --config .ruff.toml myfile.py" install: - pip_builddep: + pip_builddep_arm: - ENV CFLAGS=-mno-outline-atomics pip: - ruff From 7c5a2202569245f64810689d40e8cc4b9d52f6b2 Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Tue, 18 Apr 2023 16:07:32 -0500 Subject: [PATCH 019/105] Tweaking Ruff --- .automation/build.py | 23 +++++++------------ .../python.megalinter-descriptor.yml | 3 +-- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/.automation/build.py b/.automation/build.py index f09f1e3da04..22abe76c8a5 100644 --- a/.automation/build.py +++ b/.automation/build.py @@ -308,8 +308,6 @@ def build_dockerfile( is_docker_build_platform_other_run = False has_npm_copy = False venv_builddeps_command = [] - venv_builddeps_arm_command = [] - venv_builddeps_amd_command = [] venv_apk_builddeps = ["gcc", "libffi-dev", "musl-dev", "make", "curl", "openssl-dev"] # Manage docker if requires_docker is True: @@ -472,10 +470,6 @@ def build_dockerfile( venv_apk_builddeps += item["install"]["pip_apk"] if "pip_builddep" in item["install"]: venv_builddeps_command += item["install"]["pip_builddep"] - if "pip_builddep_arm" in item["install"]: - venv_builddeps_arm_command += item["install"]["pip_builddep_arm"] - if "pip_builddep_amd" in item["install"]: - venv_builddeps_amd_command += item["install"]["pip_builddep_amd"] if "build_platform_apk" in item["install"]: apk_build_platform_packages += item["install"]["build_platform_apk"] if "npm_apk" in item["install"]: @@ -488,7 +482,10 @@ def build_dockerfile( docker_copy += ["COPY --link --from=node_modules /node-deps /node-deps"] # Collect python for venvs if "linter_name" in item and "pip" in item["install"]: - pipvenv_packages[item["linter_name"]] = item["install"]["pip"] + pipvenv_packages[item["linter_name"]] = { + "pip": item["install"]["pip"], + "env": item["install"]["pip_builddep_env"] if "pip_builddep_env" in item["install"] else "" + } # Collect python packages elif "pip" in item["install"]: pip_packages += item["install"]["pip"] @@ -648,7 +645,9 @@ def build_dockerfile( "RUN echo \\\n" ) pipenv_path_command = 'ENV PATH="${PATH}"' - for pip_linter, pip_linter_packages in pipvenv_packages.items(): + for pip_linter, data in pipvenv_packages.items(): + pip_linter_packages = data["pip"] + pip_linter_env = data["env"] pipenv_download_command += ( f' && mkdir -p "/download/{pip_linter}" ' + f'&& pip download -d "/download/{pip_linter}" ' @@ -660,7 +659,7 @@ def build_dockerfile( + f'&& cd "/venvs/{pip_linter}" ' + "&& python3 -m crossenv /usr/local/bin/target-python3 . " + "&& source bin/activate " - + f"&& PYTHONDONTWRITEBYTECODE=1 pip3 install --find-links /download/{pip_linter} --no-cache-dir " + + f"&& PYTHONDONTWRITEBYTECODE=1 {pip_linter_env} pip3 install --find-links /download/{pip_linter} --no-cache-dir " + (" ".join(pip_linter_packages)) + " " + "&& deactivate " @@ -687,12 +686,6 @@ def build_dockerfile( replace_in_file( dockerfile, "#PIPVENV_BUILDDEPS__START", "#PIPVENV_BUILDDEPS__END", "\\n".join(venv_builddeps_command) ) - replace_in_file( - dockerfile, "#PIPVENV_BUILDDEPS_AMD__START", "#PIPVENV_BUILDDEPS_AMD__END", "\\n".join(venv_builddeps_amd_command) - ) - replace_in_file( - dockerfile, "#PIPVENV_BUILDDEPS_ARM__START", "#PIPVENV_BUILDDEPS_ARM__END", "\\n".join(venv_builddeps_arm_command) - ) replace_in_file( dockerfile, "#PIPVENV_PATH__START", "#PIPVENV_PATH__END", pipenv_path_command ) diff --git a/megalinter/descriptors/python.megalinter-descriptor.yml b/megalinter/descriptors/python.megalinter-descriptor.yml index 84604af4c8f..ce033df2e19 100644 --- a/megalinter/descriptors/python.megalinter-descriptor.yml +++ b/megalinter/descriptors/python.megalinter-descriptor.yml @@ -397,8 +397,7 @@ linters: - "ruff check myfile.py" - "ruff check --config .ruff.toml myfile.py" install: - pip_builddep_arm: - - ENV CFLAGS=-mno-outline-atomics + pip_builddep_env: CFLAGS=-mno-outline-atomics pip: - ruff ide: From 1e337b09919bd2840afc36dfb18f03efabb73ef3 Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Tue, 18 Apr 2023 16:58:41 -0500 Subject: [PATCH 020/105] debugging --- megalinter/descriptors/python.megalinter-descriptor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/megalinter/descriptors/python.megalinter-descriptor.yml b/megalinter/descriptors/python.megalinter-descriptor.yml index ce033df2e19..308daf34500 100644 --- a/megalinter/descriptors/python.megalinter-descriptor.yml +++ b/megalinter/descriptors/python.megalinter-descriptor.yml @@ -397,7 +397,7 @@ linters: - "ruff check myfile.py" - "ruff check --config .ruff.toml myfile.py" install: - pip_builddep_env: CFLAGS=-mno-outline-atomics + #pip_builddep_env: CFLAGS=-mno-outline-atomics pip: - ruff ide: From c1ecf9efdb7e7293ad0a72858e76434289a00c89 Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Wed, 19 Apr 2023 09:28:23 -0500 Subject: [PATCH 021/105] Cleanup and debugging --- .github/workflows/deploy-DEV.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy-DEV.yml b/.github/workflows/deploy-DEV.yml index a623ca3bfd3..dc6a615f59a 100644 --- a/.github/workflows/deploy-DEV.yml +++ b/.github/workflows/deploy-DEV.yml @@ -146,7 +146,7 @@ jobs: with: context: . file: Dockerfile - platforms: linux/amd64,linux/arm64 + platforms: linux/amd64 #,linux/arm64 - Temp disabling this to see build times with amd64 build-args: | BUILD_DATE=${{ env.BUILD_DATE }} BUILD_REVISION=${{ github.sha }} From 82f2cd5b82ede8194ae88d016a8ec1169cca61dd Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Wed, 19 Apr 2023 10:57:55 -0500 Subject: [PATCH 022/105] Adding cache to pip, share the download dir to try to save on download time --- .automation/build.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.automation/build.py b/.automation/build.py index 22abe76c8a5..b757ac7ac03 100644 --- a/.automation/build.py +++ b/.automation/build.py @@ -638,19 +638,19 @@ def build_dockerfile( # Python packages in venv if len(pipvenv_packages.items()) > 0: pipenv_download_command = ( - "RUN PYTHONDONTWRITEBYTECODE=1 pip3 install" - " --no-cache-dir --upgrade pip crossenv \\\n" + "RUN mkdir /download \\\n" + " && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir --upgrade pip crossenv \\\n" ) pipenv_install_command = ( - "RUN echo \\\n" + "RUN --mount=type=cache,id=pip-${BUILDARCH},sharing=locked,target=/var/cache/pip,uid=65532 \\\n" + " echo \\\n" ) pipenv_path_command = 'ENV PATH="${PATH}"' for pip_linter, data in pipvenv_packages.items(): pip_linter_packages = data["pip"] pip_linter_env = data["env"] pipenv_download_command += ( - f' && mkdir -p "/download/{pip_linter}" ' - + f'&& pip download -d "/download/{pip_linter}" ' + '&& pip download -d "/download" ' + (" ".join(pip_linter_packages)) + " \\\n" ) @@ -659,7 +659,7 @@ def build_dockerfile( + f'&& cd "/venvs/{pip_linter}" ' + "&& python3 -m crossenv /usr/local/bin/target-python3 . " + "&& source bin/activate " - + f"&& PYTHONDONTWRITEBYTECODE=1 {pip_linter_env} pip3 install --find-links /download/{pip_linter} --no-cache-dir " + + f"&& PYTHONDONTWRITEBYTECODE=1 {pip_linter_env} pip3 install --find-links /download --cache-dir=/var/cache/pip " + (" ".join(pip_linter_packages)) + " " + "&& deactivate " From d9a20a255ce283febb10eb9b56d796abce44352e Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Wed, 19 Apr 2023 11:01:16 -0500 Subject: [PATCH 023/105] Bugfix --- .github/workflows/deploy-DEV.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy-DEV.yml b/.github/workflows/deploy-DEV.yml index dc6a615f59a..9a006d14733 100644 --- a/.github/workflows/deploy-DEV.yml +++ b/.github/workflows/deploy-DEV.yml @@ -162,7 +162,7 @@ jobs: - name: Load OCI shell: bash run: | - docker load --input /tmp/image.tar + cat /tmp/image.tar | docker load rm -f /tmp/image.tar #################################### From e85d55cc397c30573d218ca20985407570da96f1 Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Wed, 19 Apr 2023 12:12:27 -0500 Subject: [PATCH 024/105] Trying to make the download faster --- .automation/build.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.automation/build.py b/.automation/build.py index b757ac7ac03..3bee17f2eab 100644 --- a/.automation/build.py +++ b/.automation/build.py @@ -638,8 +638,9 @@ def build_dockerfile( # Python packages in venv if len(pipvenv_packages.items()) > 0: pipenv_download_command = ( - "RUN mkdir /download \\\n" - " && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir --upgrade pip crossenv \\\n" + "RUN --mount=type=cache,id=pip-download,sharing=locked,target=/var/cache/pip,uid=65532 \\\n" + " mkdir /download \\\n" + " && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip --upgrade pip crossenv \\\n" ) pipenv_install_command = ( "RUN --mount=type=cache,id=pip-${BUILDARCH},sharing=locked,target=/var/cache/pip,uid=65532 \\\n" @@ -650,7 +651,10 @@ def build_dockerfile( pip_linter_packages = data["pip"] pip_linter_env = data["env"] pipenv_download_command += ( - '&& pip download -d "/download" ' + '&& pip download --cache-dir=/var/cache/pip --platform=linux_x86_64 --dest "/download" ' + + (" ".join(pip_linter_packages)) + + " \\\n" + + '&& pip download --cache-dir=/var/cache/pip --platform=linux_aarch64 --dest "/download" ' + (" ".join(pip_linter_packages)) + " \\\n" ) @@ -659,7 +663,7 @@ def build_dockerfile( + f'&& cd "/venvs/{pip_linter}" ' + "&& python3 -m crossenv /usr/local/bin/target-python3 . " + "&& source bin/activate " - + f"&& PYTHONDONTWRITEBYTECODE=1 {pip_linter_env} pip3 install --find-links /download --cache-dir=/var/cache/pip " + + f"&& PYTHONDONTWRITEBYTECODE=1 {pip_linter_env} pip3 install --no-index --find-links=/download --cache-dir=/var/cache/pip " + (" ".join(pip_linter_packages)) + " " + "&& deactivate " From 7aba73e8497816478c7ea43da2b782b5e1004fce Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Wed, 19 Apr 2023 12:17:52 -0500 Subject: [PATCH 025/105] Trying to make the download faster --- .automation/build.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.automation/build.py b/.automation/build.py index 3bee17f2eab..764d89b50e3 100644 --- a/.automation/build.py +++ b/.automation/build.py @@ -638,12 +638,12 @@ def build_dockerfile( # Python packages in venv if len(pipvenv_packages.items()) > 0: pipenv_download_command = ( - "RUN --mount=type=cache,id=pip-download,sharing=locked,target=/var/cache/pip,uid=65532 \\\n" + "RUN --mount=type=cache,id=pip-download,sharing=locked,target=/var/cache/pip,uid=0 \\\n" " mkdir /download \\\n" " && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip --upgrade pip crossenv \\\n" ) pipenv_install_command = ( - "RUN --mount=type=cache,id=pip-${BUILDARCH},sharing=locked,target=/var/cache/pip,uid=65532 \\\n" + "RUN --mount=type=cache,id=pip-${BUILDARCH},sharing=locked,target=/var/cache/pip,uid=0 \\\n" " echo \\\n" ) pipenv_path_command = 'ENV PATH="${PATH}"' @@ -651,10 +651,13 @@ def build_dockerfile( pip_linter_packages = data["pip"] pip_linter_env = data["env"] pipenv_download_command += ( - '&& pip download --cache-dir=/var/cache/pip --platform=linux_x86_64 --dest "/download" ' + '&& pip download --cache-dir=/var/cache/pip --platform=linux_x86_64 --only-binary=:all: --dest "/download" ' + (" ".join(pip_linter_packages)) + " \\\n" - + '&& pip download --cache-dir=/var/cache/pip --platform=linux_aarch64 --dest "/download" ' + + '&& pip download --cache-dir=/var/cache/pip --platform=linux_aarch64 --only-binary=:all: --dest "/download" ' + + (" ".join(pip_linter_packages)) + + " \\\n" + + '&& pip download --cache-dir=/var/cache/pip --dest "/download" ' + (" ".join(pip_linter_packages)) + " \\\n" ) From cb42a56300c8eccf0acbe92427c9b7fe7f39c604 Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Wed, 19 Apr 2023 13:26:58 -0500 Subject: [PATCH 026/105] Tinkering with pip download --- .automation/build.py | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/.automation/build.py b/.automation/build.py index 764d89b50e3..13b615c4c27 100644 --- a/.automation/build.py +++ b/.automation/build.py @@ -637,6 +637,7 @@ def build_dockerfile( replace_in_file(dockerfile, "#PIP__START", "#PIP__END", pip_install_command) # Python packages in venv if len(pipvenv_packages.items()) > 0: + pipenv_download_list = [] pipenv_download_command = ( "RUN --mount=type=cache,id=pip-download,sharing=locked,target=/var/cache/pip,uid=0 \\\n" " mkdir /download \\\n" @@ -650,17 +651,7 @@ def build_dockerfile( for pip_linter, data in pipvenv_packages.items(): pip_linter_packages = data["pip"] pip_linter_env = data["env"] - pipenv_download_command += ( - '&& pip download --cache-dir=/var/cache/pip --platform=linux_x86_64 --only-binary=:all: --dest "/download" ' - + (" ".join(pip_linter_packages)) - + " \\\n" - + '&& pip download --cache-dir=/var/cache/pip --platform=linux_aarch64 --only-binary=:all: --dest "/download" ' - + (" ".join(pip_linter_packages)) - + " \\\n" - + '&& pip download --cache-dir=/var/cache/pip --dest "/download" ' - + (" ".join(pip_linter_packages)) - + " \\\n" - ) + pipenv_download_list += pip_linter_packages pipenv_install_command += ( f' && mkdir -p "/venvs/{pip_linter}" ' + f'&& cd "/venvs/{pip_linter}" ' @@ -673,6 +664,17 @@ def build_dockerfile( + "&& cd ./../.. \\\n" ) pipenv_path_command += f":/venvs/{pip_linter}/bin" + pipenv_download_command += ( + '&& pip download --cache-dir=/var/cache/pip --dest "/download" ' + + (" ".join(pipenv_download_list)) + + " \\\n" + + '&& pip download --cache-dir=/var/cache/pip --platform=linux_x86_64 --only-binary=:all: --dest "/download" ' + + (" ".join(pipenv_download_list)) + + " \\\n" + + '&& pip download --cache-dir=/var/cache/pip --platform=linux_aarch64 --only-binary=:all: --dest "/download" ' + + (" ".join(pipenv_download_list)) + + " \\\n" + ) pipenv_install_command = pipenv_install_command[:-2] # remove last \ pipenv_download_command = pipenv_download_command[:-2] # remove last \ pipenv_install_command += ( From 87239af090c92122e58f50f1a10f5fcfc408222f Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Wed, 19 Apr 2023 14:39:31 -0500 Subject: [PATCH 027/105] Adjusting pip download --- .automation/build.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/.automation/build.py b/.automation/build.py index 13b615c4c27..f0008524982 100644 --- a/.automation/build.py +++ b/.automation/build.py @@ -657,7 +657,7 @@ def build_dockerfile( + f'&& cd "/venvs/{pip_linter}" ' + "&& python3 -m crossenv /usr/local/bin/target-python3 . " + "&& source bin/activate " - + f"&& PYTHONDONTWRITEBYTECODE=1 {pip_linter_env} pip3 install --no-index --find-links=/download --cache-dir=/var/cache/pip " + + f"&& PYTHONDONTWRITEBYTECODE=1 {pip_linter_env} pip3 install --find-links=/download --cache-dir=/var/cache/pip " + (" ".join(pip_linter_packages)) + " " + "&& deactivate " @@ -667,13 +667,6 @@ def build_dockerfile( pipenv_download_command += ( '&& pip download --cache-dir=/var/cache/pip --dest "/download" ' + (" ".join(pipenv_download_list)) - + " \\\n" - + '&& pip download --cache-dir=/var/cache/pip --platform=linux_x86_64 --only-binary=:all: --dest "/download" ' - + (" ".join(pipenv_download_list)) - + " \\\n" - + '&& pip download --cache-dir=/var/cache/pip --platform=linux_aarch64 --only-binary=:all: --dest "/download" ' - + (" ".join(pipenv_download_list)) - + " \\\n" ) pipenv_install_command = pipenv_install_command[:-2] # remove last \ pipenv_download_command = pipenv_download_command[:-2] # remove last \ From 355355121be4653f8599a0a3ec136f81c892d388 Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Wed, 19 Apr 2023 15:08:38 -0500 Subject: [PATCH 028/105] Bugfix --- .automation/build.py | 5 +++-- megalinter/descriptors/yaml.megalinter-descriptor.yml | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.automation/build.py b/.automation/build.py index f0008524982..3984020c3e3 100644 --- a/.automation/build.py +++ b/.automation/build.py @@ -665,8 +665,9 @@ def build_dockerfile( ) pipenv_path_command += f":/venvs/{pip_linter}/bin" pipenv_download_command += ( - '&& pip download --cache-dir=/var/cache/pip --dest "/download" ' - + (" ".join(pipenv_download_list)) + '&& pip download --cache-dir=/var/cache/pip --dest "/download" \\\n ' + + ("\\\n ".join(pipenv_download_list)) + + " \\\n" ) pipenv_install_command = pipenv_install_command[:-2] # remove last \ pipenv_download_command = pipenv_download_command[:-2] # remove last \ diff --git a/megalinter/descriptors/yaml.megalinter-descriptor.yml b/megalinter/descriptors/yaml.megalinter-descriptor.yml index 279b4ccc395..ee88cb22f59 100644 --- a/megalinter/descriptors/yaml.megalinter-descriptor.yml +++ b/megalinter/descriptors/yaml.megalinter-descriptor.yml @@ -82,7 +82,7 @@ linters: - "yamllint -c .yamllint.yml myfile.yaml" install: pip: - - yamllint + - yamllint supported_platforms: platform: - linux/amd64 From 8fc4d8202b209ba5b401a3395ab3c9c274ee08ff Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Wed, 19 Apr 2023 15:09:47 -0500 Subject: [PATCH 029/105] Made the dockerfules look cleaner --- .automation/build.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.automation/build.py b/.automation/build.py index 3984020c3e3..7930fbbc7c5 100644 --- a/.automation/build.py +++ b/.automation/build.py @@ -666,7 +666,7 @@ def build_dockerfile( pipenv_path_command += f":/venvs/{pip_linter}/bin" pipenv_download_command += ( '&& pip download --cache-dir=/var/cache/pip --dest "/download" \\\n ' - + ("\\\n ".join(pipenv_download_list)) + + (" \\\n ".join(pipenv_download_list)) + " \\\n" ) pipenv_install_command = pipenv_install_command[:-2] # remove last \ From 2fc298a556b5af72a1d12aeb3cb987a3fa3b3957 Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Wed, 19 Apr 2023 16:47:39 -0500 Subject: [PATCH 030/105] Broke up the pip installs --- .automation/build.py | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/.automation/build.py b/.automation/build.py index 7930fbbc7c5..041267f4c77 100644 --- a/.automation/build.py +++ b/.automation/build.py @@ -627,8 +627,8 @@ def build_dockerfile( pip_install_command = "" if len(pip_packages) > 0: pip_install_command = ( - "RUN PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir --upgrade pip &&" - + " PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir --upgrade \\\n '" + "RUN PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --no-cache-dir --upgrade pip &&" + + " PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --no-cache-dir --upgrade \\\n '" + "' \\\n '".join(list(dict.fromkeys(pip_packages))) + "' && \\\n" + 'find . | grep -E "(/__pycache__$|\\.pyc$|\\.pyo$)" | xargs rm -rf && \\\n' @@ -639,29 +639,23 @@ def build_dockerfile( if len(pipvenv_packages.items()) > 0: pipenv_download_list = [] pipenv_download_command = ( - "RUN --mount=type=cache,id=pip-download,sharing=locked,target=/var/cache/pip,uid=0 \\\n" + "RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \\\n" " mkdir /download \\\n" - " && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip --upgrade pip crossenv \\\n" - ) - pipenv_install_command = ( - "RUN --mount=type=cache,id=pip-${BUILDARCH},sharing=locked,target=/var/cache/pip,uid=0 \\\n" - " echo \\\n" + " && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \\\n" ) + pipenv_install_command = "" pipenv_path_command = 'ENV PATH="${PATH}"' for pip_linter, data in pipvenv_packages.items(): pip_linter_packages = data["pip"] pip_linter_env = data["env"] pipenv_download_list += pip_linter_packages pipenv_install_command += ( - f' && mkdir -p "/venvs/{pip_linter}" ' + f'RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \\\n mkdir -p "/venvs/{pip_linter}" ' + f'&& cd "/venvs/{pip_linter}" ' + "&& python3 -m crossenv /usr/local/bin/target-python3 . " + "&& source bin/activate " - + f"&& PYTHONDONTWRITEBYTECODE=1 {pip_linter_env} pip3 install --find-links=/download --cache-dir=/var/cache/pip " + + f"&& PYTHONDONTWRITEBYTECODE=1 {pip_linter_env} pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip " + (" ".join(pip_linter_packages)) - + " " - + "&& deactivate " - + "&& cd ./../.. \\\n" ) pipenv_path_command += f":/venvs/{pip_linter}/bin" pipenv_download_command += ( @@ -671,10 +665,6 @@ def build_dockerfile( ) pipenv_install_command = pipenv_install_command[:-2] # remove last \ pipenv_download_command = pipenv_download_command[:-2] # remove last \ - pipenv_install_command += ( - ' \\\n && find . | grep -E "(/__pycache__$|\\.pyc$|\\.pyo$)" | xargs rm -rf ' - + "&& rm -rf /root/.cache\n" - ) pipenv_download_command += "\n" else: pipenv_install_command = "" From 591c9290fcec073ece0d37103006881a51a8019d Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Wed, 19 Apr 2023 17:10:07 -0500 Subject: [PATCH 031/105] Fix pip, add cargo binstall --- .automation/build.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.automation/build.py b/.automation/build.py index 041267f4c77..ee2fabc37fd 100644 --- a/.automation/build.py +++ b/.automation/build.py @@ -549,8 +549,13 @@ def build_dockerfile( + " git \\\n" + " musl-dev \\\n" + " llvm \\\n" - + " clang\n" - + "RUN chown 63425:63425 /cargo\n" + + " clang \\\n" + + " curl \\\n" + + 'RUN curl https://github.com/cargo-bins/cargo-binstall/releases/download/v0.22.0/cargo-binstall-$([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64" || echo "aarch64")-unknown-linux-musl.tgz -O - | tar -xvf \\\n' + + " && mkdir -p /cargo/.cargo/bin \\\n" + + " && mv cargo-binstall /cargo/.cargo/bin \\\n" + + " && chown -R 63425:63425 /cargo \\\n" + + " && chown 63425:63425 /cargo\n" + "USER 63425\n" + "ENV CC_aarch64_unknown_linux_musl=clang \\\n" + " AR_aarch64_unknown_linux_musl=llvm-ar \\\n" @@ -656,6 +661,7 @@ def build_dockerfile( + "&& source bin/activate " + f"&& PYTHONDONTWRITEBYTECODE=1 {pip_linter_env} pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip " + (" ".join(pip_linter_packages)) + + "\\n" ) pipenv_path_command += f":/venvs/{pip_linter}/bin" pipenv_download_command += ( @@ -663,7 +669,6 @@ def build_dockerfile( + (" \\\n ".join(pipenv_download_list)) + " \\\n" ) - pipenv_install_command = pipenv_install_command[:-2] # remove last \ pipenv_download_command = pipenv_download_command[:-2] # remove last \ pipenv_download_command += "\n" else: From 53e55fbe9cf5108a654d7e1fb00037f9dc16a4f1 Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Wed, 19 Apr 2023 17:12:15 -0500 Subject: [PATCH 032/105] Bugfix --- .automation/build.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.automation/build.py b/.automation/build.py index ee2fabc37fd..1b33855a3a8 100644 --- a/.automation/build.py +++ b/.automation/build.py @@ -550,12 +550,11 @@ def build_dockerfile( + " musl-dev \\\n" + " llvm \\\n" + " clang \\\n" - + " curl \\\n" + + " curl \n" + 'RUN curl https://github.com/cargo-bins/cargo-binstall/releases/download/v0.22.0/cargo-binstall-$([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64" || echo "aarch64")-unknown-linux-musl.tgz -O - | tar -xvf \\\n' + " && mkdir -p /cargo/.cargo/bin \\\n" + " && mv cargo-binstall /cargo/.cargo/bin \\\n" - + " && chown -R 63425:63425 /cargo \\\n" - + " && chown 63425:63425 /cargo\n" + + " && chown -R 63425:63425 /cargo \n" + "USER 63425\n" + "ENV CC_aarch64_unknown_linux_musl=clang \\\n" + " AR_aarch64_unknown_linux_musl=llvm-ar \\\n" From 18c062ee3a8b0b7ae76e922d73e215e64ec7babc Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Wed, 19 Apr 2023 17:16:26 -0500 Subject: [PATCH 033/105] Bugfix --- .automation/build.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.automation/build.py b/.automation/build.py index 1b33855a3a8..03091838efa 100644 --- a/.automation/build.py +++ b/.automation/build.py @@ -551,7 +551,7 @@ def build_dockerfile( + " llvm \\\n" + " clang \\\n" + " curl \n" - + 'RUN curl https://github.com/cargo-bins/cargo-binstall/releases/download/v0.22.0/cargo-binstall-$([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64" || echo "aarch64")-unknown-linux-musl.tgz -O - | tar -xvf \\\n' + + 'RUN curl --location "https://github.com/cargo-bins/cargo-binstall/releases/latest/download/cargo-binstall-$([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64" || echo "aarch64")-unknown-linux-musl.tgz" | tar -xzv \\\n' + " && mkdir -p /cargo/.cargo/bin \\\n" + " && mv cargo-binstall /cargo/.cargo/bin \\\n" + " && chown -R 63425:63425 /cargo \n" From c85a6600eee5016e6d1083173b265adae73cb786 Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Thu, 20 Apr 2023 08:48:08 -0500 Subject: [PATCH 034/105] Switch to cargo binstall --- .automation/build.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.automation/build.py b/.automation/build.py index 03091838efa..e4f5af5003e 100644 --- a/.automation/build.py +++ b/.automation/build.py @@ -567,7 +567,7 @@ def build_dockerfile( + "\n" + "RUN --mount=type=cache,id=cargo-${TARGETARCH},sharing=locked,target=/cargo/.cargo/registry/,uid=63425 \\\n" + " . /cargo/.cargo/env \\\n" - + f' && cargo install {" ".join(prebuild_list)} --root /tmp --target $([[ "${{TARGETARCH}}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") \n' + + f' && cargo binstall {" ".join(prebuild_list)} --root /tmp --target $([[ "${{TARGETARCH}}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") \n' + "\n" + "FROM scratch AS cargo\n" + "COPY --link --from=cargo-build /tmp/bin/* /bin/\n" From 538fee8a349c474ea841ff19d3211f82636673a1 Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Thu, 20 Apr 2023 09:32:08 -0500 Subject: [PATCH 035/105] Bugfix, move ruff to download of binary --- .automation/build.py | 4 ++-- .../descriptors/python.megalinter-descriptor.yml | 13 ++++++++++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/.automation/build.py b/.automation/build.py index e4f5af5003e..a24bf2872fc 100644 --- a/.automation/build.py +++ b/.automation/build.py @@ -533,7 +533,7 @@ def build_dockerfile( # cargo packages cargo_install_command = "" # Pre-building packages - prebuild_list = set(cargo_packages) & {"shellcheck-sarif", "sarif-fmt"} + prebuild_list = set(cargo_packages) & {"shellcheck-sarif", "sarif-fmt", "ruff"} cargo_packages = set(cargo_packages) - prebuild_list if len(prebuild_list) > 0: docker_from += [ @@ -567,7 +567,7 @@ def build_dockerfile( + "\n" + "RUN --mount=type=cache,id=cargo-${TARGETARCH},sharing=locked,target=/cargo/.cargo/registry/,uid=63425 \\\n" + " . /cargo/.cargo/env \\\n" - + f' && cargo binstall {" ".join(prebuild_list)} --root /tmp --target $([[ "${{TARGETARCH}}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") \n' + + f' && cargo binstall --no-confirm --no-symlinks {" ".join(prebuild_list)} --root /tmp --target $([[ "${{TARGETARCH}}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") \n' + "\n" + "FROM scratch AS cargo\n" + "COPY --link --from=cargo-build /tmp/bin/* /bin/\n" diff --git a/megalinter/descriptors/python.megalinter-descriptor.yml b/megalinter/descriptors/python.megalinter-descriptor.yml index 308daf34500..dd6eb1b6d1c 100644 --- a/megalinter/descriptors/python.megalinter-descriptor.yml +++ b/megalinter/descriptors/python.megalinter-descriptor.yml @@ -397,9 +397,16 @@ linters: - "ruff check myfile.py" - "ruff check --config .ruff.toml myfile.py" install: - #pip_builddep_env: CFLAGS=-mno-outline-atomics - pip: - - ruff + dockerfile: + - |- + FROM --platform=$BUILDPLATFORM alpine:3 AS fetch-ruff + ARG BUILDARCH + RUN --mount=type=cache,target=/var/cache/apk,id=apk-${BUILDARCH},sharing=locked \ + apk add --update curl + WORKDIR / + ARG TARGETARCH + RUN curl --location "https://github.com/charliermarsh/ruff/releases/latest/download/ruff-$([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64" || echo "aarch64")-unknown-linux-musl.tgz" | tar -xzv + - COPY --link --from=fetch-ruff /ruff /usr/bin/ruff ide: idea: - name: Ruff From 71cad601dc96cedd5d309b772f166bbb3fd6a81f Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Thu, 20 Apr 2023 09:38:37 -0500 Subject: [PATCH 036/105] Bugfix, add log parser script --- .automation/build.py | 4 ++-- parseLog | 25 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) create mode 100755 parseLog diff --git a/.automation/build.py b/.automation/build.py index a24bf2872fc..e72f63db8fc 100644 --- a/.automation/build.py +++ b/.automation/build.py @@ -533,9 +533,9 @@ def build_dockerfile( # cargo packages cargo_install_command = "" # Pre-building packages - prebuild_list = set(cargo_packages) & {"shellcheck-sarif", "sarif-fmt", "ruff"} + prebuild_list = set(cargo_packages) & {"shellcheck-sarif", "sarif-fmt"} cargo_packages = set(cargo_packages) - prebuild_list - if len(prebuild_list) > 0: + if len(cargo_packages) > 0: docker_from += [ "FROM --platform=$BUILDPLATFORM alpine:3 AS cargo-build\n" + "WORKDIR /cargo\n" diff --git a/parseLog b/parseLog new file mode 100755 index 00000000000..43c0b644d27 --- /dev/null +++ b/parseLog @@ -0,0 +1,25 @@ +#!/usr/bin/env bash +# This script will parse the github actions log to tell you where time is being spent +# To use it: +# 1. Go to a job +# 2. Click the gear +# 3. Then click "Download log archive" +# 4. Extract the archive +# 5. Run ./parseLog path/to/buildkitOutput.log +# You will then have a csv file containing some basic information about each stage, when it ran, and how long it ran +file=$(cat "$1") +timeStamps="$(echo "$file" | grep -o '[^ ]*Z #[0-9]*')" +jobIds=$(echo "$timeStamps" | grep -o '#[0-9]*' | sort | uniq) +data="Job Id,Label,Start,End,Length" + +for f in $jobIds; do + jobTimestamps=$(echo "$timeStamps" | grep "$f$" | grep -o "^[^ ]*") + start=$(echo "$jobTimestamps" | head -n 1) + end=$(echo "$jobTimestamps" | tail -n 1) + length=$(echo "$file" | grep "$f DONE" | grep -o "[0-9.]*s$" | grep -o "[0-9.]*") + label=$(echo "$file" | grep -o -e "Z $f \[[^]]*\]" | grep -o -e "\[[^]]*\]" | grep -o -e "[^][]*") + data="${data} +${f},${label},${start},${end},${length}" +done + +echo "${data}" From f198ad6cdab3956b92446f53f8319087da1e61f7 Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Thu, 20 Apr 2023 09:56:23 -0500 Subject: [PATCH 037/105] Debugging --- megalinter/descriptors/python.megalinter-descriptor.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/megalinter/descriptors/python.megalinter-descriptor.yml b/megalinter/descriptors/python.megalinter-descriptor.yml index dd6eb1b6d1c..0b483ae61f4 100644 --- a/megalinter/descriptors/python.megalinter-descriptor.yml +++ b/megalinter/descriptors/python.megalinter-descriptor.yml @@ -405,7 +405,9 @@ linters: apk add --update curl WORKDIR / ARG TARGETARCH - RUN curl --location "https://github.com/charliermarsh/ruff/releases/latest/download/ruff-$([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64" || echo "aarch64")-unknown-linux-musl.tgz" | tar -xzv + RUN export DL_LOCATION="https://github.com/charliermarsh/ruff/releases/latest/download/ruff-$([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64" || echo "aarch64")-unknown-linux-musl.tgz" \ + && echo "Downloading from ${DL_LOCATION}" \ + && curl --location "${DL_LOCATION}" | tar -xzv - COPY --link --from=fetch-ruff /ruff /usr/bin/ruff ide: idea: From 12a7e3e6f685186fb8cd423df6ee64e69327316f Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Thu, 20 Apr 2023 10:01:35 -0500 Subject: [PATCH 038/105] Debugging --- megalinter/descriptors/python.megalinter-descriptor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/megalinter/descriptors/python.megalinter-descriptor.yml b/megalinter/descriptors/python.megalinter-descriptor.yml index 0b483ae61f4..b047466c358 100644 --- a/megalinter/descriptors/python.megalinter-descriptor.yml +++ b/megalinter/descriptors/python.megalinter-descriptor.yml @@ -405,7 +405,7 @@ linters: apk add --update curl WORKDIR / ARG TARGETARCH - RUN export DL_LOCATION="https://github.com/charliermarsh/ruff/releases/latest/download/ruff-$([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64" || echo "aarch64")-unknown-linux-musl.tgz" \ + RUN export DL_LOCATION="https://github.com/charliermarsh/ruff/releases/latest/download/ruff-$([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64" || echo "aarch64")-unknown-linux-musl.tar.gz" \ && echo "Downloading from ${DL_LOCATION}" \ && curl --location "${DL_LOCATION}" | tar -xzv - COPY --link --from=fetch-ruff /ruff /usr/bin/ruff From a0b06d6393c092e30dff55287d6d7b0268014d6e Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Thu, 20 Apr 2023 11:58:13 -0500 Subject: [PATCH 039/105] Add arm64 --- .github/workflows/deploy-DEV.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-DEV.yml b/.github/workflows/deploy-DEV.yml index 9a006d14733..694ec3c1702 100644 --- a/.github/workflows/deploy-DEV.yml +++ b/.github/workflows/deploy-DEV.yml @@ -146,7 +146,7 @@ jobs: with: context: . file: Dockerfile - platforms: linux/amd64 #,linux/arm64 - Temp disabling this to see build times with amd64 + platforms: linux/amd64,linux/arm64 build-args: | BUILD_DATE=${{ env.BUILD_DATE }} BUILD_REVISION=${{ github.sha }} @@ -158,7 +158,7 @@ jobs: tags: | oxsecurity/megalinter:${{ steps.image_tag.outputs.tag }} outputs: type=oci,dest=/tmp/image.tar - timeout-minutes: 90 + timeout-minutes: 360 #90 - Temp increasing this to see how long it takes - name: Load OCI shell: bash run: | From 1bfb687378690c339000c19136fbc9c0f5e38544 Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Thu, 20 Apr 2023 12:36:26 -0500 Subject: [PATCH 040/105] Starting refactor to make multiarch testing easier --- .github/workflows/-build-docker.yml | 130 +++++++++ .github/workflows/deploy-ALPHA-flavors.yml | 76 +---- .github/workflows/deploy-DEV.yml | 306 +++++++-------------- 3 files changed, 237 insertions(+), 275 deletions(-) create mode 100644 .github/workflows/-build-docker.yml diff --git a/.github/workflows/-build-docker.yml b/.github/workflows/-build-docker.yml new file mode 100644 index 00000000000..b107386591e --- /dev/null +++ b/.github/workflows/-build-docker.yml @@ -0,0 +1,130 @@ +on: + workflow_call: + inputs: + tagTemplate: + required: true + type: string + shouldLoginDockerHub: + required: true + type: boolean + shouldLoginGithub: + required: true + type: boolean + dockerfile: + required: true + type: string + load: + required: true + type: boolean + push: + required: true + type: boolean + imageName: + required: true + type: string + workerImageName: + required: true + type: string + +jobs: + build: + name: Build Docker + runs-on: ubuntu-latest + timeout-minutes: 120 + steps: + - name: Checkout Code + uses: actions/checkout@v3 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Get current date + run: echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >>"$GITHUB_ENV" + + - name: Build image tag name + id: image_tag + run: | + BRANCH_NAME="${GITHUB_REF##*/}" + TAG="${{ inputs.tagTemplate }}" + echo "Tag name: ${TAG}" + echo "tag=${TAG}" >>"$GITHUB_OUTPUT" + + - name: Login to Docker Hub + if: ${{ inputs.shouldLoginDockerHub }} + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Login to GitHub Container Registry + if: ${{ inputs.shouldLoginGithub }} + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build Image + uses: docker/build-push-action@v4 + with: + file: ${{ inputs.dockerfile }} + platforms: linux/amd64,linux/arm64 + build-args: | + BUILD_DATE=${{ env.BUILD_DATE }} + BUILD_REVISION=${{ github.sha }} + BUILD_VERSION=alpha + load: ${{ inputs.load }} + push: ${{ inputs.push }} + outputs: type=oci,dest=image.tar + + secrets: | + GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} + tags: ${{ + ( + inputs.shouldLoginGithub && inputs.shouldLoginDockerHub + 'oxsecurity/${{ input.imageName }}:${{ steps.image_tag.outputs.tag }} ghcr.io/oxsecurity/${{ input.imageName }}:${{ steps.image_tag.outputs.tag }}' + ) || ( + inputs.shouldLoginGithub && 'oxsecurity/${{ input.imageName }}:${{ steps.image_tag.outputs.tag }}' + ) || ( + inputs.shouldLoginDockerHub && 'ghcr.io/oxsecurity/${{ input.imageName }}:${{ steps.image_tag.outputs.tag }}'' + ) || '' + }} + timeout-minutes: 360 #90 - Temp increasing this to see how long it takes + + - name: Build Worker Image + uses: docker/build-push-action@v4 + with: + context: . + file: Dockerfile-worker + platforms: linux/amd64 + build-args: | + MEGALINTER_BASE_IMAGE=ghcr.io/oxsecurity/megalinter-${{ matrix.flavor }}:alpha + BUILD_DATE=${{ env.BUILD_DATE }} + BUILD_REVISION=${{ github.sha }} + BUILD_VERSION=alpha + load: false + push: true + + secrets: | + GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} + tags: ${{ + ( + inputs.shouldLoginGithub && inputs.shouldLoginDockerHub + 'oxsecurity/${{ input.workerImageName }}:${{ steps.image_tag.outputs.tag }} ghcr.io/oxsecurity/${{ input.workerImageName }}:${{ steps.image_tag.outputs.tag }}' + ) || ( + inputs.shouldLoginGithub && 'oxsecurity/${{ input.workerImageName }}:${{ steps.image_tag.outputs.tag }}' + ) || ( + inputs.shouldLoginDockerHub && 'ghcr.io/oxsecurity/${{ input.workerImageName }}:${{ steps.image_tag.outputs.tag }}'' + ) || '' + }} + + + - name: Archive oci artifacts + uses: actions/upload-artifact@v3 + with: + name: oci-tar + path: image.tar + diff --git a/.github/workflows/deploy-ALPHA-flavors.yml b/.github/workflows/deploy-ALPHA-flavors.yml index bb8cba75135..0299b00b56f 100644 --- a/.github/workflows/deploy-ALPHA-flavors.yml +++ b/.github/workflows/deploy-ALPHA-flavors.yml @@ -42,15 +42,23 @@ jobs: build: # Name the Job name: Deploy Docker Image - ALPHA - Flavors - # Set the agent to run on - runs-on: ${{ matrix.os }} permissions: packages: write + # Only run this on the main repo + if: github.repository == 'oxsecurity/megalinter' && !contains(github.event.head_commit.message, 'skip deploy') + uses: -build-docker.yml + with: + tagTemplate: "alpha" + shouldLoginDockerHub: false + shouldLoginGithub: true + dockerfile: flavors/${{ matrix.flavor }}/Dockerfile + push: true + imageName: megalinter-${{ matrix.flavor }} + workerImageName: megalinter-worker-${{ matrix.flavor }} strategy: fail-fast: false max-parallel: 10 matrix: - os: [ubuntu-latest] # flavors-start flavor: [ @@ -70,69 +78,11 @@ jobs: "swift", "terraform", ] -# flavors-end - # Only run this on the main repo - if: github.repository == 'oxsecurity/megalinter' && !contains(github.event.head_commit.message, 'skip deploy') + # flavors-end ################## # Load all steps # ################## steps: - ########################## - # Checkout the code base # - ########################## - - name: Checkout Code - uses: actions/checkout@v3 - - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - - name: Login to GitHub Container Registry - uses: docker/login-action@v2 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Get current date - run: echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> ${GITHUB_ENV} - - - name: Build Image - uses: docker/build-push-action@v4 - with: - context: . - file: flavors/${{ matrix.flavor }}/Dockerfile - platforms: linux/amd64,linux/arm64 - build-args: | - BUILD_DATE=${{ env.BUILD_DATE }} - BUILD_REVISION=${{ github.sha }} - BUILD_VERSION=alpha - load: false - push: true - secrets: | - GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} - tags: | - ghcr.io/oxsecurity/megalinter-${{ matrix.flavor }}:alpha - - - name: Build Worker Image - uses: docker/build-push-action@v4 - with: - context: . - file: Dockerfile-worker - platforms: linux/amd64 - build-args: | - MEGALINTER_BASE_IMAGE=ghcr.io/oxsecurity/megalinter-${{ matrix.flavor }}:alpha - BUILD_DATE=${{ env.BUILD_DATE }} - BUILD_REVISION=${{ github.sha }} - BUILD_VERSION=alpha - load: false - push: true - secrets: | - GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} - tags: | - ghcr.io/oxsecurity/megalinter-worker-${{ matrix.flavor }}:alpha ############################################## # Check Docker image security with Trivy # @@ -140,7 +90,7 @@ jobs: - name: Run Trivy vulnerability scanner uses: aquasecurity/trivy-action@master with: - image-ref: 'ghcr.io/oxsecurity/megalinter-worker-${{ matrix.flavor }}:alpha' + image-ref: 'docker.io/oxsecurity/megalinter-${{ matrix.flavor }}:alpha' format: 'table' exit-code: '1' ignore-unfixed: true diff --git a/.github/workflows/deploy-DEV.yml b/.github/workflows/deploy-DEV.yml index 694ec3c1702..cdcf52903fb 100644 --- a/.github/workflows/deploy-DEV.yml +++ b/.github/workflows/deploy-DEV.yml @@ -46,226 +46,108 @@ concurrency: cancel-in-progress: true jobs: - build: - # Name the Job name: Tests + Deploy Docker Image - DEV - # Set the agent to run on - runs-on: ubuntu-latest - permissions: read-all # Prevent duplicate run from happening when a forked push is committed if: (github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository) && !contains(github.event.head_commit.message, 'skip deploy') - # Set max build time for the job - timeout-minutes: 120 - ################## - # Load all steps # - ################## - steps: - ########################## - # Checkout the code base # - ########################## - - name: Checkout Code - uses: actions/checkout@v3 - - ####################### - # Docker Buildx setup # - ####################### - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - ######################## - # Get the current date # - ######################## - - name: Get current date - run: echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >>"$GITHUB_ENV" - - ######################## - # Build image tag name # - ######################## - - name: Build image tag name - id: image_tag - run: | - BRANCH_NAME="${GITHUB_REF##*/}" - TAG="test-${{ github.actor }}-${BRANCH_NAME}" - echo "Tag name: ${TAG}" - echo "tag=${TAG}" >>"$GITHUB_OUTPUT" - - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - # Free disk space - - name: Free Disk space - shell: bash - run: | - sudo rm -rf /usr/local/lib/android # will release about 10 GB if you don't need Android - sudo rm -rf /usr/share/dotnet # will release about 20GB if you don't need .NET - - ################################### - # Build image locally for testing # - ################################### - - name: Build MegaLinter Docker Image (quick) - if: "contains(github.event.head_commit.message, 'quick build')" - id: docker_build_quick - uses: docker/build-push-action@v4 - with: - context: . - file: Dockerfile-quick - platforms: linux/amd64,linux/arm64 - build-args: | - BUILD_DATE=${{ env.BUILD_DATE }} - BUILD_REVISION=${{ github.sha }} - BUILD_VERSION=${{ steps.image_tag.outputs.tag }} - MEGA_LINTER_BASE_IMAGE="oxsecurity/megalinter:beta" - load: true - push: false - secrets: | - GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} - tags: | - oxsecurity/megalinter:${{ steps.image_tag.outputs.tag }} - timeout-minutes: 90 - - ####################################### - # Build image (full for forked repos) # - ####################################### - - name: Build MegaLinter Docker Image (full from forks) - if: | + uses: -build-docker.yml + with: + tagTemplate: "test-${{ github.actor }}-${BRANCH_NAME}" + shouldLoginDockerHub: | + ( + (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) || + (github.event_name == 'push' && github.repository == 'oxsecurity/megalinter') + ) + shouldLoginGithub: false + dockerfile: ${{ (contains(github.event.head_commit.message, 'quick build') && 'Dockerfile-quick') || 'Dockerfile' }} + push: false + load: ${{ !( ( (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository) || (github.event_name == 'push' && github.repository != 'oxsecurity/megalinter') ) && !contains(github.event.head_commit.message, 'quick build') - id: docker_build - uses: docker/build-push-action@v4 - with: - context: . - file: Dockerfile - platforms: linux/amd64,linux/arm64 - build-args: | - BUILD_DATE=${{ env.BUILD_DATE }} - BUILD_REVISION=${{ github.sha }} - BUILD_VERSION=${{ steps.image_tag.outputs.tag }} - load: false - push: false - secrets: | - GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} - tags: | - oxsecurity/megalinter:${{ steps.image_tag.outputs.tag }} - outputs: type=oci,dest=/tmp/image.tar - timeout-minutes: 360 #90 - Temp increasing this to see how long it takes - - name: Load OCI - shell: bash - run: | - cat /tmp/image.tar | docker load - rm -f /tmp/image.tar - - #################################### - # Build image (full for main repo) # - #################################### - - name: Build MegaLinter Docker Image (full from main repo) & push - if: | - ( - (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) || - (github.event_name == 'push' && github.repository == 'oxsecurity/megalinter') - ) - && - !contains(github.event.head_commit.message, 'quick build') - uses: docker/build-push-action@v4 - with: - context: . - file: Dockerfile - platforms: linux/amd64,linux/arm64 - build-args: | - BUILD_DATE=${{ env.BUILD_DATE }} - BUILD_REVISION=${{ github.sha }} - BUILD_VERSION=${{ steps.image_tag.outputs.tag }} - load: true - push: false - secrets: | - GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} - tags: | - oxsecurity/megalinter:${{ steps.image_tag.outputs.tag }} - - ##################################### - # Run Linter test cases # - ##################################### - - name: Run Test Cases - shell: bash - run: | - GITHUB_REPOSITORY=$([ "${{ github.event_name }}" == "pull_request" ] && echo "${{ github.event.pull_request.head.repo.full_name }}" || echo "${{ github.repository }}") - GITHUB_BRANCH=$([ "${{ github.event_name }}" == "pull_request" ] && echo "${{ github.head_ref }}" || echo "${{ github.ref_name }}") - - export CI_ENV="$(bash <(curl -s https://codecov.io/env)) -e GITHUB_ACTIONS" - TEST_KEYWORDS_TO_USE="" - if [[ "${{ github.event.head_commit.message }}" == *"TEST_KEYWORDS="* ]]; then - COMMIT_MSG="${{ github.event.head_commit.message }}" - TEST_KEYWORDS_TO_USE=${COMMIT_MSG#*TEST_KEYWORDS=} - echo "Run only tests with keywords ${TEST_KEYWORDS_TO_USE}" - if [[ "${TEST_KEYWORDS_TO_USE}" =~ $'\r' ]]; then - echo "Problem while parsing test keywords: switch back to all tests" - TEST_KEYWORDS_TO_USE="" - fi - fi - docker image ls - docker run $CI_ENV -e TEST_CASE_RUN=true -e OUTPUT_FORMAT=text -e OUTPUT_FOLDER=${{ github.sha }} -e OUTPUT_DETAIL=detailed -e GITHUB_SHA=${{ github.sha }} -e GITHUB_REPOSITORY=${GITHUB_REPOSITORY} -e GITHUB_BRANCH=${GITHUB_BRANCH} -e GITHUB_TOKEN="${{ secrets.GITHUB_TOKEN }}" -e TEST_KEYWORDS="${TEST_KEYWORDS_TO_USE}" -e MEGALINTER_VOLUME_ROOT="${GITHUB_WORKSPACE}" -v "/var/run/docker.sock:/var/run/docker.sock:rw" -v ${GITHUB_WORKSPACE}:/tmp/lint oxsecurity/megalinter:${{ steps.image_tag.outputs.tag }} - timeout-minutes: 90 - - ##################################### - # Run Linter against ALL code base # - ##################################### - - name: Run against all code base - if: "!contains(github.event.head_commit.message, 'quick build')" - shell: bash - run: docker run -e GITHUB_REPOSITORY="${{ github.repository }}" -e GITHUB_SHA="${{ github.sha }}" -e GITHUB_TOKEN="${{ github.token }}" -e GITHUB_RUN_ID="${{ github.run_id }}" -e GITHUB_TOKEN="${{ secrets.GITHUB_TOKEN }}" -v "/var/run/docker.sock:/var/run/docker.sock:rw" -v ${GITHUB_WORKSPACE}:/tmp/lint oxsecurity/megalinter:${{ steps.image_tag.outputs.tag }} - timeout-minutes: 15 - - # Upload MegaLinter artifacts - - name: Archive production artifacts - if: ${{ success() }} || ${{ failure() }} - uses: actions/upload-artifact@v3 - with: - name: MegaLinter reports - path: | - megalinter-reports - mega-linter.log - linter-helps.json - linter-versions.json - - - name: debug - if: ${{ success() }} || ${{ failure() }} - run: echo ${{ steps.docker_build.outcome }} - - # Test mega-linter-runner with newly created image - - name: Setup Node - if: ${{ steps.docker_build.outcome }} == 'success' && !contains(github.event.head_commit.message, 'quick build') - uses: actions/setup-node@v3.7.0 - with: - node-version: "12" - - name: Install NPM dependencies - if: ${{ steps.docker_build.outcome }} == 'success' && !contains(github.event.head_commit.message, 'quick build') - run: cd mega-linter-runner && sudo yarn install --frozen-lockfile && sudo npm link - - name: Run mega-linter-runner tests - if: ${{ steps.docker_build.outcome }} == 'success' && !contains(github.event.head_commit.message, 'quick build') - run: cd mega-linter-runner && MEGALINTER_RELEASE=${{ steps.image_tag.outputs.tag }} MEGALINTER_NO_DOCKER_PULL=true npm run test - - ############################################## - # Check Docker image security with Trivy # - ############################################## + ) + }} + imageName: megalinter - - name: Run Trivy vulnerability scanner - uses: aquasecurity/trivy-action@master - with: - image-ref: "docker.io/oxsecurity/megalinter:${{ steps.image_tag.outputs.tag }}" - format: 'table' - exit-code: '1' - ignore-unfixed: true - scanners: vuln - vuln-type: 'os,library' - severity: 'CRITICAL,HIGH' - timeout: 15m0s +# steps: +# +# ##################################### +# # Run Linter test cases # +# ##################################### +# - name: Run Test Cases +# shell: bash +# run: | +# GITHUB_REPOSITORY=$([ "${{ github.event_name }}" == "pull_request" ] && echo "${{ github.event.pull_request.head.repo.full_name }}" || echo "${{ github.repository }}") +# GITHUB_BRANCH=$([ "${{ github.event_name }}" == "pull_request" ] && echo "${{ github.head_ref }}" || echo "${{ github.ref_name }}") +# +# export CI_ENV="$(bash <(curl -s https://codecov.io/env)) -e GITHUB_ACTIONS" +# TEST_KEYWORDS_TO_USE="" +# if [[ "${{ github.event.head_commit.message }}" == *"TEST_KEYWORDS="* ]]; then +# COMMIT_MSG="${{ github.event.head_commit.message }}" +# TEST_KEYWORDS_TO_USE=${COMMIT_MSG#*TEST_KEYWORDS=} +# echo "Run only tests with keywords ${TEST_KEYWORDS_TO_USE}" +# if [[ "${TEST_KEYWORDS_TO_USE}" =~ $'\r' ]]; then +# echo "Problem while parsing test keywords: switch back to all tests" +# TEST_KEYWORDS_TO_USE="" +# fi +# fi +# docker image ls +# docker run $CI_ENV -e TEST_CASE_RUN=true -e OUTPUT_FORMAT=text -e OUTPUT_FOLDER=${{ github.sha }} -e OUTPUT_DETAIL=detailed -e GITHUB_SHA=${{ github.sha }} -e GITHUB_REPOSITORY=${GITHUB_REPOSITORY} -e GITHUB_BRANCH=${GITHUB_BRANCH} -e PAT="${{ secrets.PAT }}" -e TEST_KEYWORDS="${TEST_KEYWORDS_TO_USE}" -e MEGALINTER_VOLUME_ROOT="${GITHUB_WORKSPACE}" -v "/var/run/docker.sock:/var/run/docker.sock:rw" -v ${GITHUB_WORKSPACE}:/tmp/lint oxsecurity/megalinter:${{ steps.image_tag.outputs.tag }} +# timeout-minutes: 90 +# +# ##################################### +# # Run Linter against ALL code base # +# ##################################### +# - name: Run against all code base +# if: "!contains(github.event.head_commit.message, 'quick build')" +# shell: bash +# run: docker run -e GITHUB_REPOSITORY="${{ github.repository }}" -e GITHUB_SHA="${{ github.sha }}" -e GITHUB_TOKEN="${{ github.token }}" -e GITHUB_RUN_ID="${{ github.run_id }}" -e GITHUB_TOKEN="${{ secrets.GITHUB_TOKEN }}" -v "/var/run/docker.sock:/var/run/docker.sock:rw" -v ${GITHUB_WORKSPACE}:/tmp/lint oxsecurity/megalinter:${{ steps.image_tag.outputs.tag }} +# timeout-minutes: 15 +# +# # Upload MegaLinter artifacts +# - name: Archive production artifacts +# if: ${{ success() }} || ${{ failure() }} +# uses: actions/upload-artifact@v3 +# with: +# name: MegaLinter reports +# path: | +# megalinter-reports +# mega-linter.log +# linter-helps.json +# linter-versions.json +# +# - name: debug +# if: ${{ success() }} || ${{ failure() }} +# run: echo ${{ steps.docker_build.outcome }} +# +# # Test mega-linter-runner with newly created image +# - name: Setup Node +# if: ${{ steps.docker_build.outcome }} == 'success' && !contains(github.event.head_commit.message, 'quick build') +# uses: actions/setup-node@v3.7.0 +# with: +# node-version: "12" +# - name: Install NPM dependencies +# if: ${{ steps.docker_build.outcome }} == 'success' && !contains(github.event.head_commit.message, 'quick build') +# run: cd mega-linter-runner && sudo yarn install --frozen-lockfile && sudo npm link +# - name: Run mega-linter-runner tests +# if: ${{ steps.docker_build.outcome }} == 'success' && !contains(github.event.head_commit.message, 'quick build') +# run: cd mega-linter-runner && MEGALINTER_RELEASE=${{ steps.image_tag.outputs.tag }} MEGALINTER_NO_DOCKER_PULL=true npm run test +# +# ############################################## +# # Check Docker image security with Trivy # +# ############################################## +# +# - name: Run Trivy vulnerability scanner +# uses: aquasecurity/trivy-action@master +# with: +# image-ref: "docker.io/oxsecurity/megalinter:${{ steps.image_tag.outputs.tag }}" +# format: 'table' +# exit-code: '1' +# ignore-unfixed: true +# scanners: vuln +# vuln-type: 'os,library' +# severity: 'CRITICAL,HIGH' +# timeout: 15m0s From b2405e75ad37dfc67b866506d521c6d0868271d4 Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Thu, 20 Apr 2023 12:41:00 -0500 Subject: [PATCH 041/105] Bugfix --- .github/workflows/deploy-ALPHA-flavors.yml | 2 +- .github/workflows/deploy-DEV.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-ALPHA-flavors.yml b/.github/workflows/deploy-ALPHA-flavors.yml index 0299b00b56f..be297c4de1a 100644 --- a/.github/workflows/deploy-ALPHA-flavors.yml +++ b/.github/workflows/deploy-ALPHA-flavors.yml @@ -46,7 +46,7 @@ jobs: packages: write # Only run this on the main repo if: github.repository == 'oxsecurity/megalinter' && !contains(github.event.head_commit.message, 'skip deploy') - uses: -build-docker.yml + uses: ./.github/workflows/-build-docker.yml with: tagTemplate: "alpha" shouldLoginDockerHub: false diff --git a/.github/workflows/deploy-DEV.yml b/.github/workflows/deploy-DEV.yml index cdcf52903fb..6b9ea754edd 100644 --- a/.github/workflows/deploy-DEV.yml +++ b/.github/workflows/deploy-DEV.yml @@ -50,7 +50,7 @@ jobs: name: Tests + Deploy Docker Image - DEV # Prevent duplicate run from happening when a forked push is committed if: (github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository) && !contains(github.event.head_commit.message, 'skip deploy') - uses: -build-docker.yml + uses: ./.github/workflows/-build-docker.yml with: tagTemplate: "test-${{ github.actor }}-${BRANCH_NAME}" shouldLoginDockerHub: | From a541ab7ecd9d4993bdabc65768494dcf7f00661a Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Thu, 20 Apr 2023 12:43:38 -0500 Subject: [PATCH 042/105] Indent fix --- .github/workflows/-build-docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/-build-docker.yml b/.github/workflows/-build-docker.yml index b107386591e..4b5b280ded7 100644 --- a/.github/workflows/-build-docker.yml +++ b/.github/workflows/-build-docker.yml @@ -58,7 +58,7 @@ jobs: with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - + - name: Login to GitHub Container Registry if: ${{ inputs.shouldLoginGithub }} uses: docker/login-action@v2 From ed81b3faa834df41331b8d37f7e8466f879e5ca4 Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Thu, 20 Apr 2023 13:06:20 -0500 Subject: [PATCH 043/105] Indent tweak --- .github/workflows/-build-docker.yml | 168 ++++++++++++++-------------- 1 file changed, 83 insertions(+), 85 deletions(-) diff --git a/.github/workflows/-build-docker.yml b/.github/workflows/-build-docker.yml index 4b5b280ded7..66dcf0cac36 100644 --- a/.github/workflows/-build-docker.yml +++ b/.github/workflows/-build-docker.yml @@ -32,99 +32,97 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 120 steps: - - name: Checkout Code - uses: actions/checkout@v3 + - name: Checkout Code + uses: actions/checkout@v3 - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 - - name: Get current date - run: echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >>"$GITHUB_ENV" + - name: Get current date + run: echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >>"$GITHUB_ENV" - - name: Build image tag name - id: image_tag - run: | - BRANCH_NAME="${GITHUB_REF##*/}" - TAG="${{ inputs.tagTemplate }}" - echo "Tag name: ${TAG}" - echo "tag=${TAG}" >>"$GITHUB_OUTPUT" + - name: Build image tag name + id: image_tag + run: | + BRANCH_NAME="${GITHUB_REF##*/}" + TAG="${{ inputs.tagTemplate }}" + echo "Tag name: ${TAG}" + echo "tag=${TAG}" >>"$GITHUB_OUTPUT" - - name: Login to Docker Hub - if: ${{ inputs.shouldLoginDockerHub }} - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} + - name: Login to Docker Hub + if: ${{ inputs.shouldLoginDockerHub }} + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} - - name: Login to GitHub Container Registry - if: ${{ inputs.shouldLoginGithub }} - uses: docker/login-action@v2 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} + - name: Login to GitHub Container Registry + if: ${{ inputs.shouldLoginGithub }} + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} - - name: Build Image - uses: docker/build-push-action@v4 - with: - file: ${{ inputs.dockerfile }} - platforms: linux/amd64,linux/arm64 - build-args: | - BUILD_DATE=${{ env.BUILD_DATE }} - BUILD_REVISION=${{ github.sha }} - BUILD_VERSION=alpha - load: ${{ inputs.load }} - push: ${{ inputs.push }} - outputs: type=oci,dest=image.tar + - name: Build Image + uses: docker/build-push-action@v4 + with: + file: ${{ inputs.dockerfile }} + platforms: linux/amd64,linux/arm64 + build-args: | + BUILD_DATE=${{ env.BUILD_DATE }} + BUILD_REVISION=${{ github.sha }} + BUILD_VERSION=alpha + load: ${{ inputs.load }} + push: ${{ inputs.push }} + outputs: type=oci,dest=image.tar - secrets: | - GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} - tags: ${{ - ( - inputs.shouldLoginGithub && inputs.shouldLoginDockerHub - 'oxsecurity/${{ input.imageName }}:${{ steps.image_tag.outputs.tag }} ghcr.io/oxsecurity/${{ input.imageName }}:${{ steps.image_tag.outputs.tag }}' - ) || ( - inputs.shouldLoginGithub && 'oxsecurity/${{ input.imageName }}:${{ steps.image_tag.outputs.tag }}' - ) || ( - inputs.shouldLoginDockerHub && 'ghcr.io/oxsecurity/${{ input.imageName }}:${{ steps.image_tag.outputs.tag }}'' - ) || '' - }} - timeout-minutes: 360 #90 - Temp increasing this to see how long it takes - - - name: Build Worker Image - uses: docker/build-push-action@v4 - with: - context: . - file: Dockerfile-worker - platforms: linux/amd64 - build-args: | - MEGALINTER_BASE_IMAGE=ghcr.io/oxsecurity/megalinter-${{ matrix.flavor }}:alpha - BUILD_DATE=${{ env.BUILD_DATE }} - BUILD_REVISION=${{ github.sha }} - BUILD_VERSION=alpha - load: false - push: true - - secrets: | - GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} - tags: ${{ - ( - inputs.shouldLoginGithub && inputs.shouldLoginDockerHub - 'oxsecurity/${{ input.workerImageName }}:${{ steps.image_tag.outputs.tag }} ghcr.io/oxsecurity/${{ input.workerImageName }}:${{ steps.image_tag.outputs.tag }}' - ) || ( - inputs.shouldLoginGithub && 'oxsecurity/${{ input.workerImageName }}:${{ steps.image_tag.outputs.tag }}' + secrets: | + GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} + tags: ${{ + ( + inputs.shouldLoginGithub && inputs.shouldLoginDockerHub + 'oxsecurity/${{ input.imageName }}:${{ steps.image_tag.outputs.tag }} ghcr.io/oxsecurity/${{ input.imageName }}:${{ steps.image_tag.outputs.tag }}' ) || ( - inputs.shouldLoginDockerHub && 'ghcr.io/oxsecurity/${{ input.workerImageName }}:${{ steps.image_tag.outputs.tag }}'' - ) || '' - }} - + inputs.shouldLoginGithub && 'oxsecurity/${{ input.imageName }}:${{ steps.image_tag.outputs.tag }}' + ) || ( + inputs.shouldLoginDockerHub && 'ghcr.io/oxsecurity/${{ input.imageName }}:${{ steps.image_tag.outputs.tag }}'' + ) || '' + }} + timeout-minutes: 360 #90 - Temp increasing this to see how long it takes - - name: Archive oci artifacts - uses: actions/upload-artifact@v3 - with: - name: oci-tar - path: image.tar + - name: Build Worker Image + uses: docker/build-push-action@v4 + with: + context: . + file: Dockerfile-worker + platforms: linux/amd64 + build-args: | + MEGALINTER_BASE_IMAGE=ghcr.io/oxsecurity/megalinter-${{ matrix.flavor }}:alpha + BUILD_DATE=${{ env.BUILD_DATE }} + BUILD_REVISION=${{ github.sha }} + BUILD_VERSION=alpha + load: false + push: true + + secrets: | + GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} + tags: ${{ + ( + inputs.shouldLoginGithub && inputs.shouldLoginDockerHub + 'oxsecurity/${{ input.workerImageName }}:${{ steps.image_tag.outputs.tag }} ghcr.io/oxsecurity/${{ input.workerImageName }}:${{ steps.image_tag.outputs.tag }}' + ) || ( + inputs.shouldLoginGithub && 'oxsecurity/${{ input.workerImageName }}:${{ steps.image_tag.outputs.tag }}' + ) || ( + inputs.shouldLoginDockerHub && 'ghcr.io/oxsecurity/${{ input.workerImageName }}:${{ steps.image_tag.outputs.tag }}'' + ) || '' + }} + - name: Archive oci artifacts + uses: actions/upload-artifact@v3 + with: + name: oci-tar + path: image.tar From fa57dfeba47072d02c43a7f0c640bfc3a1fca888 Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Thu, 20 Apr 2023 13:09:07 -0500 Subject: [PATCH 044/105] Debugging --- .github/workflows/deploy-DEV.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy-DEV.yml b/.github/workflows/deploy-DEV.yml index 6b9ea754edd..a3b99b333a2 100644 --- a/.github/workflows/deploy-DEV.yml +++ b/.github/workflows/deploy-DEV.yml @@ -53,11 +53,10 @@ jobs: uses: ./.github/workflows/-build-docker.yml with: tagTemplate: "test-${{ github.actor }}-${BRANCH_NAME}" - shouldLoginDockerHub: | - ( + shouldLoginDockerHub: ${{ (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) || (github.event_name == 'push' && github.repository == 'oxsecurity/megalinter') - ) + }} shouldLoginGithub: false dockerfile: ${{ (contains(github.event.head_commit.message, 'quick build') && 'Dockerfile-quick') || 'Dockerfile' }} push: false From dbc5027fb2a5dc39ed9524945f33062810f04c0c Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Thu, 20 Apr 2023 13:10:13 -0500 Subject: [PATCH 045/105] Debugging --- .github/workflows/deploy-DEV.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-DEV.yml b/.github/workflows/deploy-DEV.yml index a3b99b333a2..0de643c7003 100644 --- a/.github/workflows/deploy-DEV.yml +++ b/.github/workflows/deploy-DEV.yml @@ -53,10 +53,10 @@ jobs: uses: ./.github/workflows/-build-docker.yml with: tagTemplate: "test-${{ github.actor }}-${BRANCH_NAME}" - shouldLoginDockerHub: ${{ + shouldLoginDockerHub: ${{ ( (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) || (github.event_name == 'push' && github.repository == 'oxsecurity/megalinter') - }} + ) }} shouldLoginGithub: false dockerfile: ${{ (contains(github.event.head_commit.message, 'quick build') && 'Dockerfile-quick') || 'Dockerfile' }} push: false From acd4c953b7b963a05a9b7af1f157497ebdb040cd Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Thu, 20 Apr 2023 13:10:45 -0500 Subject: [PATCH 046/105] Debugging --- .github/workflows/deploy-DEV.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/deploy-DEV.yml b/.github/workflows/deploy-DEV.yml index 0de643c7003..7c88ab53470 100644 --- a/.github/workflows/deploy-DEV.yml +++ b/.github/workflows/deploy-DEV.yml @@ -53,10 +53,7 @@ jobs: uses: ./.github/workflows/-build-docker.yml with: tagTemplate: "test-${{ github.actor }}-${BRANCH_NAME}" - shouldLoginDockerHub: ${{ ( - (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) || - (github.event_name == 'push' && github.repository == 'oxsecurity/megalinter') - ) }} + shouldLoginDockerHub: ${{ (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) || (github.event_name == 'push' && github.repository == 'oxsecurity/megalinter') }} shouldLoginGithub: false dockerfile: ${{ (contains(github.event.head_commit.message, 'quick build') && 'Dockerfile-quick') || 'Dockerfile' }} push: false From f51f8f4726bbca222eb0f77c0ec2be82dbd3555a Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Wed, 19 Jul 2023 09:29:48 -0500 Subject: [PATCH 047/105] Indent fix --- .github/workflows/-build-docker.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/-build-docker.yml b/.github/workflows/-build-docker.yml index 66dcf0cac36..9f31aa16044 100644 --- a/.github/workflows/-build-docker.yml +++ b/.github/workflows/-build-docker.yml @@ -1,3 +1,5 @@ +name: "Build Docker" + on: workflow_call: inputs: @@ -105,9 +107,9 @@ jobs: BUILD_DATE=${{ env.BUILD_DATE }} BUILD_REVISION=${{ github.sha }} BUILD_VERSION=alpha - load: false + load: false push: true - + secrets: | GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} tags: ${{ @@ -117,7 +119,7 @@ jobs: ) || ( inputs.shouldLoginGithub && 'oxsecurity/${{ input.workerImageName }}:${{ steps.image_tag.outputs.tag }}' ) || ( - inputs.shouldLoginDockerHub && 'ghcr.io/oxsecurity/${{ input.workerImageName }}:${{ steps.image_tag.outputs.tag }}'' + inputs.shouldLoginDockerHub && 'ghcr.io/oxsecurity/${{ input.workerImageName }}:${{ steps.image_tag.outputs.tag }}'' ) || '' }} From 73d4e83fea1230afc4712264f3dbef59c18a504b Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Thu, 20 Apr 2023 13:15:09 -0500 Subject: [PATCH 048/105] Debugging --- .github/workflows/-build-docker.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/-build-docker.yml b/.github/workflows/-build-docker.yml index 9f31aa16044..641bffcfad7 100644 --- a/.github/workflows/-build-docker.yml +++ b/.github/workflows/-build-docker.yml @@ -84,7 +84,8 @@ jobs: secrets: | GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} - tags: ${{ + tags: >+ + ${{ ( inputs.shouldLoginGithub && inputs.shouldLoginDockerHub 'oxsecurity/${{ input.imageName }}:${{ steps.image_tag.outputs.tag }} ghcr.io/oxsecurity/${{ input.imageName }}:${{ steps.image_tag.outputs.tag }}' From 30441040c8d21a66de4d8dc91f4dd41400a16f08 Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Thu, 20 Apr 2023 13:15:43 -0500 Subject: [PATCH 049/105] Debugging --- .github/workflows/-build-docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/-build-docker.yml b/.github/workflows/-build-docker.yml index 641bffcfad7..ffff6c12e47 100644 --- a/.github/workflows/-build-docker.yml +++ b/.github/workflows/-build-docker.yml @@ -80,7 +80,7 @@ jobs: BUILD_VERSION=alpha load: ${{ inputs.load }} push: ${{ inputs.push }} - outputs: type=oci,dest=image.tar + outputs: ${{ (inputs.push && "") || type=oci,dest=image.tar }} secrets: | GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} From b347bf756bccd1dba453be06de61fe121f5afcbe Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Thu, 20 Apr 2023 13:19:36 -0500 Subject: [PATCH 050/105] Debugging --- .github/workflows/-build-docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/-build-docker.yml b/.github/workflows/-build-docker.yml index ffff6c12e47..2fa2e228f13 100644 --- a/.github/workflows/-build-docker.yml +++ b/.github/workflows/-build-docker.yml @@ -80,7 +80,7 @@ jobs: BUILD_VERSION=alpha load: ${{ inputs.load }} push: ${{ inputs.push }} - outputs: ${{ (inputs.push && "") || type=oci,dest=image.tar }} + outputs: ${{ (inputs.push && '') || 'type=oci,dest=image.tar' }} secrets: | GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} From 5b6b27ee846124a8f868be7f3dc17d716bff6dc4 Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Thu, 20 Apr 2023 13:22:09 -0500 Subject: [PATCH 051/105] Debugging --- .github/workflows/-build-docker.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/-build-docker.yml b/.github/workflows/-build-docker.yml index 2fa2e228f13..fe23a16896f 100644 --- a/.github/workflows/-build-docker.yml +++ b/.github/workflows/-build-docker.yml @@ -80,7 +80,7 @@ jobs: BUILD_VERSION=alpha load: ${{ inputs.load }} push: ${{ inputs.push }} - outputs: ${{ (inputs.push && '') || 'type=oci,dest=image.tar' }} + outputs: ${{ (!inputs.push && 'type=oci,dest=image.tar') || '' }} secrets: | GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} @@ -95,7 +95,6 @@ jobs: inputs.shouldLoginDockerHub && 'ghcr.io/oxsecurity/${{ input.imageName }}:${{ steps.image_tag.outputs.tag }}'' ) || '' }} - timeout-minutes: 360 #90 - Temp increasing this to see how long it takes - name: Build Worker Image uses: docker/build-push-action@v4 From 05867bd3a3c987332164e9cd554f6e661c6ddb45 Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Thu, 20 Apr 2023 13:25:05 -0500 Subject: [PATCH 052/105] Debugging --- .github/workflows/-build-docker.yml | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/.github/workflows/-build-docker.yml b/.github/workflows/-build-docker.yml index fe23a16896f..94f19ef015e 100644 --- a/.github/workflows/-build-docker.yml +++ b/.github/workflows/-build-docker.yml @@ -52,7 +52,12 @@ jobs: BRANCH_NAME="${GITHUB_REF##*/}" TAG="${{ inputs.tagTemplate }}" echo "Tag name: ${TAG}" - echo "tag=${TAG}" >>"$GITHUB_OUTPUT" + if [[ "${{inputs.shouldLoginGithub}}" == "true" ]]; then + echo "ghcr.io/oxsecurity/${{ input.imageName }}:${TAG}" >>"$GITHUB_OUTPUT" + fi + if [[ "${{inputs.shouldLoginDockerHub}}" == "true" ]]; then + echo "oxsecurity/${{ input.imageName }}:${TAG}" >>"$GITHUB_OUTPUT" + fi - name: Login to Docker Hub if: ${{ inputs.shouldLoginDockerHub }} @@ -84,17 +89,7 @@ jobs: secrets: | GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} - tags: >+ - ${{ - ( - inputs.shouldLoginGithub && inputs.shouldLoginDockerHub - 'oxsecurity/${{ input.imageName }}:${{ steps.image_tag.outputs.tag }} ghcr.io/oxsecurity/${{ input.imageName }}:${{ steps.image_tag.outputs.tag }}' - ) || ( - inputs.shouldLoginGithub && 'oxsecurity/${{ input.imageName }}:${{ steps.image_tag.outputs.tag }}' - ) || ( - inputs.shouldLoginDockerHub && 'ghcr.io/oxsecurity/${{ input.imageName }}:${{ steps.image_tag.outputs.tag }}'' - ) || '' - }} + tags: ${{ steps.image_tag.outputs.tag }} - name: Build Worker Image uses: docker/build-push-action@v4 From be7eef5d927d3a96ba11c00e409a5c33b2b61c93 Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Thu, 20 Apr 2023 13:26:26 -0500 Subject: [PATCH 053/105] Debugging --- .github/workflows/-build-docker.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/-build-docker.yml b/.github/workflows/-build-docker.yml index 94f19ef015e..9de5d1559f0 100644 --- a/.github/workflows/-build-docker.yml +++ b/.github/workflows/-build-docker.yml @@ -53,10 +53,10 @@ jobs: TAG="${{ inputs.tagTemplate }}" echo "Tag name: ${TAG}" if [[ "${{inputs.shouldLoginGithub}}" == "true" ]]; then - echo "ghcr.io/oxsecurity/${{ input.imageName }}:${TAG}" >>"$GITHUB_OUTPUT" + echo "ghcr.io/oxsecurity/${{ inputs.imageName }}:${TAG}" >>"$GITHUB_OUTPUT" fi if [[ "${{inputs.shouldLoginDockerHub}}" == "true" ]]; then - echo "oxsecurity/${{ input.imageName }}:${TAG}" >>"$GITHUB_OUTPUT" + echo "oxsecurity/${{ inputs.imageName }}:${TAG}" >>"$GITHUB_OUTPUT" fi - name: Login to Docker Hub From ee7aa03a66440cd7d9e5236b7524f4b24a7d48d1 Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Thu, 20 Apr 2023 13:30:22 -0500 Subject: [PATCH 054/105] Debugging --- .github/workflows/-build-docker.yml | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/.github/workflows/-build-docker.yml b/.github/workflows/-build-docker.yml index 9de5d1559f0..2bff85aeeb0 100644 --- a/.github/workflows/-build-docker.yml +++ b/.github/workflows/-build-docker.yml @@ -52,12 +52,18 @@ jobs: BRANCH_NAME="${GITHUB_REF##*/}" TAG="${{ inputs.tagTemplate }}" echo "Tag name: ${TAG}" + MAIN_TAG=() + WORKER_TAG=() if [[ "${{inputs.shouldLoginGithub}}" == "true" ]]; then - echo "ghcr.io/oxsecurity/${{ inputs.imageName }}:${TAG}" >>"$GITHUB_OUTPUT" + MAIN_TAG+=("ghcr.io/oxsecurity/${{ inputs.imageName }}:${TAG}") + WORKER_TAG+=("ghcr.io/oxsecurity/${{ inputs.workerImageName }}:${TAG}") fi if [[ "${{inputs.shouldLoginDockerHub}}" == "true" ]]; then - echo "oxsecurity/${{ inputs.imageName }}:${TAG}" >>"$GITHUB_OUTPUT" + MAIN_TAG+=("oxsecurity/${{ inputs.imageName }}:${TAG}") + WORKER_TAG+=("oxsecurity/${{ inputs.workerImageName }}:${TAG}") fi + echo "tag=${MAIN_TAG}" >>"$GITHUB_OUTPUT" + echo "workerTag=${WORKER_TAG}" >>"$GITHUB_OUTPUT" - name: Login to Docker Hub if: ${{ inputs.shouldLoginDockerHub }} @@ -107,16 +113,7 @@ jobs: secrets: | GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} - tags: ${{ - ( - inputs.shouldLoginGithub && inputs.shouldLoginDockerHub - 'oxsecurity/${{ input.workerImageName }}:${{ steps.image_tag.outputs.tag }} ghcr.io/oxsecurity/${{ input.workerImageName }}:${{ steps.image_tag.outputs.tag }}' - ) || ( - inputs.shouldLoginGithub && 'oxsecurity/${{ input.workerImageName }}:${{ steps.image_tag.outputs.tag }}' - ) || ( - inputs.shouldLoginDockerHub && 'ghcr.io/oxsecurity/${{ input.workerImageName }}:${{ steps.image_tag.outputs.tag }}'' - ) || '' - }} + tags: ${{ steps.image_tag.outputs.workerTag }} - name: Archive oci artifacts uses: actions/upload-artifact@v3 From 9d0951623f1f20ea166bffd0cbe4089b4f8a4033 Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Thu, 20 Apr 2023 13:39:12 -0500 Subject: [PATCH 055/105] Reduce retention --- .github/workflows/-build-docker.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/-build-docker.yml b/.github/workflows/-build-docker.yml index 2bff85aeeb0..b24238f291c 100644 --- a/.github/workflows/-build-docker.yml +++ b/.github/workflows/-build-docker.yml @@ -120,3 +120,5 @@ jobs: with: name: oci-tar path: image.tar + if-no-files-found: ${{ (inputs.push && 'ignore') || 'error' }} + retention-days: 1 From 77ffbca8c29cfce5f5aa09c0acbc7301c06dd0bb Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Thu, 20 Apr 2023 16:36:23 -0500 Subject: [PATCH 056/105] Temp remove tar file --- .github/workflows/-build-docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/-build-docker.yml b/.github/workflows/-build-docker.yml index b24238f291c..e7a5cae6564 100644 --- a/.github/workflows/-build-docker.yml +++ b/.github/workflows/-build-docker.yml @@ -91,7 +91,7 @@ jobs: BUILD_VERSION=alpha load: ${{ inputs.load }} push: ${{ inputs.push }} - outputs: ${{ (!inputs.push && 'type=oci,dest=image.tar') || '' }} +# outputs: ${{ (!inputs.push && 'type=oci,dest=image.tar') || '' }} secrets: | GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} From 513c1c021ee3673bba038ccda028ef09daf331fe Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Thu, 20 Apr 2023 17:30:15 -0500 Subject: [PATCH 057/105] Disable arm64 --- .github/workflows/-build-docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/-build-docker.yml b/.github/workflows/-build-docker.yml index e7a5cae6564..b584ed9eb62 100644 --- a/.github/workflows/-build-docker.yml +++ b/.github/workflows/-build-docker.yml @@ -84,7 +84,7 @@ jobs: uses: docker/build-push-action@v4 with: file: ${{ inputs.dockerfile }} - platforms: linux/amd64,linux/arm64 + platforms: linux/amd64 #,linux/arm64 -Temporary build-args: | BUILD_DATE=${{ env.BUILD_DATE }} BUILD_REVISION=${{ github.sha }} From 3db4bb3f8954a45428e72d21290d3cd42746894a Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Mon, 24 Apr 2023 09:18:55 -0500 Subject: [PATCH 058/105] Adding oci export back --- .github/workflows/-build-docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/-build-docker.yml b/.github/workflows/-build-docker.yml index b584ed9eb62..6962872fb08 100644 --- a/.github/workflows/-build-docker.yml +++ b/.github/workflows/-build-docker.yml @@ -91,7 +91,7 @@ jobs: BUILD_VERSION=alpha load: ${{ inputs.load }} push: ${{ inputs.push }} -# outputs: ${{ (!inputs.push && 'type=oci,dest=image.tar') || '' }} + outputs: ${{ (!inputs.push && 'type=oci,dest=image.tar') || '' }} secrets: | GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} From 6edec29be91cc055d08e1bc22421288cda293a0d Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Mon, 24 Apr 2023 10:20:45 -0500 Subject: [PATCH 059/105] Swapping output and arm64 --- .github/workflows/-build-docker.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/-build-docker.yml b/.github/workflows/-build-docker.yml index 6962872fb08..e7a5cae6564 100644 --- a/.github/workflows/-build-docker.yml +++ b/.github/workflows/-build-docker.yml @@ -84,14 +84,14 @@ jobs: uses: docker/build-push-action@v4 with: file: ${{ inputs.dockerfile }} - platforms: linux/amd64 #,linux/arm64 -Temporary + platforms: linux/amd64,linux/arm64 build-args: | BUILD_DATE=${{ env.BUILD_DATE }} BUILD_REVISION=${{ github.sha }} BUILD_VERSION=alpha load: ${{ inputs.load }} push: ${{ inputs.push }} - outputs: ${{ (!inputs.push && 'type=oci,dest=image.tar') || '' }} +# outputs: ${{ (!inputs.push && 'type=oci,dest=image.tar') || '' }} secrets: | GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} From 0552f39602c3282d5cb4f47bf53a4348b72c9516 Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Mon, 24 Apr 2023 11:51:48 -0500 Subject: [PATCH 060/105] Adding the tests back in --- .github/workflows/-build-docker.yml | 11 ++- .github/workflows/deploy-DEV.yml | 101 ++++++++++++++++------------ 2 files changed, 66 insertions(+), 46 deletions(-) diff --git a/.github/workflows/-build-docker.yml b/.github/workflows/-build-docker.yml index e7a5cae6564..628d2d49f24 100644 --- a/.github/workflows/-build-docker.yml +++ b/.github/workflows/-build-docker.yml @@ -37,6 +37,13 @@ jobs: - name: Checkout Code uses: actions/checkout@v3 + # Free disk space + - name: Free Disk space + shell: bash + run: | + sudo rm -rf /usr/local/lib/android # will release about 10 GB if you don't need Android + sudo rm -rf /usr/share/dotnet # will release about 20GB if you don't need .NET + - name: Set up QEMU uses: docker/setup-qemu-action@v2 @@ -84,14 +91,14 @@ jobs: uses: docker/build-push-action@v4 with: file: ${{ inputs.dockerfile }} - platforms: linux/amd64,linux/arm64 + platforms: linux/amd64 #,linux/arm64 -Temporary, getting no space left on device build-args: | BUILD_DATE=${{ env.BUILD_DATE }} BUILD_REVISION=${{ github.sha }} BUILD_VERSION=alpha load: ${{ inputs.load }} push: ${{ inputs.push }} -# outputs: ${{ (!inputs.push && 'type=oci,dest=image.tar') || '' }} + outputs: ${{ (!inputs.push && 'type=oci,dest=image.tar') || '' }} secrets: | GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/deploy-DEV.yml b/.github/workflows/deploy-DEV.yml index 7c88ab53470..08619e4d121 100644 --- a/.github/workflows/deploy-DEV.yml +++ b/.github/workflows/deploy-DEV.yml @@ -56,52 +56,65 @@ jobs: shouldLoginDockerHub: ${{ (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) || (github.event_name == 'push' && github.repository == 'oxsecurity/megalinter') }} shouldLoginGithub: false dockerfile: ${{ (contains(github.event.head_commit.message, 'quick build') && 'Dockerfile-quick') || 'Dockerfile' }} - push: false - load: ${{ !( - ( - (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository) || - (github.event_name == 'push' && github.repository != 'oxsecurity/megalinter') - ) - && - !contains(github.event.head_commit.message, 'quick build') - ) - }} + push: ${{ (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) || (github.event_name == 'push' && github.repository == 'oxsecurity/megalinter') }} imageName: megalinter + test: + strategy: + fail-fast: false + max-parallel: 10 + matrix: + platform: [amd64] #,linux/arm64 -Temporary, getting no space left on device + steps: + - uses: actions/checkout@v3 + - uses: actions/download-artifact@v3 + with: + name: oci-tar + path: /oci-tar + - name: Load image + shell: bash + run: | + if [[ -f /oci-tar/image.tar ]]; then + skopeo copy --override-os=linux --override-arch=${{ matrix.platform }} oci-archive:/oci-tar/image.tar oxsecurity/megalinter:${{ steps.image_tag.outputs.tag }} + fi + # Free disk space + - name: Free Disk space + shell: bash + run: | + sudo rm -rf /usr/local/lib/android # will release about 10 GB if you don't need Android + sudo rm -rf /usr/share/dotnet # will release about 20GB if you don't need .NET -# steps: -# -# ##################################### -# # Run Linter test cases # -# ##################################### -# - name: Run Test Cases -# shell: bash -# run: | -# GITHUB_REPOSITORY=$([ "${{ github.event_name }}" == "pull_request" ] && echo "${{ github.event.pull_request.head.repo.full_name }}" || echo "${{ github.repository }}") -# GITHUB_BRANCH=$([ "${{ github.event_name }}" == "pull_request" ] && echo "${{ github.head_ref }}" || echo "${{ github.ref_name }}") -# -# export CI_ENV="$(bash <(curl -s https://codecov.io/env)) -e GITHUB_ACTIONS" -# TEST_KEYWORDS_TO_USE="" -# if [[ "${{ github.event.head_commit.message }}" == *"TEST_KEYWORDS="* ]]; then -# COMMIT_MSG="${{ github.event.head_commit.message }}" -# TEST_KEYWORDS_TO_USE=${COMMIT_MSG#*TEST_KEYWORDS=} -# echo "Run only tests with keywords ${TEST_KEYWORDS_TO_USE}" -# if [[ "${TEST_KEYWORDS_TO_USE}" =~ $'\r' ]]; then -# echo "Problem while parsing test keywords: switch back to all tests" -# TEST_KEYWORDS_TO_USE="" -# fi -# fi -# docker image ls -# docker run $CI_ENV -e TEST_CASE_RUN=true -e OUTPUT_FORMAT=text -e OUTPUT_FOLDER=${{ github.sha }} -e OUTPUT_DETAIL=detailed -e GITHUB_SHA=${{ github.sha }} -e GITHUB_REPOSITORY=${GITHUB_REPOSITORY} -e GITHUB_BRANCH=${GITHUB_BRANCH} -e PAT="${{ secrets.PAT }}" -e TEST_KEYWORDS="${TEST_KEYWORDS_TO_USE}" -e MEGALINTER_VOLUME_ROOT="${GITHUB_WORKSPACE}" -v "/var/run/docker.sock:/var/run/docker.sock:rw" -v ${GITHUB_WORKSPACE}:/tmp/lint oxsecurity/megalinter:${{ steps.image_tag.outputs.tag }} -# timeout-minutes: 90 -# -# ##################################### -# # Run Linter against ALL code base # -# ##################################### -# - name: Run against all code base -# if: "!contains(github.event.head_commit.message, 'quick build')" -# shell: bash -# run: docker run -e GITHUB_REPOSITORY="${{ github.repository }}" -e GITHUB_SHA="${{ github.sha }}" -e GITHUB_TOKEN="${{ github.token }}" -e GITHUB_RUN_ID="${{ github.run_id }}" -e GITHUB_TOKEN="${{ secrets.GITHUB_TOKEN }}" -v "/var/run/docker.sock:/var/run/docker.sock:rw" -v ${GITHUB_WORKSPACE}:/tmp/lint oxsecurity/megalinter:${{ steps.image_tag.outputs.tag }} -# timeout-minutes: 15 + ##################################### + # Run Linter test cases # + ##################################### + - name: Run Test Cases + shell: bash + run: | + GITHUB_REPOSITORY=$([ "${{ github.event_name }}" == "pull_request" ] && echo "${{ github.event.pull_request.head.repo.full_name }}" || echo "${{ github.repository }}") + GITHUB_BRANCH=$([ "${{ github.event_name }}" == "pull_request" ] && echo "${{ github.head_ref }}" || echo "${{ github.ref_name }}") + + export CI_ENV="$(bash <(curl -s https://codecov.io/env)) -e GITHUB_ACTIONS" + TEST_KEYWORDS_TO_USE="" + if [[ "${{ github.event.head_commit.message }}" == *"TEST_KEYWORDS="* ]]; then + COMMIT_MSG="${{ github.event.head_commit.message }}" + TEST_KEYWORDS_TO_USE=${COMMIT_MSG#*TEST_KEYWORDS=} + echo "Run only tests with keywords ${TEST_KEYWORDS_TO_USE}" + if [[ "${TEST_KEYWORDS_TO_USE}" =~ $'\r' ]]; then + echo "Problem while parsing test keywords: switch back to all tests" + TEST_KEYWORDS_TO_USE="" + fi + fi + + docker run $CI_ENV -e TEST_CASE_RUN=true -e OUTPUT_FORMAT=text -e OUTPUT_FOLDER=${{ github.sha }} -e OUTPUT_DETAIL=detailed -e GITHUB_SHA=${{ github.sha }} -e GITHUB_REPOSITORY=${GITHUB_REPOSITORY} -e GITHUB_BRANCH=${GITHUB_BRANCH} -e PAT="${{ secrets.PAT }}" -e TEST_KEYWORDS="${TEST_KEYWORDS_TO_USE}" -e MEGALINTER_VOLUME_ROOT="${GITHUB_WORKSPACE}" -v "/var/run/docker.sock:/var/run/docker.sock:rw" -v ${GITHUB_WORKSPACE}:/tmp/lint oxsecurity/megalinter:${{ steps.image_tag.outputs.tag }} + timeout-minutes: 90 + + ##################################### + # Run Linter against ALL code base # + ##################################### + - name: Run against all code base + if: "!contains(github.event.head_commit.message, 'quick build')" + shell: bash + run: docker run -e GITHUB_REPOSITORY="${{ github.repository }}" -e GITHUB_SHA="${{ github.sha }}" -e GITHUB_TOKEN="${{ github.token }}" -e GITHUB_RUN_ID="${{ github.run_id }}" -e GITHUB_TOKEN="${{ secrets.GITHUB_TOKEN }}" -v "/var/run/docker.sock:/var/run/docker.sock:rw" -v ${GITHUB_WORKSPACE}:/tmp/lint oxsecurity/megalinter:${{ steps.image_tag.outputs.tag }} + timeout-minutes: 15 # # # Upload MegaLinter artifacts # - name: Archive production artifacts From c1a5cf3f636fa4eba862dc976bf4105efee3dc7e Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Mon, 24 Apr 2023 11:59:03 -0500 Subject: [PATCH 061/105] Bugfix --- .github/workflows/deploy-DEV.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/deploy-DEV.yml b/.github/workflows/deploy-DEV.yml index 08619e4d121..def94e3fbeb 100644 --- a/.github/workflows/deploy-DEV.yml +++ b/.github/workflows/deploy-DEV.yml @@ -59,6 +59,8 @@ jobs: push: ${{ (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) || (github.event_name == 'push' && github.repository == 'oxsecurity/megalinter') }} imageName: megalinter test: + name: Test + runs-on: ubuntu-latest strategy: fail-fast: false max-parallel: 10 From 0f3f7134536ec245724bc3ee62efc608c361f0b0 Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Mon, 24 Apr 2023 12:00:47 -0500 Subject: [PATCH 062/105] Bugfix --- .github/workflows/deploy-DEV.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/deploy-DEV.yml b/.github/workflows/deploy-DEV.yml index def94e3fbeb..470442b2189 100644 --- a/.github/workflows/deploy-DEV.yml +++ b/.github/workflows/deploy-DEV.yml @@ -61,6 +61,7 @@ jobs: test: name: Test runs-on: ubuntu-latest + needs: build strategy: fail-fast: false max-parallel: 10 From 7a16b90222f6dfd068f467bbb347efe375d2ed2d Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Mon, 24 Apr 2023 12:58:38 -0500 Subject: [PATCH 063/105] Bugfix --- .github/workflows/deploy-DEV.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy-DEV.yml b/.github/workflows/deploy-DEV.yml index 470442b2189..92c56218da0 100644 --- a/.github/workflows/deploy-DEV.yml +++ b/.github/workflows/deploy-DEV.yml @@ -69,15 +69,21 @@ jobs: platform: [amd64] #,linux/arm64 -Temporary, getting no space left on device steps: - uses: actions/checkout@v3 + - name: Build image tag name + id: image_tag + run: | + BRANCH_NAME="${GITHUB_REF##*/}" + TAG="test-${{ github.actor }}-${BRANCH_NAME}" + echo "Tag name: ${TAG}" + echo "tag=${TAG}" >>"$GITHUB_OUTPUT" - uses: actions/download-artifact@v3 with: name: oci-tar - path: /oci-tar - name: Load image shell: bash run: | - if [[ -f /oci-tar/image.tar ]]; then - skopeo copy --override-os=linux --override-arch=${{ matrix.platform }} oci-archive:/oci-tar/image.tar oxsecurity/megalinter:${{ steps.image_tag.outputs.tag }} + if [[ -f image.tar ]]; then + skopeo copy --override-os=linux --override-arch=${{ matrix.platform }} oci-archive:image.tar docker-daemon:oxsecurity/megalinter:${{ steps.image_tag.outputs.tag }} fi # Free disk space - name: Free Disk space From 663a5a40f11cd28a8921463aa4b094e85cf171dc Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Mon, 15 May 2023 12:34:15 -0500 Subject: [PATCH 064/105] Bugfix --- megalinter/descriptors/env.megalinter-descriptor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/megalinter/descriptors/env.megalinter-descriptor.yml b/megalinter/descriptors/env.megalinter-descriptor.yml index 87474853bac..f61018396b7 100644 --- a/megalinter/descriptors/env.megalinter-descriptor.yml +++ b/megalinter/descriptors/env.megalinter-descriptor.yml @@ -21,7 +21,7 @@ linters: install: dockerfile: - FROM dotenvlinter/dotenv-linter:latest as dotenvlinter - - COPY --link --from=actionlint /dotenv-linter /usr/bin/dotenv-linter + - COPY --link --from=dotenvlinter /dotenv-linter /usr/bin/dotenv-linter supported_platforms: platform: - linux/amd64 From b3a28db2eaf915275f32c0e599f572c92f46c213 Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Mon, 15 May 2023 12:42:33 -0500 Subject: [PATCH 065/105] Bugfix --- .automation/build.py | 1 + 1 file changed, 1 insertion(+) diff --git a/.automation/build.py b/.automation/build.py index e72f63db8fc..82af2bf523b 100644 --- a/.automation/build.py +++ b/.automation/build.py @@ -479,6 +479,7 @@ def build_dockerfile( npm_packages += item["install"]["npm"] if not has_npm_copy: has_npm_copy = True + apk_npm_packages += ["npm"] docker_copy += ["COPY --link --from=node_modules /node-deps /node-deps"] # Collect python for venvs if "linter_name" in item and "pip" in item["install"]: From 8117096eaa4b260c25a07f62776061bc8490e53a Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Mon, 15 May 2023 14:18:06 -0500 Subject: [PATCH 066/105] Test fixes --- entrypoint.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index f9f024dcbdf..b1166cf4d5e 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -35,9 +35,9 @@ if [ "${UPGRADE_LINTERS_VERSION}" == "true" ]; then echo "[MegaLinter init] UPGRADING LINTER VERSION" pip install pytest-cov pytest-timeout # Run only get_linter_version test methods - pytest -v --durations=0 -k _get_linter_version megalinter/ + pytest -v --durations=0 -k _get_linter_version /venvs/megalinter/ # Run only get_linter_help test methods - pytest -v --durations=0 -k _get_linter_help megalinter/ + pytest -v --durations=0 -k _get_linter_help /venvs/megalinter/ # Reinstall mkdocs-material because of broken dependency pip3 install --upgrade "markdown==3.3.7" mike mkdocs-material "pymdown-extensions==9.11" "mkdocs-glightbox==0.3.2" mdx_truly_sane_lists jsonschema json-schema-for-humans giturlparse webpreview "github-dependents-info==0.10.0" cd /tmp/lint || exit 1 @@ -51,9 +51,9 @@ if [ "${TEST_CASE_RUN}" == "true" ]; then echo "[MegaLinter init] RUNNING TEST CASES" pip install pytest-cov pytest-timeout pytest-xdist if [ -z "${TEST_KEYWORDS}" ]; then - pytest -v --timeout=300 --durations=0 --cov=megalinter --cov-report=xml megalinter/ + pytest -v --timeout=300 --durations=0 --cov=megalinter --cov-report=xml /venvs/megalinter/ else - pytest -v --timeout=300 --durations=0 -k "${TEST_KEYWORDS}" megalinter/ + pytest -v --timeout=300 --durations=0 -k "${TEST_KEYWORDS}" /venvs/megalinter/ fi PYTEST_STATUS=$? echo Pytest exited $PYTEST_STATUS From 13d88631a944d62ed2621594732bde77a8bfc8e2 Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Mon, 15 May 2023 15:22:03 -0500 Subject: [PATCH 067/105] Delete tar file after loading --- .github/workflows/deploy-DEV.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/deploy-DEV.yml b/.github/workflows/deploy-DEV.yml index 92c56218da0..f63f99fe50b 100644 --- a/.github/workflows/deploy-DEV.yml +++ b/.github/workflows/deploy-DEV.yml @@ -84,6 +84,7 @@ jobs: run: | if [[ -f image.tar ]]; then skopeo copy --override-os=linux --override-arch=${{ matrix.platform }} oci-archive:image.tar docker-daemon:oxsecurity/megalinter:${{ steps.image_tag.outputs.tag }} + rm -f image.tar fi # Free disk space - name: Free Disk space From e20c905f22cb8640ecc704e6c3a7a175c0617311 Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Wed, 17 May 2023 08:27:03 -0500 Subject: [PATCH 068/105] Test fix --- entrypoint.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index b1166cf4d5e..3f2dd856c97 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -35,9 +35,9 @@ if [ "${UPGRADE_LINTERS_VERSION}" == "true" ]; then echo "[MegaLinter init] UPGRADING LINTER VERSION" pip install pytest-cov pytest-timeout # Run only get_linter_version test methods - pytest -v --durations=0 -k _get_linter_version /venvs/megalinter/ + pytest -v --durations=0 -k _get_linter_version /tmp/lint # Run only get_linter_help test methods - pytest -v --durations=0 -k _get_linter_help /venvs/megalinter/ + pytest -v --durations=0 -k _get_linter_help /tmp/lint # Reinstall mkdocs-material because of broken dependency pip3 install --upgrade "markdown==3.3.7" mike mkdocs-material "pymdown-extensions==9.11" "mkdocs-glightbox==0.3.2" mdx_truly_sane_lists jsonschema json-schema-for-humans giturlparse webpreview "github-dependents-info==0.10.0" cd /tmp/lint || exit 1 @@ -51,9 +51,9 @@ if [ "${TEST_CASE_RUN}" == "true" ]; then echo "[MegaLinter init] RUNNING TEST CASES" pip install pytest-cov pytest-timeout pytest-xdist if [ -z "${TEST_KEYWORDS}" ]; then - pytest -v --timeout=300 --durations=0 --cov=megalinter --cov-report=xml /venvs/megalinter/ + pytest -v --timeout=300 --durations=0 --cov=megalinter --cov-report=xml /tmp/lint else - pytest -v --timeout=300 --durations=0 -k "${TEST_KEYWORDS}" /venvs/megalinter/ + pytest -v --timeout=300 --durations=0 -k "${TEST_KEYWORDS}" /tmp/lint fi PYTEST_STATUS=$? echo Pytest exited $PYTEST_STATUS From 6fb1919fb830686f0b3efe512d186ed5f44e2670 Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Wed, 17 May 2023 11:02:16 -0500 Subject: [PATCH 069/105] Tweaked the python run commands --- .automation/build.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.automation/build.py b/.automation/build.py index 82af2bf523b..a9dbb8dd344 100644 --- a/.automation/build.py +++ b/.automation/build.py @@ -655,11 +655,12 @@ def build_dockerfile( pip_linter_env = data["env"] pipenv_download_list += pip_linter_packages pipenv_install_command += ( - f'RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \\\n mkdir -p "/venvs/{pip_linter}" ' - + f'&& cd "/venvs/{pip_linter}" ' - + "&& python3 -m crossenv /usr/local/bin/target-python3 . " - + "&& source bin/activate " - + f"&& PYTHONDONTWRITEBYTECODE=1 {pip_linter_env} pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip " + 'RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \\\n' + f' mkdir -p "/venvs/{pip_linter}" \\\n' + + f' && cd "/venvs/{pip_linter}" \\\n' + + " && python3 -m crossenv /usr/local/bin/target-python3 . \\\n" + + " && source bin/activate \\\n" + + f" && PYTHONDONTWRITEBYTECODE=1 {pip_linter_env} pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip " + (" ".join(pip_linter_packages)) + "\\n" ) From b1689863cc1356bbdedc4921069caea3136b7c7d Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Wed, 17 May 2023 13:26:13 -0500 Subject: [PATCH 070/105] Fix env --- .automation/build.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.automation/build.py b/.automation/build.py index a9dbb8dd344..a63495b5015 100644 --- a/.automation/build.py +++ b/.automation/build.py @@ -664,7 +664,7 @@ def build_dockerfile( + (" ".join(pip_linter_packages)) + "\\n" ) - pipenv_path_command += f":/venvs/{pip_linter}/bin" + pipenv_path_command += f":/venvs/{pip_linter}/cross/bin" pipenv_download_command += ( '&& pip download --cache-dir=/var/cache/pip --dest "/download" \\\n ' + (" \\\n ".join(pipenv_download_list)) From 1fd1b01d115f13684d209687868021534807495c Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Thu, 18 May 2023 16:13:26 -0500 Subject: [PATCH 071/105] Bugfix --- megalinter/descriptors/scala.megalinter-descriptor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/megalinter/descriptors/scala.megalinter-descriptor.yml b/megalinter/descriptors/scala.megalinter-descriptor.yml index d6e287a0932..b4f07c6bfca 100644 --- a/megalinter/descriptors/scala.megalinter-descriptor.yml +++ b/megalinter/descriptors/scala.megalinter-descriptor.yml @@ -46,7 +46,7 @@ linters: build_platform_dockerfile: - RUN ./coursier install scalafix --quiet --install-dir /usr/bin && rm -rf /root/.cache dockerfile: - - COPY --link --from=build-platform /usr/bin/scalafix /usr/bin + - COPY --link --from=build-platform /usr/bin/scalafix /usr/bin/ supported_platforms: platform: - linux/amd64 From 5c284d14f71cf26f91539132be764e2b1742cfd7 Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Wed, 19 Jul 2023 10:09:56 -0500 Subject: [PATCH 072/105] Fixed the make file --- .config/make/python.mak | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.config/make/python.mak b/.config/make/python.mak index 0f9a342e3af..e503623f69e 100644 --- a/.config/make/python.mak +++ b/.config/make/python.mak @@ -20,28 +20,28 @@ python-bootstrap-dev: ## Bootstrap python for dev env # =============================================================================================== .PHONY: python-venv-init python-venv-init: ## Create venv ".venv/" if not exist - if [ ! -d .venv ] ; then - $(python_launcher) -m venv .venv + if [[ ! -d .venv ]] ; then \ + $(python_launcher) -m venv .venv; \ fi .PHONY: python-venv-upgrade python-venv-upgrade: ## Upgrade venv with pip, setuptools and wheel - source .venv/bin/activate + . .venv/bin/activate; \ pip install --upgrade pip setuptools wheel .PHONY: python-venv-requirements python-venv-requirements: ## Install or upgrade from $(python_requirements_file) - source .venv/bin/activate + . .venv/bin/activate; \ pip install --upgrade --requirement $(python_requirements_file) .PHONY: python-venv-requirements-dev python-venv-requirements-dev: ## Install or upgrade from $(python_requirements_dev_file) - source .venv/bin/activate + . .venv/bin/activate; \ pip install --upgrade --requirement $(python_requirements_dev_file) .PHONY: python-venv-linters-install python-venv-linters-install: ## Install or upgrade linters - source .venv/bin/activate + . .venv/bin/activate; \ pip install --upgrade flake8 .PHONY: python-venv-purge @@ -54,22 +54,22 @@ python-venv-purge: ## Remove venv ".venv/" folder .PHONY: python-purge-cache python-purge-cache: ## Purge cache to avoid used cached files if [ -d .venv ] ; then - source .venv/bin/activate + . .venv/bin/activate; \ pip cache purge fi .PHONY: python-version python-version: ## Displays the python version used for the .venv - source .venv/bin/activate + . .venv/bin/activate; \ $(python_launcher) --version .PHONY: python-flake8 python-flake8: ## Run flake8 linter for python - source .venv/bin/activate + . .venv/bin/activate; \ flake8 --config .config/.flake8 .PHONY: python-pytest python-pytest: ## Run pytest to test python scripts - source .venv/bin/activate + . .venv/bin/activate; \ cd scripts/ $(python_launcher) -m pytest From cc781df57b6ee7f6af7e374b8ea523a1a85b6477 Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Wed, 19 Jul 2023 10:17:27 -0500 Subject: [PATCH 073/105] Updating after rebase --- Dockerfile | 374 +++++++++++------- docs/all_linters.md | 220 +++++------ docs/descriptors/arm_arm_ttk.md | 9 +- docs/descriptors/bash_bash_exec.md | 4 +- docs/descriptors/bicep_bicep_linter.md | 12 +- docs/descriptors/dart_dartanalyzer.md | 7 +- docs/descriptors/env_dotenv_linter.md | 3 +- docs/descriptors/php_phpstan.md | 3 +- docs/descriptors/powershell_powershell.md | 9 +- .../powershell_powershell_formatter.md | 9 +- docs/descriptors/python_ruff.md | 16 +- docs/descriptors/scala.md | 7 - docs/descriptors/scala_scalafix.md | 7 +- docs/descriptors/xml_xmllint.md | 2 +- flavors/ci_light/Dockerfile | 52 +-- flavors/cupcake/Dockerfile | 289 +++++++++----- flavors/documentation/Dockerfile | 138 ++++--- flavors/dotnet/Dockerfile | 163 ++++---- flavors/dotnetweb/Dockerfile | 163 ++++---- flavors/go/Dockerfile | 143 ++++--- flavors/java/Dockerfile | 151 ++++--- flavors/javascript/Dockerfile | 135 ++++--- flavors/php/Dockerfile | 149 ++++--- flavors/python/Dockerfile | 221 +++++++---- flavors/ruby/Dockerfile | 135 ++++--- flavors/rust/Dockerfile | 169 +++++--- flavors/salesforce/Dockerfile | 141 ++++--- flavors/security/Dockerfile | 99 ++--- flavors/swift/Dockerfile | 133 ++++--- flavors/terraform/Dockerfile | 151 ++++--- linters/action_actionlint/Dockerfile | 4 - linters/ansible_ansible_lint/Dockerfile | 11 +- linters/arm_arm_ttk/Dockerfile | 4 +- linters/bash_exec/Dockerfile | 6 +- linters/bash_shellcheck/Dockerfile | 8 +- linters/bash_shfmt/Dockerfile | 2 - linters/bicep_bicep_linter/Dockerfile | 2 +- linters/c_cpplint/Dockerfile | 11 +- linters/clojure_clj_kondo/Dockerfile | 4 +- linters/clojure_cljstyle/Dockerfile | 4 +- linters/cloudformation_cfn_lint/Dockerfile | 11 +- linters/coffee_coffeelint/Dockerfile | 2 +- linters/copypaste_jscpd/Dockerfile | 2 +- linters/cpp_cpplint/Dockerfile | 11 +- linters/csharp_csharpier/Dockerfile | 4 +- linters/csharp_dotnet_format/Dockerfile | 2 +- linters/css_stylelint/Dockerfile | 2 +- linters/dart_dartanalyzer/Dockerfile | 4 +- linters/dockerfile_hadolint/Dockerfile | 2 - .../Dockerfile | 2 - linters/env_dotenv_linter/Dockerfile | 6 +- linters/gherkin_gherkin_lint/Dockerfile | 2 +- linters/go_golangci_lint/Dockerfile | 2 +- linters/go_revive/Dockerfile | 2 - .../graphql_graphql_schema_linter/Dockerfile | 2 +- linters/groovy_npm_groovy_lint/Dockerfile | 2 +- linters/html_djlint/Dockerfile | 11 +- linters/html_htmlhint/Dockerfile | 2 +- linters/java_checkstyle/Dockerfile | 4 +- linters/java_pmd/Dockerfile | 4 +- linters/javascript_es/Dockerfile | 2 +- linters/javascript_prettier/Dockerfile | 2 +- linters/javascript_standard/Dockerfile | 2 +- linters/json_eslint_plugin_jsonc/Dockerfile | 2 +- linters/json_jsonlint/Dockerfile | 2 +- linters/json_npm_package_json_lint/Dockerfile | 2 +- linters/json_prettier/Dockerfile | 2 +- linters/json_v8r/Dockerfile | 2 +- linters/jsx_eslint/Dockerfile | 2 +- linters/kotlin_ktlint/Dockerfile | 2 +- linters/kubernetes_kubeconform/Dockerfile | 2 - linters/kubernetes_kubescape/Dockerfile | 2 +- linters/latex_chktex/Dockerfile | 3 +- linters/lua_luacheck/Dockerfile | 2 +- linters/makefile_checkmake/Dockerfile | 2 - .../markdown_markdown_link_check/Dockerfile | 2 +- .../Dockerfile | 2 +- linters/markdown_markdownlint/Dockerfile | 2 +- linters/markdown_remark_lint/Dockerfile | 2 +- linters/openapi_spectral/Dockerfile | 2 +- linters/perl_perlcritic/Dockerfile | 2 +- linters/php_phpcs/Dockerfile | 4 +- linters/php_phplint/Dockerfile | 4 +- linters/php_phpstan/Dockerfile | 8 +- linters/php_psalm/Dockerfile | 4 +- linters/powershell_powershell/Dockerfile | 4 +- .../Dockerfile | 4 +- linters/protobuf_protolint/Dockerfile | 2 - linters/python_bandit/Dockerfile | 11 +- linters/python_black/Dockerfile | 11 +- linters/python_flake8/Dockerfile | 11 +- linters/python_isort/Dockerfile | 11 +- linters/python_mypy/Dockerfile | 13 +- linters/python_pylint/Dockerfile | 11 +- linters/python_pyright/Dockerfile | 11 +- linters/python_ruff/Dockerfile | 17 +- linters/r_lintr/Dockerfile | 2 +- linters/raku_raku/Dockerfile | 2 +- linters/repository_checkov/Dockerfile | 11 +- linters/repository_devskim/Dockerfile | 2 +- linters/repository_dustilock/Dockerfile | 2 - linters/repository_gitleaks/Dockerfile | 2 - linters/repository_grype/Dockerfile | 2 +- linters/repository_kics/Dockerfile | 4 +- linters/repository_secretlint/Dockerfile | 2 +- linters/repository_semgrep/Dockerfile | 11 +- linters/repository_syft/Dockerfile | 2 +- linters/repository_trivy/Dockerfile | 2 +- linters/repository_trivy_sbom/Dockerfile | 2 +- linters/repository_trufflehog/Dockerfile | 2 - linters/rst_rst_lint/Dockerfile | 11 +- linters/rst_rstcheck/Dockerfile | 11 +- linters/rst_rstfmt/Dockerfile | 11 +- linters/rust_clippy/Dockerfile | 37 +- .../salesforce_sfdx_scanner_apex/Dockerfile | 6 +- .../salesforce_sfdx_scanner_aura/Dockerfile | 6 +- .../salesforce_sfdx_scanner_lwc/Dockerfile | 6 +- linters/scala_scalafix/Dockerfile | 8 +- linters/snakemake_lint/Dockerfile | 11 +- linters/snakemake_snakefmt/Dockerfile | 11 +- linters/spell_cspell/Dockerfile | 2 +- linters/spell_lychee/Dockerfile | 2 - linters/spell_proselint/Dockerfile | 11 +- linters/spell_vale/Dockerfile | 2 - linters/sql_sql_lint/Dockerfile | 2 +- linters/sql_sqlfluff/Dockerfile | 11 +- linters/sql_tsqllint/Dockerfile | 2 +- linters/tekton_tekton_lint/Dockerfile | 2 +- linters/terraform_terraform_fmt/Dockerfile | 2 - linters/terraform_terragrunt/Dockerfile | 2 - linters/terraform_terrascan/Dockerfile | 2 - linters/terraform_tflint/Dockerfile | 2 - linters/tsx_eslint/Dockerfile | 2 +- linters/typescript_es/Dockerfile | 2 +- linters/typescript_prettier/Dockerfile | 2 +- linters/typescript_standard/Dockerfile | 2 +- linters/vbdotnet_dotnet_format/Dockerfile | 2 +- linters/yaml_prettier/Dockerfile | 2 +- linters/yaml_v8r/Dockerfile | 2 +- linters/yaml_yamllint/Dockerfile | 11 +- 140 files changed, 1949 insertions(+), 1702 deletions(-) diff --git a/Dockerfile b/Dockerfile index 48c950c7bfa..d864e54fbe7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,6 +20,7 @@ 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 dotenvlinter/dotenv-linter:latest as dotenvlinter FROM golang:1-alpine as revive ## The golang image used as a builder is a temporary workaround ## for the released revive binaries not returning version numbers (devel). @@ -31,6 +32,15 @@ FROM ghcr.io/assignuser/chktex-alpine:latest as chktex FROM mrtazz/checkmake:latest as checkmake FROM ghcr.io/phpstan/phpstan:latest-php8.1 as phpstan FROM yoheimuta/protolint:latest as protolint +FROM --platform=$BUILDPLATFORM alpine:3 AS fetch-ruff +ARG BUILDARCH +RUN --mount=type=cache,target=/var/cache/apk,id=apk-${BUILDARCH},sharing=locked \ + apk add --update curl +WORKDIR / +ARG TARGETARCH +RUN export DL_LOCATION="https://github.com/charliermarsh/ruff/releases/latest/download/ruff-$([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64" || echo "aarch64")-unknown-linux-musl.tar.gz" \ + && echo "Downloading from ${DL_LOCATION}" \ + && curl --location "${DL_LOCATION}" | tar -xzv FROM golang:alpine as dustilock RUN GOBIN=/usr/bin go install github.com/checkmarx/dustilock@v1.2.0 @@ -44,6 +54,43 @@ FROM tenable/terrascan:1.18.1 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 --platform=$BUILDPLATFORM alpine:3 AS cargo-build +WORKDIR /cargo +ENV HOME=/cargo +USER 0 +RUN --mount=type=cache,target=/var/cache/apk,id=apk-${BUILDARCH},sharing=locked \ + apk add --update \ + gcc \ + rustup \ + bash \ + git \ + musl-dev \ + llvm \ + clang \ + curl +RUN curl --location "https://github.com/cargo-bins/cargo-binstall/releases/latest/download/cargo-binstall-$([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64" || echo "aarch64")-unknown-linux-musl.tgz" | tar -xzv \ + && mkdir -p /cargo/.cargo/bin \ + && mv cargo-binstall /cargo/.cargo/bin \ + && chown -R 63425:63425 /cargo +USER 63425 +ENV CC_aarch64_unknown_linux_musl=clang \ + AR_aarch64_unknown_linux_musl=llvm-ar \ + CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_RUSTFLAGS="-Clink-self-contained=yes -Clinker=rust-lld" \ + CC_x86_64_unknown_linux_musl=clang \ + AR_x86_64_unknown_linux_musl=llvm-ar \ + CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_RUSTFLAGS="-Clink-self-contained=yes -Clinker=rust-lld" +ARG TARGETARCH +RUN rustup-init -y --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") + +RUN --mount=type=cache,id=cargo-${TARGETARCH},sharing=locked,target=/cargo/.cargo/registry/,uid=63425 \ + . /cargo/.cargo/env \ + && cargo binstall --no-confirm --no-symlinks sarif-fmt shellcheck-sarif --root /tmp --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") + +FROM scratch AS cargo +COPY --link --from=cargo-build /tmp/bin/* /bin/ +RUN ["/bin/sarif-fmt", "--help"] +RUN ["/bin/shellcheck-sarif", "--help"] + #FROM__END ################## @@ -169,31 +216,133 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END #PIPVENV__START -RUN PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir --upgrade pip virtualenv \ - && mkdir -p "/venvs/ansible-lint" && cd "/venvs/ansible-lint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir ansible-lint && deactivate && cd ./../.. \ - && mkdir -p "/venvs/cpplint" && cd "/venvs/cpplint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir cpplint && deactivate && cd ./../.. \ - && mkdir -p "/venvs/cfn-lint" && cd "/venvs/cfn-lint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir cfn-lint && deactivate && cd ./../.. \ - && mkdir -p "/venvs/djlint" && cd "/venvs/djlint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir djlint && deactivate && cd ./../.. \ - && mkdir -p "/venvs/pylint" && cd "/venvs/pylint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir pylint typing-extensions && deactivate && cd ./../.. \ - && mkdir -p "/venvs/black" && cd "/venvs/black" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir black && deactivate && cd ./../.. \ - && mkdir -p "/venvs/flake8" && cd "/venvs/flake8" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir flake8 && deactivate && cd ./../.. \ - && mkdir -p "/venvs/isort" && cd "/venvs/isort" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir isort black && deactivate && cd ./../.. \ - && mkdir -p "/venvs/bandit" && cd "/venvs/bandit" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir bandit bandit_sarif_formatter bandit[toml] && deactivate && cd ./../.. \ - && mkdir -p "/venvs/mypy" && cd "/venvs/mypy" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir mypy && deactivate && cd ./../.. \ - && mkdir -p "/venvs/pyright" && cd "/venvs/pyright" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir pyright && deactivate && cd ./../.. \ - && mkdir -p "/venvs/ruff" && cd "/venvs/ruff" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir ruff && deactivate && cd ./../.. \ - && mkdir -p "/venvs/checkov" && cd "/venvs/checkov" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir packaging checkov && deactivate && cd ./../.. \ - && mkdir -p "/venvs/semgrep" && cd "/venvs/semgrep" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir semgrep && deactivate && cd ./../.. \ - && mkdir -p "/venvs/rst-lint" && cd "/venvs/rst-lint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir restructuredtext_lint && deactivate && cd ./../.. \ - && mkdir -p "/venvs/rstcheck" && cd "/venvs/rstcheck" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir rstcheck && deactivate && cd ./../.. \ - && mkdir -p "/venvs/rstfmt" && cd "/venvs/rstfmt" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir rstfmt && deactivate && cd ./../.. \ - && mkdir -p "/venvs/snakemake" && cd "/venvs/snakemake" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir snakemake && deactivate && cd ./../.. \ - && mkdir -p "/venvs/snakefmt" && cd "/venvs/snakefmt" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir snakefmt && deactivate && cd ./../.. \ - && mkdir -p "/venvs/proselint" && cd "/venvs/proselint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir proselint && deactivate && cd ./../.. \ - && mkdir -p "/venvs/sqlfluff" && cd "/venvs/sqlfluff" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir sqlfluff && deactivate && cd ./../.. \ - && mkdir -p "/venvs/yamllint" && cd "/venvs/yamllint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir yamllint && deactivate && cd ./../.. \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf && rm -rf /root/.cache -ENV PATH="${PATH}":/venvs/ansible-lint/bin:/venvs/cpplint/bin:/venvs/cfn-lint/bin:/venvs/djlint/bin:/venvs/pylint/bin:/venvs/black/bin:/venvs/flake8/bin:/venvs/isort/bin:/venvs/bandit/bin:/venvs/mypy/bin:/venvs/pyright/bin:/venvs/ruff/bin:/venvs/checkov/bin:/venvs/semgrep/bin:/venvs/rst-lint/bin:/venvs/rstcheck/bin:/venvs/rstfmt/bin:/venvs/snakemake/bin:/venvs/snakefmt/bin:/venvs/proselint/bin:/venvs/sqlfluff/bin:/venvs/yamllint/bin +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/ansible-lint" \ + && cd "/venvs/ansible-lint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip ansible-lint +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/cpplint" \ + && cd "/venvs/cpplint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip cpplint +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/cfn-lint" \ + && cd "/venvs/cfn-lint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip cfn-lint +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/djlint" \ + && cd "/venvs/djlint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip djlint +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/pylint" \ + && cd "/venvs/pylint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip pylint typing-extensions +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/black" \ + && cd "/venvs/black" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip black +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/flake8" \ + && cd "/venvs/flake8" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip flake8 +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/isort" \ + && cd "/venvs/isort" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip isort black +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/bandit" \ + && cd "/venvs/bandit" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip bandit bandit_sarif_formatter bandit[toml] +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/mypy" \ + && cd "/venvs/mypy" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip mypy +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/pyright" \ + && cd "/venvs/pyright" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip pyright +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/checkov" \ + && cd "/venvs/checkov" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip packaging checkov +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/semgrep" \ + && cd "/venvs/semgrep" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip semgrep +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/rst-lint" \ + && cd "/venvs/rst-lint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip restructuredtext_lint +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/rstcheck" \ + && cd "/venvs/rstcheck" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip rstcheck +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/rstfmt" \ + && cd "/venvs/rstfmt" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip rstfmt +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/snakemake" \ + && cd "/venvs/snakemake" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakemake +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/snakefmt" \ + && cd "/venvs/snakefmt" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakefmt +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/proselint" \ + && cd "/venvs/proselint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip proselint +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/sqlfluff" \ + && cd "/venvs/sqlfluff" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip sqlfluff +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/yamllint" \ + && cd "/venvs/yamllint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip yamllint + #PIPVENV__END ############################ @@ -307,7 +456,7 @@ RUN echo 'gem: --no-document' >> ~/.gemrc && \ #CARGO__START RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable \ && export PATH="/root/.cargo/bin:${PATH}" \ - && rustup component add clippy && cargo install --force --locked sarif-fmt shellcheck-sarif \ + && rustup component add clippy \ && rm -rf /root/.cargo/registry /root/.cargo/git /root/.cache/sccache ENV PATH="/root/.cargo/bin:${PATH}" #CARGO__END @@ -319,32 +468,38 @@ ENV PATH="/root/.cargo/bin:${PATH}" ############################################################################################# #COPY__START +COPY --link --from=node_modules /node-deps /node-deps 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 --link --from=build-platform /usr/bin/bash-exec /usr/bin/bash-exec # 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=dotenvlinter /dotenv-linter /usr/bin/dotenv-linter COPY --link --from=revive /usr/bin/revive /usr/bin/revive COPY --link --from=kubeconform /kubeconform /usr/bin/ COPY --link --from=chktex /usr/bin/chktex /usr/bin/ COPY --link --from=checkmake /checkmake /usr/bin/checkmake -COPY --link --from=phpstan /composer/vendor/phpstan/phpstan/phpstan.phar /usr/bin/phpstan +COPY --link --chmod=755 --from=phpstan /composer/vendor/phpstan/phpstan/phpstan.phar /usr/bin/phpstan COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ +COPY --link --from=fetch-ruff /ruff /usr/bin/ruff COPY --link --from=dustilock /usr/bin/dustilock /usr/bin/dustilock COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ COPY --link --from=kics /app/bin/kics /usr/bin/ COPY --from=kics /app/bin/assets /opt/kics/assets/ COPY --link --from=trufflehog /usr/bin/trufflehog /usr/bin/ +COPY --link --from=build-platform /usr/bin/scalafix /usr/bin/ COPY --link --from=vale /bin/vale /bin/vale COPY --link --from=lychee /usr/local/bin/lychee /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=cargo /bin/* /usr/bin/ #COPY__END ############################################################################################# @@ -369,7 +524,7 @@ RUN --mount=type=secret,id=GITHUB_TOKEN case ${TARGETPLATFORM} in \ | tar -xzC ${PWSH_DIRECTORY} \ && ln -sf ${PWSH_DIRECTORY}/pwsh /usr/bin/pwsh - +# # CLOJURE installation ENV LANG=C.UTF-8 RUN ALPINE_GLIBC_BASE_URL="https://github.com/sgerrand/alpine-pkg-glibc/releases/download" && \ @@ -411,14 +566,14 @@ RUN ALPINE_GLIBC_BASE_URL="https://github.com/sgerrand/alpine-pkg-glibc/releases "$ALPINE_GLIBC_BASE_PACKAGE_FILENAME" \ "$ALPINE_GLIBC_BIN_PACKAGE_FILENAME" \ "$ALPINE_GLIBC_I18N_PACKAGE_FILENAME" \ - +# # CSHARP installation && wget --tries=5 -q -O dotnet-install.sh https://dot.net/v1/dotnet-install.sh \ && chmod +x dotnet-install.sh \ && ./dotnet-install.sh --install-dir /usr/share/dotnet -channel 6.0 -version latest ENV PATH="${PATH}:/root/.dotnet/tools:/usr/share/dotnet" - +# # DART installation # Next line commented because already managed by another linter # ENV LANG=C.UTF-8 @@ -462,11 +617,11 @@ ENV PATH="${PATH}:/root/.dotnet/tools:/usr/share/dotnet" # "$ALPINE_GLIBC_BASE_PACKAGE_FILENAME" \ # "$ALPINE_GLIBC_BIN_PACKAGE_FILENAME" \ # "$ALPINE_GLIBC_I18N_PACKAGE_FILENAME" - +# # JAVA installation ENV JAVA_HOME=/usr/lib/jvm/java-11-openjdk ENV PATH="$JAVA_HOME/bin:${PATH}" - +# # PHP installation RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GITHUB_TOKEN)" \ && export GITHUB_AUTH_TOKEN \ @@ -483,7 +638,7 @@ RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GI && rm phive.phar.asc \ && update-alternatives --install /usr/bin/php php /usr/bin/php81 110 - +# # POWERSHELL installation RUN --mount=type=secret,id=GITHUB_TOKEN case ${TARGETPLATFORM} in \ "linux/amd64") POWERSHELL_ARCH=alpine-x64 ;; \ @@ -502,7 +657,7 @@ RUN --mount=type=secret,id=GITHUB_TOKEN case ${TARGETPLATFORM} in \ && ln -sf ${PWSH_DIRECTORY}/pwsh /usr/bin/pwsh \ && chmod +x /usr/bin/pwsh - +# # SALESFORCE installation # Next line commented because already managed by another linter # ENV JAVA_HOME=/usr/lib/jvm/java-11-openjdk @@ -510,13 +665,9 @@ RUN --mount=type=secret,id=GITHUB_TOKEN case ${TARGETPLATFORM} in \ # ENV PATH="$JAVA_HOME/bin:${PATH}" RUN echo y|sfdx plugins:install sfdx-hardis \ && npm cache clean --force || true \ - && rm -rf /root/.npm/_cacache \ - -# SCALA installation - && curl --retry-all-errors --retry 10 -fLo coursier https://git.io/coursier-cli && \ - chmod +x coursier - + && rm -rf /root/.npm/_cacache +# # VBDOTNET installation # Next line commented because already managed by another linter # RUN wget --tries=5 -q -O dotnet-install.sh https://dot.net/v1/dotnet-install.sh \ @@ -524,12 +675,7 @@ RUN echo y|sfdx plugins:install sfdx-hardis \ # && ./dotnet-install.sh --install-dir /usr/share/dotnet -channel 6.0 -version latest # Next line commented because already managed by another linter # ENV PATH="${PATH}:/root/.dotnet/tools:/usr/share/dotnet" - -# actionlint installation -# 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" RUN curl --retry 5 --retry-delay 5 -sLO "${ARM_TTK_URI}" \ @@ -537,18 +683,7 @@ RUN curl --retry 5 --retry-delay 5 -sLO "${ARM_TTK_URI}" \ && rm "${ARM_TTK_NAME}" \ && ln -sTf "${ARM_TTK_PSD1}" /usr/bin/arm-ttk \ && chmod a+x /usr/bin/arm-ttk \ - -# 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 -# 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 --link --from=shfmt /bin/shfmt /usr/bin/ - +# # bicep_linter installation && case ${TARGETPLATFORM} in \ "linux/amd64") POWERSHELL_ARCH=musl-x64 ;; \ @@ -557,20 +692,20 @@ esac \ && curl --retry 5 --retry-delay 5 -sLo ${BICEP_EXE} "https://github.com/Azure/bicep/releases/latest/download/bicep-linux-${POWERSHELL_ARCH}" \ && chmod +x "${BICEP_EXE}" \ && mv "${BICEP_EXE}" "${BICEP_DIR}" \ - +# # clj-kondo installation && curl --retry 5 --retry-delay 5 -sLO https://raw.githubusercontent.com/clj-kondo/clj-kondo/master/script/install-clj-kondo \ && chmod +x install-clj-kondo \ && ./install-clj-kondo \ - +# # cljstyle installation && curl --retry 5 --retry-delay 5 -sLO https://raw.githubusercontent.com/greglook/cljstyle/main/script/install-cljstyle \ && chmod +x install-cljstyle \ && ./install-cljstyle \ - +# # csharpier installation && /usr/share/dotnet/dotnet tool install -g csharpier \ - +# # dartanalyzer installation && case ${TARGETPLATFORM} in \ "linux/amd64") DART_ARCH=x64 ;; \ @@ -580,24 +715,12 @@ esac \ && chmod +x dart-sdk/bin/dart* \ && mv dart-sdk/bin/* /usr/bin/ && mv dart-sdk/lib/* /usr/lib/ && mv dart-sdk/include/* /usr/include/ \ && rm -r dart-sdk/ \ - -# hadolint installation -# Managed with COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint - -# editorconfig-checker installation -# 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 - -# revive installation -# 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 \ -H "Accept: application/vnd.github+json" \ @@ -609,30 +732,26 @@ RUN --mount=type=secret,id=GITHUB_TOKEN CHECKSTYLE_LATEST=$(curl -s \ && curl --retry 5 --retry-delay 5 -sSL $CHECKSTYLE_LATEST \ --output /usr/bin/checkstyle - +# # pmd installation RUN wget --quiet https://github.com/pmd/pmd/releases/download/pmd_releases%2F${PMD_VERSION}/pmd-bin-${PMD_VERSION}.zip && \ unzip pmd-bin-${PMD_VERSION}.zip && \ rm pmd-bin-${PMD_VERSION}.zip && \ mv pmd-bin-${PMD_VERSION} /usr/bin/pmd && \ chmod +x /usr/bin/pmd/bin/run.sh \ - +# # ktlint installation && curl --retry 5 --retry-delay 5 -sSLO https://github.com/pinterest/ktlint/releases/latest/download/ktlint && \ chmod a+x ktlint && \ mv "ktlint" /usr/bin/ \ - -# kubeconform installation -# Managed with COPY --link --from=kubeconform /kubeconform /usr/bin/ - +# # kubescape installation && ln -s /lib/libc.so.6 /usr/lib/libresolv.so.2 && \ curl --retry 5 --retry-delay 5 -sLv https://raw.githubusercontent.com/kubescape/kubescape/master/install.sh | /bin/bash -s -- -v v2.3.6 \ - +# # chktex installation -# Managed with COPY --link --from=chktex /usr/bin/chktex /usr/bin/ && cd ~ && touch .chktexrc && cd / \ - +# # luacheck installation && wget --tries=5 https://www.lua.org/ftp/lua-5.3.5.tar.gz -O - -q | tar -xzf - \ && cd lua-5.3.5 \ @@ -647,48 +766,38 @@ RUN wget --quiet https://github.com/pmd/pmd/releases/download/pmd_releases%2F${P && cd .. && rm -r luarocks-3.3.1-super-linter/ \ && luarocks install luacheck \ && cd / \ - -# checkmake installation -# 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 - +# # 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 - -# phpstan installation -# Managed with COPY --link --from=phpstan /composer/vendor/phpstan/phpstan/phpstan.phar /usr/bin/phpstan -RUN chmod +x /usr/bin/phpstan - +# # psalm installation RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GITHUB_TOKEN)" && export GITHUB_AUTH_TOKEN && phive --no-progress install psalm -g --trust-gpg-keys 8A03EA3B385DBAA1,12CE0F1D262429A5 - +# # phplint installation RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GITHUB_TOKEN)" && export GITHUB_AUTH_TOKEN && phive --no-progress install overtrue/phplint --force-accept-unsigned -g - +# # powershell installation RUN pwsh -c 'Install-Module -Name PSScriptAnalyzer -RequiredVersion ${PSSA_VERSION} -Scope AllUsers -Force' - +# # powershell_formatter installation # Next line commented because already managed by another linter # RUN pwsh -c 'Install-Module -Name PSScriptAnalyzer -RequiredVersion ${PSSA_VERSION} -Scope AllUsers -Force' - -# protolint installation -# Managed with COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ - +# # mypy installation ENV MYPY_CACHE_DIR=/tmp - +# # lintr installation RUN mkdir -p /home/r-library \ && cp -r /usr/lib/R/library/ /home/r-library/ \ && Rscript -e "install.packages(c('lintr','purrr'), repos = 'https://cloud.r-project.org/')" \ && R -e "install.packages(list.dirs('/home/r-library',recursive = FALSE), repos = NULL, type = 'source')" \ - +# # raku installation && curl -L https://github.com/nxadm/rakudo-pkg/releases/download/v2020.10-02/rakudo-pkg-Alpine3.12_2020.10-02_x86_64.apk > rakudo-pkg-Alpine3.12_2020.10-02_x86_64.apk \ && apk add --no-cache --allow-untrusted rakudo-pkg-Alpine3.12_2020.10-02_x86_64.apk \ @@ -698,7 +807,7 @@ RUN mkdir -p /home/r-library \ && /opt/rakudo-pkg/bin/install-zef-as-user ENV PATH="~/.raku/bin:/opt/rakudo-pkg/bin:/opt/rakudo-pkg/share/perl6/site/bin:$PATH" - +# # devskim installation # Next line commented because already managed by another linter # RUN wget --tries=5 -q -O dotnet-install.sh https://dot.net/v1/dotnet-install.sh \ @@ -707,61 +816,41 @@ ENV PATH="~/.raku/bin:/opt/rakudo-pkg/bin:/opt/rakudo-pkg/share/perl6/site/bin:$ # Next line commented because already managed by another linter # ENV PATH="${PATH}:/root/.dotnet/tools:/usr/share/dotnet" RUN dotnet tool install --global Microsoft.CST.DevSkim.CLI \ - -# dustilock installation -# Managed with COPY --link --from=dustilock /usr/bin/dustilock /usr/bin/dustilock - -# gitleaks installation -# Managed with COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ - +# # grype installation && curl -sSfL https://raw.githubusercontent.com/anchore/grype/main/install.sh | sh -s -- -b /usr/local/bin v0.63.1 \ - +# # kics installation -# 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/ - +# # syft installation RUN curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b /usr/local/bin \ - +# # trivy installation && wget --tries=5 -q -O - https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin \ - +# # trivy-sbom installation # Next line commented because already managed by another linter # RUN wget --tries=5 -q -O - https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin - -# trufflehog installation -# Managed with COPY --link --from=trufflehog /usr/bin/trufflehog /usr/bin/ - +# # sfdx-scanner-apex installation && sfdx plugins:install @salesforce/sfdx-scanner \ && npm cache clean --force || true \ && rm -rf /root/.npm/_cacache \ - +# # sfdx-scanner-aura installation # Next line commented because already managed by another linter # RUN sfdx plugins:install @salesforce/sfdx-scanner \ # && npm cache clean --force || true \ # && rm -rf /root/.npm/_cacache - +# # sfdx-scanner-lwc installation # Next line commented because already managed by another linter # RUN sfdx plugins:install @salesforce/sfdx-scanner \ # && npm cache clean --force || true \ # && rm -rf /root/.npm/_cacache - -# scalafix installation - && ./coursier install scalafix --quiet --install-dir /usr/bin && rm -rf /root/.cache \ - -# vale installation -# Managed with COPY --link --from=vale /bin/vale /bin/vale - -# lychee installation -# Managed with COPY --link --from=lychee /usr/local/bin/lychee /usr/bin/ - +# # tsqllint installation # Next line commented because already managed by another linter # RUN wget --tries=5 -q -O dotnet-install.sh https://dot.net/v1/dotnet-install.sh \ @@ -770,19 +859,7 @@ RUN curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | # Next line commented because already managed by another linter # ENV PATH="${PATH}:/root/.dotnet/tools:/usr/share/dotnet" && dotnet tool install --global TSQLLint - -# tflint installation -# Managed with COPY --link --from=tflint /usr/local/bin/tflint /usr/bin/ - -# terrascan installation -# Managed with COPY --link --from=terrascan /go/bin/terrascan /usr/bin/ - -# terragrunt installation -# Managed with COPY --link --from=terragrunt /usr/local/bin/terragrunt /usr/bin/ - -# terraform-fmt installation -# Managed with COPY --link --from=terragrunt /bin/terraform /usr/bin/ - +# #OTHER__END ################################ @@ -840,7 +917,6 @@ LABEL com.github.actions.name="MegaLinter" \ org.opencontainers.image.description="Lint your code base with GitHub Actions" #EXTRA_DOCKERFILE_LINES__START -COPY entrypoint.sh /entrypoint.sh -RUN chmod +x entrypoint.sh +COPY --chmod=755 entrypoint.sh /entrypoint.sh ENTRYPOINT ["/bin/bash", "/entrypoint.sh"] #EXTRA_DOCKERFILE_LINES__END diff --git a/docs/all_linters.md b/docs/all_linters.md index 9438ca44a2c..3dc7fbce4c7 100644 --- a/docs/all_linters.md +++ b/docs/all_linters.md @@ -3,113 +3,113 @@ # References -| Linter | Version | License | Popularity | Descriptors | Ref | URL | -|:--------------------------------------------------------------------------------------------------------|:-------------:|:-------------------------------------------:|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:-------------------:|:---------------------------------------------------------------------------------------------------------------------------------------------------:| -| [**actionlint**](https://github.com/rhysd/actionlint){target=_blank} | 1.6.25 | [MIT](licenses/actionlint.md) | [![GitHub stars](https://img.shields.io/github/stars/rhysd/actionlint?cacheSeconds=3600)](https://github.com/rhysd/actionlint){target=_blank} | [ACTION](descriptors/action_actionlint.md) | :white_circle: | [Repository](https://github.com/rhysd/actionlint){target=_blank} | -| [**ansible-lint**](https://github.com/ansible/ansible-lint){target=_blank} | 6.17.2 | [GPL-3.0](licenses/ansible-lint.md) | [![GitHub stars](https://img.shields.io/github/stars/ansible/ansible-lint?cacheSeconds=3600)](https://github.com/ansible/ansible-lint){target=_blank} | [ANSIBLE](descriptors/ansible_ansible_lint.md) | :white_circle: | [Repository](https://github.com/ansible/ansible-lint){target=_blank} | -| [**arm-ttk**](https://github.com/Azure/arm-ttk){target=_blank} | N/A | [MIT](licenses/arm-ttk.md) | [![GitHub stars](https://img.shields.io/github/stars/Azure/arm-ttk?cacheSeconds=3600)](https://github.com/Azure/arm-ttk){target=_blank} | [ARM](descriptors/arm_arm_ttk.md) | :white_circle: | [Repository](https://github.com/Azure/arm-ttk){target=_blank} | -| [**bandit**](https://github.com/PyCQA/bandit){target=_blank} | 1.7.5 | [Apache-2.0](licenses/bandit.md) | [![GitHub stars](https://img.shields.io/github/stars/PyCQA/bandit?cacheSeconds=3600)](https://github.com/PyCQA/bandit){target=_blank} | [PYTHON](descriptors/python_bandit.md) | :white_circle: | [Repository](https://github.com/PyCQA/bandit){target=_blank} | -| [**bash-exec**](https://tiswww.case.edu/php/chet/bash/bashtop.html){target=_blank} | 5.2.15 | | | [BASH](descriptors/bash_bash_exec.md) | | [Web Site](https://tiswww.case.edu/php/chet/bash/bashtop.html){target=_blank} | -| [**bicep_linter**](https://github.com/Azure/bicep){target=_blank} | 0.19.5 | [MIT](licenses/bicep_linter.md) | [![GitHub stars](https://img.shields.io/github/stars/Azure/bicep?cacheSeconds=3600)](https://github.com/Azure/bicep){target=_blank} | [BICEP](descriptors/bicep_bicep_linter.md) | :white_circle: | [Repository](https://github.com/Azure/bicep){target=_blank} | -| [**black**](https://github.com/psf/black){target=_blank} | 23.7.0 | [MIT](licenses/black.md) | [![GitHub stars](https://img.shields.io/github/stars/psf/black?cacheSeconds=3600)](https://github.com/psf/black){target=_blank} | [PYTHON](descriptors/python_black.md) | :white_circle: | [Repository](https://github.com/psf/black){target=_blank} | -| [**cfn-lint**](https://github.com/aws-cloudformation/cfn-lint){target=_blank} | 0.78.1 | [MIT-0](licenses/cfn-lint.md) | [![GitHub stars](https://img.shields.io/github/stars/aws-cloudformation/cfn-lint?cacheSeconds=3600)](https://github.com/aws-cloudformation/cfn-lint){target=_blank} | [CLOUDFORMATION](descriptors/cloudformation_cfn_lint.md) | :white_circle: | [Repository](https://github.com/aws-cloudformation/cfn-lint){target=_blank} | -| [**checkmake**](https://github.com/mrtazz/checkmake){target=_blank} | 0.2.0 | [MIT](licenses/checkmake.md) | [![GitHub stars](https://img.shields.io/github/stars/mrtazz/checkmake?cacheSeconds=3600)](https://github.com/mrtazz/checkmake){target=_blank} | [MAKEFILE](descriptors/makefile_checkmake.md) | :white_circle: | [Repository](https://github.com/mrtazz/checkmake){target=_blank} | -| [**checkov**](https://github.com/bridgecrewio/checkov){target=_blank} | 2.3.326 | [Apache-2.0](licenses/checkov.md) | [![GitHub stars](https://img.shields.io/github/stars/bridgecrewio/checkov?cacheSeconds=3600)](https://github.com/bridgecrewio/checkov){target=_blank} | [REPOSITORY](descriptors/repository_checkov.md) | :no_entry_sign: | [Repository](https://github.com/bridgecrewio/checkov){target=_blank} | -| [**checkstyle**](https://github.com/checkstyle/checkstyle){target=_blank} | 10.12.1 | [LGPL-2.1](licenses/checkstyle.md) | [![GitHub stars](https://img.shields.io/github/stars/checkstyle/checkstyle?cacheSeconds=3600)](https://github.com/checkstyle/checkstyle){target=_blank} | [JAVA](descriptors/java_checkstyle.md) | :heart: | [MegaLinter reference](https://checkstyle.sourceforge.io/index.html#Related_Tools_Active_Tools){target=_blank} | -| [**chktex**](https://www.nongnu.org/chktex){target=_blank} | 1.7.6 | | | [LATEX](descriptors/latex_chktex.md) | :white_circle: | [Web Site](https://www.nongnu.org/chktex){target=_blank} | -| [**clippy**](https://github.com/rust-lang/rust-clippy){target=_blank} | 0.1.71 | [Other](licenses/clippy.md) | [![GitHub stars](https://img.shields.io/github/stars/rust-lang/rust-clippy?cacheSeconds=3600)](https://github.com/rust-lang/rust-clippy){target=_blank} | [RUST](descriptors/rust_clippy.md) | :white_circle: | [Repository](https://github.com/rust-lang/rust-clippy){target=_blank} | -| [**clj-kondo**](https://github.com/borkdude/clj-kondo){target=_blank} | 2023.07.13 | [EPL-1.0](licenses/clj-kondo.md) | [![GitHub stars](https://img.shields.io/github/stars/borkdude/clj-kondo?cacheSeconds=3600)](https://github.com/borkdude/clj-kondo){target=_blank} | [CLOJURE](descriptors/clojure_clj_kondo.md) | :heart: | [MegaLinter reference](https://github.com/borkdude/clj-kondo/blob/master/doc/ci-integration.md#github){target=_blank} | -| [**cljstyle**](https://github.com/greglook/cljstyle){target=_blank} | 0.15.0 | [EPL-1.0](licenses/cljstyle.md) | [![GitHub stars](https://img.shields.io/github/stars/greglook/cljstyle?cacheSeconds=3600)](https://github.com/greglook/cljstyle){target=_blank} | [CLOJURE](descriptors/clojure_cljstyle.md) | :heart: | [MegaLinter reference](https://github.com/greglook/cljstyle/blob/main/doc/integrations.md){target=_blank} | -| [**coffeelint**](https://github.com/clutchski/coffeelint){target=_blank} | 5.2.11 | [Other](licenses/coffeelint.md) | [![GitHub stars](https://img.shields.io/github/stars/clutchski/coffeelint?cacheSeconds=3600)](https://github.com/clutchski/coffeelint){target=_blank} | [COFFEE](descriptors/coffee_coffeelint.md) | :white_circle: | [Repository](https://github.com/clutchski/coffeelint){target=_blank} | -| [**cpplint**](https://github.com/cpplint/cpplint){target=_blank} | 1.6.1 | [Other](licenses/cpplint.md) | [![GitHub stars](https://img.shields.io/github/stars/cpplint/cpplint?cacheSeconds=3600)](https://github.com/cpplint/cpplint){target=_blank} | [C](descriptors/c_cpplint.md)
[CPP](descriptors/cpp_cpplint.md) | :white_circle: | [Repository](https://github.com/cpplint/cpplint){target=_blank} | -| [**csharpier**](https://github.com/belav/csharpier){target=_blank} | 0.25.0 | [MIT](licenses/csharpier.md) | [![GitHub stars](https://img.shields.io/github/stars/belav/csharpier?cacheSeconds=3600)](https://github.com/belav/csharpier){target=_blank} | [CSHARP](descriptors/csharp_csharpier.md) | :white_circle: | [Repository](https://github.com/belav/csharpier){target=_blank} | -| [**cspell**](https://github.com/streetsidesoftware/cspell){target=_blank} | 6.31.2 | [MIT](licenses/cspell.md) | [![GitHub stars](https://img.shields.io/github/stars/streetsidesoftware/cspell?cacheSeconds=3600)](https://github.com/streetsidesoftware/cspell){target=_blank} | [SPELL](descriptors/spell_cspell.md) | :heart: | [MegaLinter reference](https://github.com/streetsidesoftware/cspell/tree/master/packages/cspell#mega-linter){target=_blank} | -| [**dartanalyzer**](https://github.com/dart-lang/sdk){target=_blank} | N/A | [BSD-3-Clause](licenses/dartanalyzer.md) | [![GitHub stars](https://img.shields.io/github/stars/dart-lang/sdk?cacheSeconds=3600)](https://github.com/dart-lang/sdk){target=_blank} | [DART](descriptors/dart_dartanalyzer.md) | :no_entry_sign: | [Repository](https://github.com/dart-lang/sdk){target=_blank} | -| [**devskim**](https://github.com/microsoft/DevSkim){target=_blank} | 1.0.11 | [MIT](licenses/devskim.md) | [![GitHub stars](https://img.shields.io/github/stars/microsoft/DevSkim?cacheSeconds=3600)](https://github.com/microsoft/DevSkim){target=_blank} | [REPOSITORY](descriptors/repository_devskim.md) | :white_circle: | [Repository](https://github.com/microsoft/DevSkim){target=_blank} | -| [**djlint**](https://github.com/Riverside-Healthcare/djlint){target=_blank} | 1.31.1 | [GPL-3.0](licenses/djlint.md) | [![GitHub stars](https://img.shields.io/github/stars/Riverside-Healthcare/djlint?cacheSeconds=3600)](https://github.com/Riverside-Healthcare/djlint){target=_blank} | [HTML](descriptors/html_djlint.md) | :heart: | [MegaLinter reference](https://djlint.com/docs/integrations/#megalinter){target=_blank} | -| [**dotenv-linter**](https://github.com/dotenv-linter/dotenv-linter){target=_blank} | 3.3.0 | [MIT](licenses/dotenv-linter.md) | [![GitHub stars](https://img.shields.io/github/stars/dotenv-linter/dotenv-linter?cacheSeconds=3600)](https://github.com/dotenv-linter/dotenv-linter){target=_blank} | [ENV](descriptors/env_dotenv_linter.md) | :heart: | [MegaLinter reference](https://dotenv-linter.github.io/#/integrations/mega_linter){target=_blank} | -| [**dotnet-format**](https://github.com/dotnet/format){target=_blank} | 6.0.412 | [MIT](licenses/dotnet-format.md) | [![GitHub stars](https://img.shields.io/github/stars/dotnet/format?cacheSeconds=3600)](https://github.com/dotnet/format){target=_blank} | [CSHARP](descriptors/csharp_dotnet_format.md)
[VBDOTNET](descriptors/vbdotnet_dotnet_format.md) | :white_circle: | [Repository](https://github.com/dotnet/format){target=_blank} | -| [**dustilock**](https://github.com/Checkmarx/dustilock){target=_blank} | 1.2.0 | [Apache-2.0](licenses/dustilock.md) | [![GitHub stars](https://img.shields.io/github/stars/Checkmarx/dustilock?cacheSeconds=3600)](https://github.com/Checkmarx/dustilock){target=_blank} | [REPOSITORY](descriptors/repository_dustilock.md) | :white_circle: | [Repository](https://github.com/Checkmarx/dustilock){target=_blank} | -| [**editorconfig-checker**](https://github.com/editorconfig-checker/editorconfig-checker){target=_blank} | 2.7.0 | [MIT](licenses/editorconfig-checker.md) | [![GitHub stars](https://img.shields.io/github/stars/editorconfig-checker/editorconfig-checker?cacheSeconds=3600)](https://github.com/editorconfig-checker/editorconfig-checker){target=_blank} | [EDITORCONFIG](descriptors/editorconfig_editorconfig_checker.md) | :heart: | [MegaLinter reference](https://github.com/editorconfig-checker/editorconfig-checker#mega-linter){target=_blank} | -| [**eslint**](https://github.com/eslint/eslint){target=_blank} | 8.45.0 | [MIT](licenses/eslint.md) | [![GitHub stars](https://img.shields.io/github/stars/eslint/eslint?cacheSeconds=3600)](https://github.com/eslint/eslint){target=_blank} | [JAVASCRIPT](descriptors/javascript_eslint.md)
[JSX](descriptors/jsx_eslint.md)
[TSX](descriptors/tsx_eslint.md)
[TYPESCRIPT](descriptors/typescript_eslint.md) | :heart: | [MegaLinter reference](https://eslint.org/docs/user-guide/integrations#source-control){target=_blank} | -| [**eslint-plugin-jsonc**](https://github.com/ota-meshi/eslint-plugin-jsonc){target=_blank} | 2.9.0 | [MIT](licenses/eslint-plugin-jsonc.md) | [![GitHub stars](https://img.shields.io/github/stars/ota-meshi/eslint-plugin-jsonc?cacheSeconds=3600)](https://github.com/ota-meshi/eslint-plugin-jsonc){target=_blank} | [JSON](descriptors/json_eslint_plugin_jsonc.md) | :heart: | [MegaLinter reference](https://eslint.org/docs/user-guide/integrations#source-control){target=_blank} | -| [**flake8**](https://github.com/PyCQA/flake8){target=_blank} | 6.0.0 | [MIT](licenses/flake8.md) | [![GitHub stars](https://img.shields.io/github/stars/PyCQA/flake8?cacheSeconds=3600)](https://github.com/PyCQA/flake8){target=_blank} | [PYTHON](descriptors/python_flake8.md) | :white_circle: | [Repository](https://github.com/PyCQA/flake8){target=_blank} | -| [**gherkin-lint**](https://github.com/vsiakka/gherkin-lint){target=_blank} | N/A | [ISC](licenses/gherkin-lint.md) | [![GitHub stars](https://img.shields.io/github/stars/vsiakka/gherkin-lint?cacheSeconds=3600)](https://github.com/vsiakka/gherkin-lint){target=_blank} | [GHERKIN](descriptors/gherkin_gherkin_lint.md) | :white_circle: | [Repository](https://github.com/vsiakka/gherkin-lint){target=_blank} | -| [**git_diff**](https://github.com/git/git){target=_blank} | 2.38.5 | [LGPL-2.1](licenses/git_diff.md) | [![GitHub stars](https://img.shields.io/github/stars/git/git?cacheSeconds=3600)](https://github.com/git/git){target=_blank} | [REPOSITORY](descriptors/repository_git_diff.md) | | [Repository](https://github.com/git/git){target=_blank} | -| [**gitleaks**](https://github.com/gitleaks/gitleaks){target=_blank} | 8.17.0 | [MIT](licenses/gitleaks.md) | [![GitHub stars](https://img.shields.io/github/stars/gitleaks/gitleaks?cacheSeconds=3600)](https://github.com/gitleaks/gitleaks){target=_blank} | [REPOSITORY](descriptors/repository_gitleaks.md) | :white_circle: | [Repository](https://github.com/gitleaks/gitleaks){target=_blank} | -| [**golangci-lint**](https://github.com/golangci/golangci-lint){target=_blank} | 1.53.3 | [GPL-3.0](licenses/golangci-lint.md) | [![GitHub stars](https://img.shields.io/github/stars/golangci/golangci-lint?cacheSeconds=3600)](https://github.com/golangci/golangci-lint){target=_blank} | [GO](descriptors/go_golangci_lint.md) | :white_circle: | [Repository](https://github.com/golangci/golangci-lint){target=_blank} | -| [**graphql-schema-linter**](https://github.com/cjoudrey/graphql-schema-linter){target=_blank} | 3.0.1 | [MIT](licenses/graphql-schema-linter.md) | [![GitHub stars](https://img.shields.io/github/stars/cjoudrey/graphql-schema-linter?cacheSeconds=3600)](https://github.com/cjoudrey/graphql-schema-linter){target=_blank} | [GRAPHQL](descriptors/graphql_graphql_schema_linter.md) | :hammer_and_wrench: | [Pull Request](https://github.com/cjoudrey/graphql-schema-linter/pull/272){target=_blank} | -| [**grype**](https://github.com/anchore/grype){target=_blank} | 0.63.1 | [Apache-2.0](licenses/grype.md) | [![GitHub stars](https://img.shields.io/github/stars/anchore/grype?cacheSeconds=3600)](https://github.com/anchore/grype){target=_blank} | [REPOSITORY](descriptors/repository_grype.md) | :white_circle: | [Repository](https://github.com/anchore/grype){target=_blank} | -| [**hadolint**](https://github.com/hadolint/hadolint){target=_blank} | 2.12.0 | [GPL-3.0](licenses/hadolint.md) | [![GitHub stars](https://img.shields.io/github/stars/hadolint/hadolint?cacheSeconds=3600)](https://github.com/hadolint/hadolint){target=_blank} | [DOCKERFILE](descriptors/dockerfile_hadolint.md) | :heart: | [MegaLinter reference](https://github.com/hadolint/hadolint/blob/master/docs/INTEGRATION.md#mega-linter){target=_blank} | -| [**helm**](https://github.com/helm/helm){target=_blank} | 3.10.2 | [Apache-2.0](licenses/helm.md) | [![GitHub stars](https://img.shields.io/github/stars/helm/helm?cacheSeconds=3600)](https://github.com/helm/helm){target=_blank} | [KUBERNETES](descriptors/kubernetes_helm.md) | :white_circle: | [Repository](https://github.com/helm/helm){target=_blank} | -| [**htmlhint**](https://github.com/htmlhint/HTMLHint){target=_blank} | 1.1.4 | [MIT](licenses/htmlhint.md) | [![GitHub stars](https://img.shields.io/github/stars/htmlhint/HTMLHint?cacheSeconds=3600)](https://github.com/htmlhint/HTMLHint){target=_blank} | [HTML](descriptors/html_htmlhint.md) | :heart: | [MegaLinter reference](https://htmlhint.com/docs/user-guide/integrations/task-runner){target=_blank} | -| [**isort**](https://github.com/PyCQA/isort){target=_blank} | 5.12.0 | [MIT](licenses/isort.md) | [![GitHub stars](https://img.shields.io/github/stars/PyCQA/isort?cacheSeconds=3600)](https://github.com/PyCQA/isort){target=_blank} | [PYTHON](descriptors/python_isort.md) | :white_circle: | [Repository](https://github.com/PyCQA/isort){target=_blank} | -| [**jscpd**](https://github.com/kucherenko/jscpd){target=_blank} | 3.5.9 | [MIT](licenses/jscpd.md) | [![GitHub stars](https://img.shields.io/github/stars/kucherenko/jscpd?cacheSeconds=3600)](https://github.com/kucherenko/jscpd){target=_blank} | [COPYPASTE](descriptors/copypaste_jscpd.md) | :heart: | [MegaLinter reference](https://github.com/kucherenko/jscpd#who-uses-jscpd){target=_blank} | -| [**jsonlint**](https://github.com/prantlf/jsonlint){target=_blank} | 14.0.3 | [MIT](licenses/jsonlint.md) | [![GitHub stars](https://img.shields.io/github/stars/prantlf/jsonlint?cacheSeconds=3600)](https://github.com/prantlf/jsonlint){target=_blank} | [JSON](descriptors/json_jsonlint.md) | :white_circle: | [Repository](https://github.com/prantlf/jsonlint){target=_blank} | -| [**kics**](https://github.com/checkmarx/kics){target=_blank} | 1.7.3 | [Apache-2.0](licenses/kics.md) | [![GitHub stars](https://img.shields.io/github/stars/checkmarx/kics?cacheSeconds=3600)](https://github.com/checkmarx/kics){target=_blank} | [REPOSITORY](descriptors/repository_kics.md) | :heart: | [MegaLinter reference](https://docs.kics.io/latest/integrations/){target=_blank} | -| [**ktlint**](https://github.com/pinterest/ktlint){target=_blank} | 0.50.0 | [MIT](licenses/ktlint.md) | [![GitHub stars](https://img.shields.io/github/stars/pinterest/ktlint?cacheSeconds=3600)](https://github.com/pinterest/ktlint){target=_blank} | [KOTLIN](descriptors/kotlin_ktlint.md) | :heart: | [MegaLinter reference](https://github.com/pinterest/ktlint#-with-continuous-integration){target=_blank} | -| [**kubeconform**](https://github.com/yannh/kubeconform){target=_blank} | 0.6.3 | [Apache-2.0](licenses/kubeconform.md) | [![GitHub stars](https://img.shields.io/github/stars/yannh/kubeconform?cacheSeconds=3600)](https://github.com/yannh/kubeconform){target=_blank} | [KUBERNETES](descriptors/kubernetes_kubeconform.md) | :white_circle: | [Repository](https://github.com/yannh/kubeconform){target=_blank} | -| [**kubescape**](https://github.com/kubescape/kubescape){target=_blank} | 2.3.6 | [Apache-2.0](licenses/kubescape.md) | [![GitHub stars](https://img.shields.io/github/stars/kubescape/kubescape?cacheSeconds=3600)](https://github.com/kubescape/kubescape){target=_blank} | [KUBERNETES](descriptors/kubernetes_kubescape.md) | :white_circle: | [Repository](https://github.com/kubescape/kubescape){target=_blank} | -| [**lintr**](https://github.com/r-lib/lintr){target=_blank} | N/A | [Other](licenses/lintr.md) | [![GitHub stars](https://img.shields.io/github/stars/r-lib/lintr?cacheSeconds=3600)](https://github.com/r-lib/lintr){target=_blank} | [R](descriptors/r_lintr.md) | :heart: | [MegaLinter reference](https://cran.r-project.org/web/packages/lintr/vignettes/continuous-integration.html){target=_blank} | -| [**luacheck**](https://github.com/luarocks/luacheck){target=_blank} | 1.1.1 | [MIT](licenses/luacheck.md) | [![GitHub stars](https://img.shields.io/github/stars/luarocks/luacheck?cacheSeconds=3600)](https://github.com/luarocks/luacheck){target=_blank} | [LUA](descriptors/lua_luacheck.md) | :no_entry_sign: | [Repository](https://github.com/luarocks/luacheck){target=_blank} | -| [**lychee**](https://github.com/lycheeverse/lychee){target=_blank} | 0.13.0 | [Apache-2.0](licenses/lychee.md) | [![GitHub stars](https://img.shields.io/github/stars/lycheeverse/lychee?cacheSeconds=3600)](https://github.com/lycheeverse/lychee){target=_blank} | [SPELL](descriptors/spell_lychee.md) | :white_circle: | [Repository](https://github.com/lycheeverse/lychee){target=_blank} | -| [**markdown-link-check**](https://github.com/tcort/markdown-link-check){target=_blank} | 3.11.2 | [ISC](licenses/markdown-link-check.md) | [![GitHub stars](https://img.shields.io/github/stars/tcort/markdown-link-check?cacheSeconds=3600)](https://github.com/tcort/markdown-link-check){target=_blank} | [MARKDOWN](descriptors/markdown_markdown_link_check.md) | :heart: | [MegaLinter reference](https://github.com/tcort/markdown-link-check#run-in-other-tools){target=_blank} | -| [**markdown-table-formatter**](https://github.com/nvuillam/markdown-table-formatter){target=_blank} | 1.4.0 | [MIT](licenses/markdown-table-formatter.md) | [![GitHub stars](https://img.shields.io/github/stars/nvuillam/markdown-table-formatter?cacheSeconds=3600)](https://github.com/nvuillam/markdown-table-formatter){target=_blank} | [MARKDOWN](descriptors/markdown_markdown_table_formatter.md) | :white_circle: | [Repository](https://github.com/nvuillam/markdown-table-formatter){target=_blank} | -| [**markdownlint**](https://github.com/DavidAnson/markdownlint){target=_blank} | 0.35.0 | [MIT](licenses/markdownlint.md) | [![GitHub stars](https://img.shields.io/github/stars/DavidAnson/markdownlint?cacheSeconds=3600)](https://github.com/DavidAnson/markdownlint){target=_blank} | [MARKDOWN](descriptors/markdown_markdownlint.md) | :white_circle: | [Repository](https://github.com/DavidAnson/markdownlint){target=_blank} | -| [**mypy**](https://github.com/python/mypy){target=_blank} | 1.4.1 | [MIT](licenses/mypy.md) | [![GitHub stars](https://img.shields.io/github/stars/python/mypy?cacheSeconds=3600)](https://github.com/python/mypy){target=_blank} | [PYTHON](descriptors/python_mypy.md) | | [Repository](https://github.com/python/mypy){target=_blank} | -| [**npm-groovy-lint**](https://github.com/nvuillam/npm-groovy-lint){target=_blank} | 11.1.1 | [GPL-3.0](licenses/npm-groovy-lint.md) | [![GitHub stars](https://img.shields.io/github/stars/nvuillam/npm-groovy-lint?cacheSeconds=3600)](https://github.com/nvuillam/npm-groovy-lint){target=_blank} | [GROOVY](descriptors/groovy_npm_groovy_lint.md) | :heart: | [MegaLinter reference](https://nvuillam.github.io/npm-groovy-lint/#mega-linter){target=_blank} | -| [**npm-package-json-lint**](https://github.com/tclindner/npm-package-json-lint){target=_blank} | 7.0.0 | [MIT](licenses/npm-package-json-lint.md) | [![GitHub stars](https://img.shields.io/github/stars/tclindner/npm-package-json-lint?cacheSeconds=3600)](https://github.com/tclindner/npm-package-json-lint){target=_blank} | [JSON](descriptors/json_npm_package_json_lint.md) | :heart: | [MegaLinter reference](https://npmpackagejsonlint.org/docs/integrations#megalinter){target=_blank} | -| [**perlcritic**](https://github.com/Perl-Critic/Perl-Critic){target=_blank} | 1.150 | [Other](licenses/perlcritic.md) | [![GitHub stars](https://img.shields.io/github/stars/Perl-Critic/Perl-Critic?cacheSeconds=3600)](https://github.com/Perl-Critic/Perl-Critic){target=_blank} | [PERL](descriptors/perl_perlcritic.md) | :white_circle: | [Repository](https://github.com/Perl-Critic/Perl-Critic){target=_blank} | -| [**phpcs**](https://github.com/squizlabs/PHP_CodeSniffer){target=_blank} | 3.7.2 | [BSD-3-Clause](licenses/phpcs.md) | [![GitHub stars](https://img.shields.io/github/stars/squizlabs/PHP_CodeSniffer?cacheSeconds=3600)](https://github.com/squizlabs/PHP_CodeSniffer){target=_blank} | [PHP](descriptors/php_phpcs.md) | :white_circle: | [Repository](https://github.com/squizlabs/PHP_CodeSniffer){target=_blank} | -| [**phplint**](https://github.com/overtrue/phplint){target=_blank} | 9.0.4 | [MIT](licenses/phplint.md) | [![GitHub stars](https://img.shields.io/github/stars/overtrue/phplint?cacheSeconds=3600)](https://github.com/overtrue/phplint){target=_blank} | [PHP](descriptors/php_phplint.md) | :white_circle: | [Repository](https://github.com/overtrue/phplint){target=_blank} | -| [**phpstan**](https://github.com/phpstan/phpstan){target=_blank} | 1.10.25 | [MIT](licenses/phpstan.md) | [![GitHub stars](https://img.shields.io/github/stars/phpstan/phpstan?cacheSeconds=3600)](https://github.com/phpstan/phpstan){target=_blank} | [PHP](descriptors/php_phpstan.md) | :white_circle: | [Repository](https://github.com/phpstan/phpstan){target=_blank} | -| [**pmd**](https://github.com/pmd/pmd){target=_blank} | 6.55.0 | [Apache-2.0](licenses/pmd.md) | [![GitHub stars](https://img.shields.io/github/stars/pmd/pmd?cacheSeconds=3600)](https://github.com/pmd/pmd){target=_blank} | [JAVA](descriptors/java_pmd.md) | :heart: | [MegaLinter reference](https://pmd.sourceforge.io/pmd-6.55.0/pmd_userdocs_tools_ci.html){target=_blank} | -| [**powershell**](https://github.com/PowerShell/PSScriptAnalyzer){target=_blank} | 7.3.6 | [MIT](licenses/powershell.md) | [![GitHub stars](https://img.shields.io/github/stars/PowerShell/PSScriptAnalyzer?cacheSeconds=3600)](https://github.com/PowerShell/PSScriptAnalyzer){target=_blank} | [POWERSHELL](descriptors/powershell_powershell.md) | :white_circle: | [Repository](https://github.com/PowerShell/PSScriptAnalyzer){target=_blank} | -| [**powershell_formatter**](https://github.com/PowerShell/PSScriptAnalyzer){target=_blank} | 7.3.6 | [MIT](licenses/powershell_formatter.md) | [![GitHub stars](https://img.shields.io/github/stars/PowerShell/PSScriptAnalyzer?cacheSeconds=3600)](https://github.com/PowerShell/PSScriptAnalyzer){target=_blank} | [POWERSHELL](descriptors/powershell_powershell_formatter.md) | :white_circle: | [Repository](https://github.com/PowerShell/PSScriptAnalyzer){target=_blank} | -| [**prettier**](https://github.com/prettier/prettier){target=_blank} | 3.0.0 | [MIT](licenses/prettier.md) | [![GitHub stars](https://img.shields.io/github/stars/prettier/prettier?cacheSeconds=3600)](https://github.com/prettier/prettier){target=_blank} | [JAVASCRIPT](descriptors/javascript_prettier.md)
[JSON](descriptors/json_prettier.md)
[TYPESCRIPT](descriptors/typescript_prettier.md)
[YAML](descriptors/yaml_prettier.md) | :white_circle: | [Repository](https://github.com/prettier/prettier){target=_blank} | -| [**proselint**](https://github.com/amperser/proselint){target=_blank} | 0.13.0 | [BSD-3-Clause](licenses/proselint.md) | [![GitHub stars](https://img.shields.io/github/stars/amperser/proselint?cacheSeconds=3600)](https://github.com/amperser/proselint){target=_blank} | [SPELL](descriptors/spell_proselint.md) | :white_circle: | [Repository](https://github.com/amperser/proselint){target=_blank} | -| [**protolint**](https://github.com/yoheimuta/protolint){target=_blank} | 0.45.0 | [MIT](licenses/protolint.md) | [![GitHub stars](https://img.shields.io/github/stars/yoheimuta/protolint?cacheSeconds=3600)](https://github.com/yoheimuta/protolint){target=_blank} | [PROTOBUF](descriptors/protobuf_protolint.md) | :white_circle: | [Repository](https://github.com/yoheimuta/protolint){target=_blank} | -| [**psalm**](https://github.com/vimeo/psalm){target=_blank} | Psalm.5.13.1@ | [MIT](licenses/psalm.md) | [![GitHub stars](https://img.shields.io/github/stars/vimeo/psalm?cacheSeconds=3600)](https://github.com/vimeo/psalm){target=_blank} | [PHP](descriptors/php_psalm.md) | :white_circle: | [Repository](https://github.com/vimeo/psalm){target=_blank} | -| [**puppet-lint**](https://github.com/puppetlabs/puppet-lint){target=_blank} | 4.0.0 | [MIT](licenses/puppet-lint.md) | [![GitHub stars](https://img.shields.io/github/stars/puppetlabs/puppet-lint?cacheSeconds=3600)](https://github.com/puppetlabs/puppet-lint){target=_blank} | [PUPPET](descriptors/puppet_puppet_lint.md) | :white_circle: | [Repository](https://github.com/puppetlabs/puppet-lint){target=_blank} | -| [**pylint**](https://github.com/PyCQA/pylint){target=_blank} | 2.17.4 | [GPL-2.0](licenses/pylint.md) | [![GitHub stars](https://img.shields.io/github/stars/PyCQA/pylint?cacheSeconds=3600)](https://github.com/PyCQA/pylint){target=_blank} | [PYTHON](descriptors/python_pylint.md) | :white_circle: | [Repository](https://github.com/PyCQA/pylint){target=_blank} | -| [**pyright**](https://github.com/microsoft/pyright){target=_blank} | 1.1.317 | [Other](licenses/pyright.md) | [![GitHub stars](https://img.shields.io/github/stars/microsoft/pyright?cacheSeconds=3600)](https://github.com/microsoft/pyright){target=_blank} | [PYTHON](descriptors/python_pyright.md) | :white_circle: | [Repository](https://github.com/microsoft/pyright){target=_blank} | -| [**raku**](https://github.com/rakudo/rakudo){target=_blank} | 2020.10 | [Artistic-2.0](licenses/raku.md) | [![GitHub stars](https://img.shields.io/github/stars/rakudo/rakudo?cacheSeconds=3600)](https://github.com/rakudo/rakudo){target=_blank} | [RAKU](descriptors/raku_raku.md) | :white_circle: | [Repository](https://github.com/rakudo/rakudo){target=_blank} | -| [**remark-lint**](https://github.com/remarkjs/remark-lint){target=_blank} | 14.0.2 | [MIT](licenses/remark-lint.md) | [![GitHub stars](https://img.shields.io/github/stars/remarkjs/remark-lint?cacheSeconds=3600)](https://github.com/remarkjs/remark-lint){target=_blank} | [MARKDOWN](descriptors/markdown_remark_lint.md) | :white_circle: | [Repository](https://github.com/remarkjs/remark-lint){target=_blank} | -| [**revive**](https://github.com/mgechev/revive){target=_blank} | 1.3.2 | [MIT](licenses/revive.md) | [![GitHub stars](https://img.shields.io/github/stars/mgechev/revive?cacheSeconds=3600)](https://github.com/mgechev/revive){target=_blank} | [GO](descriptors/go_revive.md) | :white_circle: | [Repository](https://github.com/mgechev/revive){target=_blank} | -| [**rst-lint**](https://github.com/twolfson/restructuredtext-lint){target=_blank} | 1.4.0 | [Unlicense](licenses/rst-lint.md) | [![GitHub stars](https://img.shields.io/github/stars/twolfson/restructuredtext-lint?cacheSeconds=3600)](https://github.com/twolfson/restructuredtext-lint){target=_blank} | [RST](descriptors/rst_rst_lint.md) | :heart: | [MegaLinter reference](https://github.com/twolfson/restructuredtext-lint/wiki/Integration-in-other-tools#integration-in-other-tools){target=_blank} | -| [**rstcheck**](https://github.com/myint/rstcheck){target=_blank} | 6.1.2 | [MIT](licenses/rstcheck.md) | [![GitHub stars](https://img.shields.io/github/stars/myint/rstcheck?cacheSeconds=3600)](https://github.com/myint/rstcheck){target=_blank} | [RST](descriptors/rst_rstcheck.md) | :heart: | [MegaLinter reference](https://rstcheck.readthedocs.io/en/latest/usage/integration/#use-with-mega-linter){target=_blank} | -| [**rstfmt**](https://github.com/dzhu/rstfmt){target=_blank} | 0.0.13 | | | [RST](descriptors/rst_rstfmt.md) | :hammer_and_wrench: | [Pull Request](https://github.com/dzhu/rstfmt/pull/1){target=_blank} | -| [**rubocop**](https://github.com/rubocop-hq/rubocop){target=_blank} | 1.54.2 | [MIT](licenses/rubocop.md) | [![GitHub stars](https://img.shields.io/github/stars/rubocop-hq/rubocop?cacheSeconds=3600)](https://github.com/rubocop-hq/rubocop){target=_blank} | [RUBY](descriptors/ruby_rubocop.md) | :heart: | [MegaLinter reference](https://docs.rubocop.org/rubocop/integration_with_other_tools.html#mega-linter-integration){target=_blank} | -| [**ruff**](https://github.com/charliermarsh/ruff){target=_blank} | 0.0.278 | [MIT](licenses/ruff.md) | [![GitHub stars](https://img.shields.io/github/stars/charliermarsh/ruff?cacheSeconds=3600)](https://github.com/charliermarsh/ruff){target=_blank} | [PYTHON](descriptors/python_ruff.md) | :white_circle: | [Repository](https://github.com/charliermarsh/ruff){target=_blank} | -| [**scalafix**](https://github.com/scalacenter/scalafix){target=_blank} | 0.11.0 | [Other](licenses/scalafix.md) | [![GitHub stars](https://img.shields.io/github/stars/scalacenter/scalafix?cacheSeconds=3600)](https://github.com/scalacenter/scalafix){target=_blank} | [SCALA](descriptors/scala_scalafix.md) | :heart: | [MegaLinter reference](https://scalacenter.github.io/scalafix/docs/users/installation.html#plugins-for-other-build-tools){target=_blank} | -| [**scss-lint**](https://github.com/sds/scss-lint){target=_blank} | 0.60.0 | [MIT](licenses/scss-lint.md) | [![GitHub stars](https://img.shields.io/github/stars/sds/scss-lint?cacheSeconds=3600)](https://github.com/sds/scss-lint){target=_blank} | [CSS](descriptors/css_scss_lint.md) | :white_circle: | [Repository](https://github.com/sds/scss-lint){target=_blank} | -| [**secretlint**](https://github.com/secretlint/secretlint){target=_blank} | 7.0.3 | [MIT](licenses/secretlint.md) | [![GitHub stars](https://img.shields.io/github/stars/secretlint/secretlint?cacheSeconds=3600)](https://github.com/secretlint/secretlint){target=_blank} | [REPOSITORY](descriptors/repository_secretlint.md) | :heart: | [MegaLinter reference](https://github.com/secretlint/secretlint#mega-linter){target=_blank} | -| [**semgrep**](https://github.com/returntocorp/semgrep){target=_blank} | 1.32.0 | [LGPL-2.1](licenses/semgrep.md) | [![GitHub stars](https://img.shields.io/github/stars/returntocorp/semgrep?cacheSeconds=3600)](https://github.com/returntocorp/semgrep){target=_blank} | [REPOSITORY](descriptors/repository_semgrep.md) | :white_circle: | [Repository](https://github.com/returntocorp/semgrep){target=_blank} | -| [**sfdx-scanner-apex**](https://github.com/forcedotcom/sfdx-scanner){target=_blank} | 3.14.0 | [MIT](licenses/sfdx-scanner-apex.md) | [![GitHub stars](https://img.shields.io/github/stars/forcedotcom/sfdx-scanner?cacheSeconds=3600)](https://github.com/forcedotcom/sfdx-scanner){target=_blank} | [SALESFORCE](descriptors/salesforce_sfdx_scanner_apex.md) | :hammer_and_wrench: | [Pull Request](https://github.com/forcedotcom/sfdx-scanner/pull/307){target=_blank} | -| [**sfdx-scanner-aura**](https://github.com/forcedotcom/sfdx-scanner){target=_blank} | 3.14.0 | [MIT](licenses/sfdx-scanner-aura.md) | [![GitHub stars](https://img.shields.io/github/stars/forcedotcom/sfdx-scanner?cacheSeconds=3600)](https://github.com/forcedotcom/sfdx-scanner){target=_blank} | [SALESFORCE](descriptors/salesforce_sfdx_scanner_aura.md) | :hammer_and_wrench: | [Pull Request](https://github.com/forcedotcom/sfdx-scanner/pull/307){target=_blank} | -| [**sfdx-scanner-lwc**](https://github.com/forcedotcom/sfdx-scanner){target=_blank} | 3.14.0 | [MIT](licenses/sfdx-scanner-lwc.md) | [![GitHub stars](https://img.shields.io/github/stars/forcedotcom/sfdx-scanner?cacheSeconds=3600)](https://github.com/forcedotcom/sfdx-scanner){target=_blank} | [SALESFORCE](descriptors/salesforce_sfdx_scanner_lwc.md) | :hammer_and_wrench: | [Pull Request](https://github.com/forcedotcom/sfdx-scanner/pull/307){target=_blank} | -| [**shellcheck**](https://github.com/koalaman/shellcheck){target=_blank} | 0.9.0 | [GPL-3.0](licenses/shellcheck.md) | [![GitHub stars](https://img.shields.io/github/stars/koalaman/shellcheck?cacheSeconds=3600)](https://github.com/koalaman/shellcheck){target=_blank} | [BASH](descriptors/bash_shellcheck.md) | | [Repository](https://github.com/koalaman/shellcheck){target=_blank} | -| [**shfmt**](https://github.com/mvdan/sh){target=_blank} | 3.7.0 | [BSD-3-Clause](licenses/shfmt.md) | [![GitHub stars](https://img.shields.io/github/stars/mvdan/sh?cacheSeconds=3600)](https://github.com/mvdan/sh){target=_blank} | [BASH](descriptors/bash_shfmt.md) | :no_entry_sign: | [Repository](https://github.com/mvdan/sh){target=_blank} | -| [**snakefmt**](https://github.com/snakemake/snakefmt){target=_blank} | 0.8.4 | [MIT](licenses/snakefmt.md) | [![GitHub stars](https://img.shields.io/github/stars/snakemake/snakefmt?cacheSeconds=3600)](https://github.com/snakemake/snakefmt){target=_blank} | [SNAKEMAKE](descriptors/snakemake_snakefmt.md) | :white_circle: | [Repository](https://github.com/snakemake/snakefmt){target=_blank} | -| [**snakemake**](https://github.com/snakemake/snakemake){target=_blank} | 7.30.1 | [MIT](licenses/snakemake.md) | [![GitHub stars](https://img.shields.io/github/stars/snakemake/snakemake?cacheSeconds=3600)](https://github.com/snakemake/snakemake){target=_blank} | [SNAKEMAKE](descriptors/snakemake_snakemake.md) | :white_circle: | [Repository](https://github.com/snakemake/snakemake){target=_blank} | -| [**spectral**](https://github.com/stoplightio/spectral){target=_blank} | 6.8.0 | [Apache-2.0](licenses/spectral.md) | [![GitHub stars](https://img.shields.io/github/stars/stoplightio/spectral?cacheSeconds=3600)](https://github.com/stoplightio/spectral){target=_blank} | [OPENAPI](descriptors/openapi_spectral.md) | :white_circle: | [Repository](https://github.com/stoplightio/spectral){target=_blank} | -| [**sql-lint**](https://github.com/joereynolds/sql-lint){target=_blank} | 1.0.0 | [MIT](licenses/sql-lint.md) | [![GitHub stars](https://img.shields.io/github/stars/joereynolds/sql-lint?cacheSeconds=3600)](https://github.com/joereynolds/sql-lint){target=_blank} | [SQL](descriptors/sql_sql_lint.md) | :white_circle: | [Repository](https://github.com/joereynolds/sql-lint){target=_blank} | -| [**sqlfluff**](https://github.com/sqlfluff/sqlfluff){target=_blank} | 2.1.2 | [MIT](licenses/sqlfluff.md) | [![GitHub stars](https://img.shields.io/github/stars/sqlfluff/sqlfluff?cacheSeconds=3600)](https://github.com/sqlfluff/sqlfluff){target=_blank} | [SQL](descriptors/sql_sqlfluff.md) | :white_circle: | [Repository](https://github.com/sqlfluff/sqlfluff){target=_blank} | -| [**standard**](https://github.com/standard/standard){target=_blank} | 17.1.0 | [MIT](licenses/standard.md) | [![GitHub stars](https://img.shields.io/github/stars/standard/standard?cacheSeconds=3600)](https://github.com/standard/standard){target=_blank} | [JAVASCRIPT](descriptors/javascript_standard.md) | :white_circle: | [Repository](https://github.com/standard/standard){target=_blank} | -| [**stylelint**](https://github.com/stylelint/stylelint){target=_blank} | 15.10.1 | [MIT](licenses/stylelint.md) | [![GitHub stars](https://img.shields.io/github/stars/stylelint/stylelint?cacheSeconds=3600)](https://github.com/stylelint/stylelint){target=_blank} | [CSS](descriptors/css_stylelint.md) | :white_circle: | [Repository](https://github.com/stylelint/stylelint){target=_blank} | -| [**swiftlint**](https://github.com/realm/SwiftLint){target=_blank} | 0.52.4 | [MIT](licenses/swiftlint.md) | [![GitHub stars](https://img.shields.io/github/stars/realm/SwiftLint?cacheSeconds=3600)](https://github.com/realm/SwiftLint){target=_blank} | [SWIFT](descriptors/swift_swiftlint.md) | :white_circle: | [Repository](https://github.com/realm/SwiftLint){target=_blank} | -| [**syft**](https://github.com/anchore/syft){target=_blank} | 0.85.0 | [Apache-2.0](licenses/syft.md) | [![GitHub stars](https://img.shields.io/github/stars/anchore/syft?cacheSeconds=3600)](https://github.com/anchore/syft){target=_blank} | [REPOSITORY](descriptors/repository_syft.md) | :white_circle: | [Repository](https://github.com/anchore/syft){target=_blank} | -| [**tekton-lint**](https://github.com/IBM/tekton-lint){target=_blank} | 0.6.0 | | [![GitHub stars](https://img.shields.io/github/stars/IBM/tekton-lint?cacheSeconds=3600)](https://github.com/IBM/tekton-lint){target=_blank} | [TEKTON](descriptors/tekton_tekton_lint.md) | :white_circle: | [Repository](https://github.com/IBM/tekton-lint){target=_blank} | -| [**terraform-fmt**](https://github.com/hashicorp/terraform){target=_blank} | 1.5.3 | [MPL-2.0](licenses/terraform-fmt.md) | [![GitHub stars](https://img.shields.io/github/stars/hashicorp/terraform?cacheSeconds=3600)](https://github.com/hashicorp/terraform){target=_blank} | [TERRAFORM](descriptors/terraform_terraform_fmt.md) | :white_circle: | [Repository](https://github.com/hashicorp/terraform){target=_blank} | -| [**terragrunt**](https://github.com/gruntwork-io/terragrunt){target=_blank} | 0.48.1 | [MIT](licenses/terragrunt.md) | [![GitHub stars](https://img.shields.io/github/stars/gruntwork-io/terragrunt?cacheSeconds=3600)](https://github.com/gruntwork-io/terragrunt){target=_blank} | [TERRAFORM](descriptors/terraform_terragrunt.md) | :white_circle: | [Repository](https://github.com/gruntwork-io/terragrunt){target=_blank} | -| [**terrascan**](https://github.com/tenable/terrascan){target=_blank} | 1.18.1 | [Apache-2.0](licenses/terrascan.md) | [![GitHub stars](https://img.shields.io/github/stars/tenable/terrascan?cacheSeconds=3600)](https://github.com/tenable/terrascan){target=_blank} | [TERRAFORM](descriptors/terraform_terrascan.md) | :white_circle: | [Repository](https://github.com/tenable/terrascan){target=_blank} | -| [**tflint**](https://github.com/terraform-linters/tflint){target=_blank} | 0.47.0 | [MPL-2.0](licenses/tflint.md) | [![GitHub stars](https://img.shields.io/github/stars/terraform-linters/tflint?cacheSeconds=3600)](https://github.com/terraform-linters/tflint){target=_blank} | [TERRAFORM](descriptors/terraform_tflint.md) | :white_circle: | [Repository](https://github.com/terraform-linters/tflint){target=_blank} | -| [**trivy**](https://github.com/aquasecurity/trivy){target=_blank} | 0.43.1 | [Apache-2.0](licenses/trivy.md) | [![GitHub stars](https://img.shields.io/github/stars/aquasecurity/trivy?cacheSeconds=3600)](https://github.com/aquasecurity/trivy){target=_blank} | [REPOSITORY](descriptors/repository_trivy.md) | :white_circle: | [Repository](https://github.com/aquasecurity/trivy){target=_blank} | -| [**trivy-sbom**](https://github.com/aquasecurity/trivy){target=_blank} | 0.43.1 | | [![GitHub stars](https://img.shields.io/github/stars/aquasecurity/trivy?cacheSeconds=3600)](https://github.com/aquasecurity/trivy){target=_blank} | [REPOSITORY](descriptors/repository_trivy_sbom.md) | :white_circle: | [Repository](https://github.com/aquasecurity/trivy){target=_blank} | -| [**trufflehog**](https://github.com/trufflesecurity/trufflehog){target=_blank} | 3.44.0 | | [![GitHub stars](https://img.shields.io/github/stars/trufflesecurity/trufflehog?cacheSeconds=3600)](https://github.com/trufflesecurity/trufflehog){target=_blank} | [REPOSITORY](descriptors/repository_trufflehog.md) | :white_circle: | [Repository](https://github.com/trufflesecurity/trufflehog){target=_blank} | -| [**ts-standard**](https://github.com/standard/ts-standard){target=_blank} | 12.0.2 | | [![GitHub stars](https://img.shields.io/github/stars/standard/ts-standard?cacheSeconds=3600)](https://github.com/standard/ts-standard){target=_blank} | [TYPESCRIPT](descriptors/typescript_ts_standard.md) | :white_circle: | [Repository](https://github.com/standard/ts-standard){target=_blank} | -| [**tsqllint**](https://github.com/tsqllint/tsqllint){target=_blank} | 1.15.3.0 | [MIT](licenses/tsqllint.md) | [![GitHub stars](https://img.shields.io/github/stars/tsqllint/tsqllint?cacheSeconds=3600)](https://github.com/tsqllint/tsqllint){target=_blank} | [SQL](descriptors/sql_tsqllint.md) | :white_circle: | [Repository](https://github.com/tsqllint/tsqllint){target=_blank} | -| [**v8r**](https://github.com/chris48s/v8r){target=_blank} | 2.0.0 | [MIT](licenses/v8r.md) | [![GitHub stars](https://img.shields.io/github/stars/chris48s/v8r?cacheSeconds=3600)](https://github.com/chris48s/v8r){target=_blank} | [JSON](descriptors/json_v8r.md)
[YAML](descriptors/yaml_v8r.md) | :no_entry_sign: | [Repository](https://github.com/chris48s/v8r){target=_blank} | -| [**vale**](https://github.com/errata-ai/vale){target=_blank} | 2.28.0 | [MIT](licenses/vale.md) | [![GitHub stars](https://img.shields.io/github/stars/errata-ai/vale?cacheSeconds=3600)](https://github.com/errata-ai/vale){target=_blank} | [SPELL](descriptors/spell_vale.md) | :white_circle: | [Repository](https://github.com/errata-ai/vale){target=_blank} | -| [**xmllint**](http://xmlsoft.org/xmllint.html){target=_blank} | 21004 | | | [XML](descriptors/xml_xmllint.md) | :white_circle: | [Web Site](http://xmlsoft.org/xmllint.html){target=_blank} | -| [**yamllint**](https://github.com/adrienverge/yamllint){target=_blank} | 1.32.0 | [GPL-3.0](licenses/yamllint.md) | [![GitHub stars](https://img.shields.io/github/stars/adrienverge/yamllint?cacheSeconds=3600)](https://github.com/adrienverge/yamllint){target=_blank} | [YAML](descriptors/yaml_yamllint.md) | :no_entry_sign: | [Repository](https://github.com/adrienverge/yamllint){target=_blank} | +| Linter | Supported Platforms | Version | License | Popularity | Descriptors | Ref | URL | +|:--------------------------------------------------------------------------------------------------------|:------------------------------:|:-------------:|:-------------------------------------------:|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:-------------------:|:---------------------------------------------------------------------------------------------------------------------------------------------------:| +| [**actionlint**](https://github.com/rhysd/actionlint){target=_blank} | linux/amd64
linux/arm64 | 1.6.25 | [MIT](licenses/actionlint.md) | [![GitHub stars](https://img.shields.io/github/stars/rhysd/actionlint?cacheSeconds=3600)](https://github.com/rhysd/actionlint){target=_blank} | [ACTION](descriptors/action_actionlint.md) | :white_circle: | [Repository](https://github.com/rhysd/actionlint){target=_blank} | +| [**ansible-lint**](https://github.com/ansible/ansible-lint){target=_blank} | linux/amd64
linux/arm64 | 6.17.2 | [GPL-3.0](licenses/ansible-lint.md) | [![GitHub stars](https://img.shields.io/github/stars/ansible/ansible-lint?cacheSeconds=3600)](https://github.com/ansible/ansible-lint){target=_blank} | [ANSIBLE](descriptors/ansible_ansible_lint.md) | :white_circle: | [Repository](https://github.com/ansible/ansible-lint){target=_blank} | +| [**arm-ttk**](https://github.com/Azure/arm-ttk){target=_blank} | linux/amd64
linux/arm64 | N/A | [MIT](licenses/arm-ttk.md) | [![GitHub stars](https://img.shields.io/github/stars/Azure/arm-ttk?cacheSeconds=3600)](https://github.com/Azure/arm-ttk){target=_blank} | [ARM](descriptors/arm_arm_ttk.md) | :white_circle: | [Repository](https://github.com/Azure/arm-ttk){target=_blank} | +| [**bandit**](https://github.com/PyCQA/bandit){target=_blank} | linux/amd64
linux/arm64 | 1.7.5 | [Apache-2.0](licenses/bandit.md) | [![GitHub stars](https://img.shields.io/github/stars/PyCQA/bandit?cacheSeconds=3600)](https://github.com/PyCQA/bandit){target=_blank} | [PYTHON](descriptors/python_bandit.md) | :white_circle: | [Repository](https://github.com/PyCQA/bandit){target=_blank} | +| [**bash-exec**](https://tiswww.case.edu/php/chet/bash/bashtop.html){target=_blank} | linux/amd64
linux/arm64 | 5.2.15 | | | [BASH](descriptors/bash_bash_exec.md) | | [Web Site](https://tiswww.case.edu/php/chet/bash/bashtop.html){target=_blank} | +| [**bicep_linter**](https://github.com/Azure/bicep){target=_blank} | linux/amd64
linux/arm64 | 0.19.5 | [MIT](licenses/bicep_linter.md) | [![GitHub stars](https://img.shields.io/github/stars/Azure/bicep?cacheSeconds=3600)](https://github.com/Azure/bicep){target=_blank} | [BICEP](descriptors/bicep_bicep_linter.md) | :white_circle: | [Repository](https://github.com/Azure/bicep){target=_blank} | +| [**black**](https://github.com/psf/black){target=_blank} | linux/amd64
linux/arm64 | 23.7.0 | [MIT](licenses/black.md) | [![GitHub stars](https://img.shields.io/github/stars/psf/black?cacheSeconds=3600)](https://github.com/psf/black){target=_blank} | [PYTHON](descriptors/python_black.md) | :white_circle: | [Repository](https://github.com/psf/black){target=_blank} | +| [**cfn-lint**](https://github.com/aws-cloudformation/cfn-lint){target=_blank} | linux/amd64
linux/arm64 | 0.78.1 | [MIT-0](licenses/cfn-lint.md) | [![GitHub stars](https://img.shields.io/github/stars/aws-cloudformation/cfn-lint?cacheSeconds=3600)](https://github.com/aws-cloudformation/cfn-lint){target=_blank} | [CLOUDFORMATION](descriptors/cloudformation_cfn_lint.md) | :white_circle: | [Repository](https://github.com/aws-cloudformation/cfn-lint){target=_blank} | +| [**checkmake**](https://github.com/mrtazz/checkmake){target=_blank} | linux/amd64 | 0.2.0 | [MIT](licenses/checkmake.md) | [![GitHub stars](https://img.shields.io/github/stars/mrtazz/checkmake?cacheSeconds=3600)](https://github.com/mrtazz/checkmake){target=_blank} | [MAKEFILE](descriptors/makefile_checkmake.md) | :white_circle: | [Repository](https://github.com/mrtazz/checkmake){target=_blank} | +| [**checkov**](https://github.com/bridgecrewio/checkov){target=_blank} | linux/amd64
linux/arm64 | 2.3.326 | [Apache-2.0](licenses/checkov.md) | [![GitHub stars](https://img.shields.io/github/stars/bridgecrewio/checkov?cacheSeconds=3600)](https://github.com/bridgecrewio/checkov){target=_blank} | [REPOSITORY](descriptors/repository_checkov.md) | :no_entry_sign: | [Repository](https://github.com/bridgecrewio/checkov){target=_blank} | +| [**checkstyle**](https://github.com/checkstyle/checkstyle){target=_blank} | linux/amd64
linux/arm64 | 10.12.1 | [LGPL-2.1](licenses/checkstyle.md) | [![GitHub stars](https://img.shields.io/github/stars/checkstyle/checkstyle?cacheSeconds=3600)](https://github.com/checkstyle/checkstyle){target=_blank} | [JAVA](descriptors/java_checkstyle.md) | :heart: | [MegaLinter reference](https://checkstyle.sourceforge.io/index.html#Related_Tools_Active_Tools){target=_blank} | +| [**chktex**](https://www.nongnu.org/chktex){target=_blank} | linux/amd64 | 1.7.6 | | | [LATEX](descriptors/latex_chktex.md) | :white_circle: | [Web Site](https://www.nongnu.org/chktex){target=_blank} | +| [**clippy**](https://github.com/rust-lang/rust-clippy){target=_blank} | linux/amd64
linux/arm64 | 0.1.71 | [Other](licenses/clippy.md) | [![GitHub stars](https://img.shields.io/github/stars/rust-lang/rust-clippy?cacheSeconds=3600)](https://github.com/rust-lang/rust-clippy){target=_blank} | [RUST](descriptors/rust_clippy.md) | :white_circle: | [Repository](https://github.com/rust-lang/rust-clippy){target=_blank} | +| [**clj-kondo**](https://github.com/borkdude/clj-kondo){target=_blank} | linux/amd64
windows/amd64 | 2023.07.13 | [EPL-1.0](licenses/clj-kondo.md) | [![GitHub stars](https://img.shields.io/github/stars/borkdude/clj-kondo?cacheSeconds=3600)](https://github.com/borkdude/clj-kondo){target=_blank} | [CLOJURE](descriptors/clojure_clj_kondo.md) | :heart: | [MegaLinter reference](https://github.com/borkdude/clj-kondo/blob/master/doc/ci-integration.md#github){target=_blank} | +| [**cljstyle**](https://github.com/greglook/cljstyle){target=_blank} | | 0.15.0 | [EPL-1.0](licenses/cljstyle.md) | [![GitHub stars](https://img.shields.io/github/stars/greglook/cljstyle?cacheSeconds=3600)](https://github.com/greglook/cljstyle){target=_blank} | [CLOJURE](descriptors/clojure_cljstyle.md) | :heart: | [MegaLinter reference](https://github.com/greglook/cljstyle/blob/main/doc/integrations.md){target=_blank} | +| [**coffeelint**](https://github.com/clutchski/coffeelint){target=_blank} | linux/amd64
linux/arm64 | 5.2.11 | [Other](licenses/coffeelint.md) | [![GitHub stars](https://img.shields.io/github/stars/clutchski/coffeelint?cacheSeconds=3600)](https://github.com/clutchski/coffeelint){target=_blank} | [COFFEE](descriptors/coffee_coffeelint.md) | :white_circle: | [Repository](https://github.com/clutchski/coffeelint){target=_blank} | +| [**cpplint**](https://github.com/cpplint/cpplint){target=_blank} | linux/amd64
linux/arm64 | 1.6.1 | [Other](licenses/cpplint.md) | [![GitHub stars](https://img.shields.io/github/stars/cpplint/cpplint?cacheSeconds=3600)](https://github.com/cpplint/cpplint){target=_blank} | [C](descriptors/c_cpplint.md)
[CPP](descriptors/cpp_cpplint.md) | :white_circle: | [Repository](https://github.com/cpplint/cpplint){target=_blank} | +| [**csharpier**](https://github.com/belav/csharpier){target=_blank} | linux/amd64
linux/arm64 | 0.25.0 | [MIT](licenses/csharpier.md) | [![GitHub stars](https://img.shields.io/github/stars/belav/csharpier?cacheSeconds=3600)](https://github.com/belav/csharpier){target=_blank} | [CSHARP](descriptors/csharp_csharpier.md) | :white_circle: | [Repository](https://github.com/belav/csharpier){target=_blank} | +| [**cspell**](https://github.com/streetsidesoftware/cspell){target=_blank} | linux/amd64
linux/arm64 | 6.31.2 | [MIT](licenses/cspell.md) | [![GitHub stars](https://img.shields.io/github/stars/streetsidesoftware/cspell?cacheSeconds=3600)](https://github.com/streetsidesoftware/cspell){target=_blank} | [SPELL](descriptors/spell_cspell.md) | :heart: | [MegaLinter reference](https://github.com/streetsidesoftware/cspell/tree/master/packages/cspell#mega-linter){target=_blank} | +| [**dartanalyzer**](https://github.com/dart-lang/sdk){target=_blank} | linux/amd64
linux/arm64 | N/A | [BSD-3-Clause](licenses/dartanalyzer.md) | [![GitHub stars](https://img.shields.io/github/stars/dart-lang/sdk?cacheSeconds=3600)](https://github.com/dart-lang/sdk){target=_blank} | [DART](descriptors/dart_dartanalyzer.md) | :no_entry_sign: | [Repository](https://github.com/dart-lang/sdk){target=_blank} | +| [**devskim**](https://github.com/microsoft/DevSkim){target=_blank} | linux/amd64
linux/arm64 | 1.0.11 | [MIT](licenses/devskim.md) | [![GitHub stars](https://img.shields.io/github/stars/microsoft/DevSkim?cacheSeconds=3600)](https://github.com/microsoft/DevSkim){target=_blank} | [REPOSITORY](descriptors/repository_devskim.md) | :white_circle: | [Repository](https://github.com/microsoft/DevSkim){target=_blank} | +| [**djlint**](https://github.com/Riverside-Healthcare/djlint){target=_blank} | linux/amd64
linux/arm64 | 1.31.1 | [GPL-3.0](licenses/djlint.md) | [![GitHub stars](https://img.shields.io/github/stars/Riverside-Healthcare/djlint?cacheSeconds=3600)](https://github.com/Riverside-Healthcare/djlint){target=_blank} | [HTML](descriptors/html_djlint.md) | :heart: | [MegaLinter reference](https://djlint.com/docs/integrations/#megalinter){target=_blank} | +| [**dotenv-linter**](https://github.com/dotenv-linter/dotenv-linter){target=_blank} | linux/amd64
linux/arm64 | 3.3.0 | [MIT](licenses/dotenv-linter.md) | [![GitHub stars](https://img.shields.io/github/stars/dotenv-linter/dotenv-linter?cacheSeconds=3600)](https://github.com/dotenv-linter/dotenv-linter){target=_blank} | [ENV](descriptors/env_dotenv_linter.md) | :heart: | [MegaLinter reference](https://dotenv-linter.github.io/#/integrations/mega_linter){target=_blank} | +| [**dotnet-format**](https://github.com/dotnet/format){target=_blank} | linux/amd64
linux/arm64 | 6.0.412 | [MIT](licenses/dotnet-format.md) | [![GitHub stars](https://img.shields.io/github/stars/dotnet/format?cacheSeconds=3600)](https://github.com/dotnet/format){target=_blank} | [CSHARP](descriptors/csharp_dotnet_format.md)
[VBDOTNET](descriptors/vbdotnet_dotnet_format.md) | :white_circle: | [Repository](https://github.com/dotnet/format){target=_blank} | +| [**dustilock**](https://github.com/Checkmarx/dustilock){target=_blank} | linux/amd64
linux/arm64 | 1.2.0 | [Apache-2.0](licenses/dustilock.md) | [![GitHub stars](https://img.shields.io/github/stars/Checkmarx/dustilock?cacheSeconds=3600)](https://github.com/Checkmarx/dustilock){target=_blank} | [REPOSITORY](descriptors/repository_dustilock.md) | :white_circle: | [Repository](https://github.com/Checkmarx/dustilock){target=_blank} | +| [**editorconfig-checker**](https://github.com/editorconfig-checker/editorconfig-checker){target=_blank} | linux/amd64
linux/arm64 | 2.7.0 | [MIT](licenses/editorconfig-checker.md) | [![GitHub stars](https://img.shields.io/github/stars/editorconfig-checker/editorconfig-checker?cacheSeconds=3600)](https://github.com/editorconfig-checker/editorconfig-checker){target=_blank} | [EDITORCONFIG](descriptors/editorconfig_editorconfig_checker.md) | :heart: | [MegaLinter reference](https://github.com/editorconfig-checker/editorconfig-checker#mega-linter){target=_blank} | +| [**eslint**](https://github.com/eslint/eslint){target=_blank} | linux/amd64
linux/arm64 | 8.45.0 | [MIT](licenses/eslint.md) | [![GitHub stars](https://img.shields.io/github/stars/eslint/eslint?cacheSeconds=3600)](https://github.com/eslint/eslint){target=_blank} | [JAVASCRIPT](descriptors/javascript_eslint.md)
[JSX](descriptors/jsx_eslint.md)
[TSX](descriptors/tsx_eslint.md)
[TYPESCRIPT](descriptors/typescript_eslint.md) | :heart: | [MegaLinter reference](https://eslint.org/docs/user-guide/integrations#source-control){target=_blank} | +| [**eslint-plugin-jsonc**](https://github.com/ota-meshi/eslint-plugin-jsonc){target=_blank} | linux/amd64
linux/arm64 | 2.9.0 | [MIT](licenses/eslint-plugin-jsonc.md) | [![GitHub stars](https://img.shields.io/github/stars/ota-meshi/eslint-plugin-jsonc?cacheSeconds=3600)](https://github.com/ota-meshi/eslint-plugin-jsonc){target=_blank} | [JSON](descriptors/json_eslint_plugin_jsonc.md) | :heart: | [MegaLinter reference](https://eslint.org/docs/user-guide/integrations#source-control){target=_blank} | +| [**flake8**](https://github.com/PyCQA/flake8){target=_blank} | linux/amd64
linux/arm64 | 6.0.0 | [MIT](licenses/flake8.md) | [![GitHub stars](https://img.shields.io/github/stars/PyCQA/flake8?cacheSeconds=3600)](https://github.com/PyCQA/flake8){target=_blank} | [PYTHON](descriptors/python_flake8.md) | :white_circle: | [Repository](https://github.com/PyCQA/flake8){target=_blank} | +| [**gherkin-lint**](https://github.com/vsiakka/gherkin-lint){target=_blank} | linux/amd64
linux/arm64 | N/A | [ISC](licenses/gherkin-lint.md) | [![GitHub stars](https://img.shields.io/github/stars/vsiakka/gherkin-lint?cacheSeconds=3600)](https://github.com/vsiakka/gherkin-lint){target=_blank} | [GHERKIN](descriptors/gherkin_gherkin_lint.md) | :white_circle: | [Repository](https://github.com/vsiakka/gherkin-lint){target=_blank} | +| [**git_diff**](https://github.com/git/git){target=_blank} | linux/amd64
linux/arm64 | 2.38.5 | [LGPL-2.1](licenses/git_diff.md) | [![GitHub stars](https://img.shields.io/github/stars/git/git?cacheSeconds=3600)](https://github.com/git/git){target=_blank} | [REPOSITORY](descriptors/repository_git_diff.md) | | [Repository](https://github.com/git/git){target=_blank} | +| [**gitleaks**](https://github.com/gitleaks/gitleaks){target=_blank} | linux/amd64
linux/arm64 | 8.17.0 | [MIT](licenses/gitleaks.md) | [![GitHub stars](https://img.shields.io/github/stars/gitleaks/gitleaks?cacheSeconds=3600)](https://github.com/gitleaks/gitleaks){target=_blank} | [REPOSITORY](descriptors/repository_gitleaks.md) | :white_circle: | [Repository](https://github.com/gitleaks/gitleaks){target=_blank} | +| [**golangci-lint**](https://github.com/golangci/golangci-lint){target=_blank} | linux/amd64
linux/arm64 | 1.53.3 | [GPL-3.0](licenses/golangci-lint.md) | [![GitHub stars](https://img.shields.io/github/stars/golangci/golangci-lint?cacheSeconds=3600)](https://github.com/golangci/golangci-lint){target=_blank} | [GO](descriptors/go_golangci_lint.md) | :white_circle: | [Repository](https://github.com/golangci/golangci-lint){target=_blank} | +| [**graphql-schema-linter**](https://github.com/cjoudrey/graphql-schema-linter){target=_blank} | linux/amd64
linux/arm64 | 3.0.1 | [MIT](licenses/graphql-schema-linter.md) | [![GitHub stars](https://img.shields.io/github/stars/cjoudrey/graphql-schema-linter?cacheSeconds=3600)](https://github.com/cjoudrey/graphql-schema-linter){target=_blank} | [GRAPHQL](descriptors/graphql_graphql_schema_linter.md) | :hammer_and_wrench: | [Pull Request](https://github.com/cjoudrey/graphql-schema-linter/pull/272){target=_blank} | +| [**grype**](https://github.com/anchore/grype){target=_blank} | | 0.63.1 | [Apache-2.0](licenses/grype.md) | [![GitHub stars](https://img.shields.io/github/stars/anchore/grype?cacheSeconds=3600)](https://github.com/anchore/grype){target=_blank} | [REPOSITORY](descriptors/repository_grype.md) | :white_circle: | [Repository](https://github.com/anchore/grype){target=_blank} | +| [**hadolint**](https://github.com/hadolint/hadolint){target=_blank} | linux/amd64
linux/arm64 | 2.12.0 | [GPL-3.0](licenses/hadolint.md) | [![GitHub stars](https://img.shields.io/github/stars/hadolint/hadolint?cacheSeconds=3600)](https://github.com/hadolint/hadolint){target=_blank} | [DOCKERFILE](descriptors/dockerfile_hadolint.md) | :heart: | [MegaLinter reference](https://github.com/hadolint/hadolint/blob/master/docs/INTEGRATION.md#mega-linter){target=_blank} | +| [**helm**](https://github.com/helm/helm){target=_blank} | linux/amd64
linux/arm64 | 3.10.2 | [Apache-2.0](licenses/helm.md) | [![GitHub stars](https://img.shields.io/github/stars/helm/helm?cacheSeconds=3600)](https://github.com/helm/helm){target=_blank} | [KUBERNETES](descriptors/kubernetes_helm.md) | :white_circle: | [Repository](https://github.com/helm/helm){target=_blank} | +| [**htmlhint**](https://github.com/htmlhint/HTMLHint){target=_blank} | linux/amd64
linux/arm64 | 1.1.4 | [MIT](licenses/htmlhint.md) | [![GitHub stars](https://img.shields.io/github/stars/htmlhint/HTMLHint?cacheSeconds=3600)](https://github.com/htmlhint/HTMLHint){target=_blank} | [HTML](descriptors/html_htmlhint.md) | :heart: | [MegaLinter reference](https://htmlhint.com/docs/user-guide/integrations/task-runner){target=_blank} | +| [**isort**](https://github.com/PyCQA/isort){target=_blank} | linux/amd64
linux/arm64 | 5.12.0 | [MIT](licenses/isort.md) | [![GitHub stars](https://img.shields.io/github/stars/PyCQA/isort?cacheSeconds=3600)](https://github.com/PyCQA/isort){target=_blank} | [PYTHON](descriptors/python_isort.md) | :white_circle: | [Repository](https://github.com/PyCQA/isort){target=_blank} | +| [**jscpd**](https://github.com/kucherenko/jscpd){target=_blank} | linux/amd64
linux/arm64 | 3.5.9 | [MIT](licenses/jscpd.md) | [![GitHub stars](https://img.shields.io/github/stars/kucherenko/jscpd?cacheSeconds=3600)](https://github.com/kucherenko/jscpd){target=_blank} | [COPYPASTE](descriptors/copypaste_jscpd.md) | :heart: | [MegaLinter reference](https://github.com/kucherenko/jscpd#who-uses-jscpd){target=_blank} | +| [**jsonlint**](https://github.com/prantlf/jsonlint){target=_blank} | linux/amd64
linux/arm64 | 14.0.3 | [MIT](licenses/jsonlint.md) | [![GitHub stars](https://img.shields.io/github/stars/prantlf/jsonlint?cacheSeconds=3600)](https://github.com/prantlf/jsonlint){target=_blank} | [JSON](descriptors/json_jsonlint.md) | :white_circle: | [Repository](https://github.com/prantlf/jsonlint){target=_blank} | +| [**kics**](https://github.com/checkmarx/kics){target=_blank} | | 1.7.3 | [Apache-2.0](licenses/kics.md) | [![GitHub stars](https://img.shields.io/github/stars/checkmarx/kics?cacheSeconds=3600)](https://github.com/checkmarx/kics){target=_blank} | [REPOSITORY](descriptors/repository_kics.md) | :heart: | [MegaLinter reference](https://docs.kics.io/latest/integrations/){target=_blank} | +| [**ktlint**](https://github.com/pinterest/ktlint){target=_blank} | linux/amd64
linux/arm64 | 0.50.0 | [MIT](licenses/ktlint.md) | [![GitHub stars](https://img.shields.io/github/stars/pinterest/ktlint?cacheSeconds=3600)](https://github.com/pinterest/ktlint){target=_blank} | [KOTLIN](descriptors/kotlin_ktlint.md) | :heart: | [MegaLinter reference](https://github.com/pinterest/ktlint#-with-continuous-integration){target=_blank} | +| [**kubeconform**](https://github.com/yannh/kubeconform){target=_blank} | linux/amd64
linux/arm64 | 0.6.3 | [Apache-2.0](licenses/kubeconform.md) | [![GitHub stars](https://img.shields.io/github/stars/yannh/kubeconform?cacheSeconds=3600)](https://github.com/yannh/kubeconform){target=_blank} | [KUBERNETES](descriptors/kubernetes_kubeconform.md) | :white_circle: | [Repository](https://github.com/yannh/kubeconform){target=_blank} | +| [**kubescape**](https://github.com/kubescape/kubescape){target=_blank} | linux/amd64
linux/arm64 | 2.3.6 | [Apache-2.0](licenses/kubescape.md) | [![GitHub stars](https://img.shields.io/github/stars/kubescape/kubescape?cacheSeconds=3600)](https://github.com/kubescape/kubescape){target=_blank} | [KUBERNETES](descriptors/kubernetes_kubescape.md) | :white_circle: | [Repository](https://github.com/kubescape/kubescape){target=_blank} | +| [**lintr**](https://github.com/r-lib/lintr){target=_blank} | linux/amd64
linux/arm64 | N/A | [Other](licenses/lintr.md) | [![GitHub stars](https://img.shields.io/github/stars/r-lib/lintr?cacheSeconds=3600)](https://github.com/r-lib/lintr){target=_blank} | [R](descriptors/r_lintr.md) | :heart: | [MegaLinter reference](https://cran.r-project.org/web/packages/lintr/vignettes/continuous-integration.html){target=_blank} | +| [**luacheck**](https://github.com/luarocks/luacheck){target=_blank} | linux/amd64
linux/arm64 | 1.1.1 | [MIT](licenses/luacheck.md) | [![GitHub stars](https://img.shields.io/github/stars/luarocks/luacheck?cacheSeconds=3600)](https://github.com/luarocks/luacheck){target=_blank} | [LUA](descriptors/lua_luacheck.md) | :no_entry_sign: | [Repository](https://github.com/luarocks/luacheck){target=_blank} | +| [**lychee**](https://github.com/lycheeverse/lychee){target=_blank} | | 0.13.0 | [Apache-2.0](licenses/lychee.md) | [![GitHub stars](https://img.shields.io/github/stars/lycheeverse/lychee?cacheSeconds=3600)](https://github.com/lycheeverse/lychee){target=_blank} | [SPELL](descriptors/spell_lychee.md) | :white_circle: | [Repository](https://github.com/lycheeverse/lychee){target=_blank} | +| [**markdown-link-check**](https://github.com/tcort/markdown-link-check){target=_blank} | linux/amd64
linux/arm64 | 3.11.2 | [ISC](licenses/markdown-link-check.md) | [![GitHub stars](https://img.shields.io/github/stars/tcort/markdown-link-check?cacheSeconds=3600)](https://github.com/tcort/markdown-link-check){target=_blank} | [MARKDOWN](descriptors/markdown_markdown_link_check.md) | :heart: | [MegaLinter reference](https://github.com/tcort/markdown-link-check#run-in-other-tools){target=_blank} | +| [**markdown-table-formatter**](https://github.com/nvuillam/markdown-table-formatter){target=_blank} | linux/amd64
linux/arm64 | 1.4.0 | [MIT](licenses/markdown-table-formatter.md) | [![GitHub stars](https://img.shields.io/github/stars/nvuillam/markdown-table-formatter?cacheSeconds=3600)](https://github.com/nvuillam/markdown-table-formatter){target=_blank} | [MARKDOWN](descriptors/markdown_markdown_table_formatter.md) | :white_circle: | [Repository](https://github.com/nvuillam/markdown-table-formatter){target=_blank} | +| [**markdownlint**](https://github.com/DavidAnson/markdownlint){target=_blank} | linux/amd64
linux/arm64 | 0.35.0 | [MIT](licenses/markdownlint.md) | [![GitHub stars](https://img.shields.io/github/stars/DavidAnson/markdownlint?cacheSeconds=3600)](https://github.com/DavidAnson/markdownlint){target=_blank} | [MARKDOWN](descriptors/markdown_markdownlint.md) | :white_circle: | [Repository](https://github.com/DavidAnson/markdownlint){target=_blank} | +| [**mypy**](https://github.com/python/mypy){target=_blank} | linux/amd64
linux/arm64 | 1.4.1 | [MIT](licenses/mypy.md) | [![GitHub stars](https://img.shields.io/github/stars/python/mypy?cacheSeconds=3600)](https://github.com/python/mypy){target=_blank} | [PYTHON](descriptors/python_mypy.md) | | [Repository](https://github.com/python/mypy){target=_blank} | +| [**npm-groovy-lint**](https://github.com/nvuillam/npm-groovy-lint){target=_blank} | linux/amd64
linux/arm64 | 11.1.1 | [GPL-3.0](licenses/npm-groovy-lint.md) | [![GitHub stars](https://img.shields.io/github/stars/nvuillam/npm-groovy-lint?cacheSeconds=3600)](https://github.com/nvuillam/npm-groovy-lint){target=_blank} | [GROOVY](descriptors/groovy_npm_groovy_lint.md) | :heart: | [MegaLinter reference](https://nvuillam.github.io/npm-groovy-lint/#mega-linter){target=_blank} | +| [**npm-package-json-lint**](https://github.com/tclindner/npm-package-json-lint){target=_blank} | linux/amd64
linux/arm64 | 7.0.0 | [MIT](licenses/npm-package-json-lint.md) | [![GitHub stars](https://img.shields.io/github/stars/tclindner/npm-package-json-lint?cacheSeconds=3600)](https://github.com/tclindner/npm-package-json-lint){target=_blank} | [JSON](descriptors/json_npm_package_json_lint.md) | :heart: | [MegaLinter reference](https://npmpackagejsonlint.org/docs/integrations#megalinter){target=_blank} | +| [**perlcritic**](https://github.com/Perl-Critic/Perl-Critic){target=_blank} | linux/amd64
linux/arm64 | 1.150 | [Other](licenses/perlcritic.md) | [![GitHub stars](https://img.shields.io/github/stars/Perl-Critic/Perl-Critic?cacheSeconds=3600)](https://github.com/Perl-Critic/Perl-Critic){target=_blank} | [PERL](descriptors/perl_perlcritic.md) | :white_circle: | [Repository](https://github.com/Perl-Critic/Perl-Critic){target=_blank} | +| [**phpcs**](https://github.com/squizlabs/PHP_CodeSniffer){target=_blank} | linux/amd64
linux/arm64 | 3.7.2 | [BSD-3-Clause](licenses/phpcs.md) | [![GitHub stars](https://img.shields.io/github/stars/squizlabs/PHP_CodeSniffer?cacheSeconds=3600)](https://github.com/squizlabs/PHP_CodeSniffer){target=_blank} | [PHP](descriptors/php_phpcs.md) | :white_circle: | [Repository](https://github.com/squizlabs/PHP_CodeSniffer){target=_blank} | +| [**phplint**](https://github.com/overtrue/phplint){target=_blank} | linux/amd64
linux/arm64 | 9.0.4 | [MIT](licenses/phplint.md) | [![GitHub stars](https://img.shields.io/github/stars/overtrue/phplint?cacheSeconds=3600)](https://github.com/overtrue/phplint){target=_blank} | [PHP](descriptors/php_phplint.md) | :white_circle: | [Repository](https://github.com/overtrue/phplint){target=_blank} | +| [**phpstan**](https://github.com/phpstan/phpstan){target=_blank} | linux/amd64
linux/arm64 | 1.10.25 | [MIT](licenses/phpstan.md) | [![GitHub stars](https://img.shields.io/github/stars/phpstan/phpstan?cacheSeconds=3600)](https://github.com/phpstan/phpstan){target=_blank} | [PHP](descriptors/php_phpstan.md) | :white_circle: | [Repository](https://github.com/phpstan/phpstan){target=_blank} | +| [**pmd**](https://github.com/pmd/pmd){target=_blank} | linux/amd64
linux/arm64 | 6.55.0 | [Apache-2.0](licenses/pmd.md) | [![GitHub stars](https://img.shields.io/github/stars/pmd/pmd?cacheSeconds=3600)](https://github.com/pmd/pmd){target=_blank} | [JAVA](descriptors/java_pmd.md) | :heart: | [MegaLinter reference](https://pmd.sourceforge.io/pmd-6.55.0/pmd_userdocs_tools_ci.html){target=_blank} | +| [**powershell**](https://github.com/PowerShell/PSScriptAnalyzer){target=_blank} | linux/amd64
linux/arm64 | 7.3.6 | [MIT](licenses/powershell.md) | [![GitHub stars](https://img.shields.io/github/stars/PowerShell/PSScriptAnalyzer?cacheSeconds=3600)](https://github.com/PowerShell/PSScriptAnalyzer){target=_blank} | [POWERSHELL](descriptors/powershell_powershell.md) | :white_circle: | [Repository](https://github.com/PowerShell/PSScriptAnalyzer){target=_blank} | +| [**powershell_formatter**](https://github.com/PowerShell/PSScriptAnalyzer){target=_blank} | linux/amd64
linux/arm64 | 7.3.6 | [MIT](licenses/powershell_formatter.md) | [![GitHub stars](https://img.shields.io/github/stars/PowerShell/PSScriptAnalyzer?cacheSeconds=3600)](https://github.com/PowerShell/PSScriptAnalyzer){target=_blank} | [POWERSHELL](descriptors/powershell_powershell_formatter.md) | :white_circle: | [Repository](https://github.com/PowerShell/PSScriptAnalyzer){target=_blank} | +| [**prettier**](https://github.com/prettier/prettier){target=_blank} | linux/amd64
linux/arm64 | 3.0.0 | [MIT](licenses/prettier.md) | [![GitHub stars](https://img.shields.io/github/stars/prettier/prettier?cacheSeconds=3600)](https://github.com/prettier/prettier){target=_blank} | [JAVASCRIPT](descriptors/javascript_prettier.md)
[JSON](descriptors/json_prettier.md)
[TYPESCRIPT](descriptors/typescript_prettier.md)
[YAML](descriptors/yaml_prettier.md) | :white_circle: | [Repository](https://github.com/prettier/prettier){target=_blank} | +| [**proselint**](https://github.com/amperser/proselint){target=_blank} | linux/amd64
linux/arm64 | 0.13.0 | [BSD-3-Clause](licenses/proselint.md) | [![GitHub stars](https://img.shields.io/github/stars/amperser/proselint?cacheSeconds=3600)](https://github.com/amperser/proselint){target=_blank} | [SPELL](descriptors/spell_proselint.md) | :white_circle: | [Repository](https://github.com/amperser/proselint){target=_blank} | +| [**protolint**](https://github.com/yoheimuta/protolint){target=_blank} | linux/amd64
linux/arm64 | 0.45.0 | [MIT](licenses/protolint.md) | [![GitHub stars](https://img.shields.io/github/stars/yoheimuta/protolint?cacheSeconds=3600)](https://github.com/yoheimuta/protolint){target=_blank} | [PROTOBUF](descriptors/protobuf_protolint.md) | :white_circle: | [Repository](https://github.com/yoheimuta/protolint){target=_blank} | +| [**psalm**](https://github.com/vimeo/psalm){target=_blank} | linux/amd64
linux/arm64 | Psalm.5.13.1@ | [MIT](licenses/psalm.md) | [![GitHub stars](https://img.shields.io/github/stars/vimeo/psalm?cacheSeconds=3600)](https://github.com/vimeo/psalm){target=_blank} | [PHP](descriptors/php_psalm.md) | :white_circle: | [Repository](https://github.com/vimeo/psalm){target=_blank} | +| [**puppet-lint**](https://github.com/puppetlabs/puppet-lint){target=_blank} | linux/amd64
linux/arm64 | 4.0.0 | [MIT](licenses/puppet-lint.md) | [![GitHub stars](https://img.shields.io/github/stars/puppetlabs/puppet-lint?cacheSeconds=3600)](https://github.com/puppetlabs/puppet-lint){target=_blank} | [PUPPET](descriptors/puppet_puppet_lint.md) | :white_circle: | [Repository](https://github.com/puppetlabs/puppet-lint){target=_blank} | +| [**pylint**](https://github.com/PyCQA/pylint){target=_blank} | linux/amd64
linux/arm64 | 2.17.4 | [GPL-2.0](licenses/pylint.md) | [![GitHub stars](https://img.shields.io/github/stars/PyCQA/pylint?cacheSeconds=3600)](https://github.com/PyCQA/pylint){target=_blank} | [PYTHON](descriptors/python_pylint.md) | :white_circle: | [Repository](https://github.com/PyCQA/pylint){target=_blank} | +| [**pyright**](https://github.com/microsoft/pyright){target=_blank} | linux/amd64
linux/arm64 | 1.1.317 | [Other](licenses/pyright.md) | [![GitHub stars](https://img.shields.io/github/stars/microsoft/pyright?cacheSeconds=3600)](https://github.com/microsoft/pyright){target=_blank} | [PYTHON](descriptors/python_pyright.md) | :white_circle: | [Repository](https://github.com/microsoft/pyright){target=_blank} | +| [**raku**](https://github.com/rakudo/rakudo){target=_blank} | linux/amd64
linux/arm64 | 2020.10 | [Artistic-2.0](licenses/raku.md) | [![GitHub stars](https://img.shields.io/github/stars/rakudo/rakudo?cacheSeconds=3600)](https://github.com/rakudo/rakudo){target=_blank} | [RAKU](descriptors/raku_raku.md) | :white_circle: | [Repository](https://github.com/rakudo/rakudo){target=_blank} | +| [**remark-lint**](https://github.com/remarkjs/remark-lint){target=_blank} | linux/amd64
linux/arm64 | 14.0.2 | [MIT](licenses/remark-lint.md) | [![GitHub stars](https://img.shields.io/github/stars/remarkjs/remark-lint?cacheSeconds=3600)](https://github.com/remarkjs/remark-lint){target=_blank} | [MARKDOWN](descriptors/markdown_remark_lint.md) | :white_circle: | [Repository](https://github.com/remarkjs/remark-lint){target=_blank} | +| [**revive**](https://github.com/mgechev/revive){target=_blank} | linux/amd64
linux/arm64 | 1.3.2 | [MIT](licenses/revive.md) | [![GitHub stars](https://img.shields.io/github/stars/mgechev/revive?cacheSeconds=3600)](https://github.com/mgechev/revive){target=_blank} | [GO](descriptors/go_revive.md) | :white_circle: | [Repository](https://github.com/mgechev/revive){target=_blank} | +| [**rst-lint**](https://github.com/twolfson/restructuredtext-lint){target=_blank} | linux/amd64
linux/arm64 | 1.4.0 | [Unlicense](licenses/rst-lint.md) | [![GitHub stars](https://img.shields.io/github/stars/twolfson/restructuredtext-lint?cacheSeconds=3600)](https://github.com/twolfson/restructuredtext-lint){target=_blank} | [RST](descriptors/rst_rst_lint.md) | :heart: | [MegaLinter reference](https://github.com/twolfson/restructuredtext-lint/wiki/Integration-in-other-tools#integration-in-other-tools){target=_blank} | +| [**rstcheck**](https://github.com/myint/rstcheck){target=_blank} | linux/amd64
linux/arm64 | 6.1.2 | [MIT](licenses/rstcheck.md) | [![GitHub stars](https://img.shields.io/github/stars/myint/rstcheck?cacheSeconds=3600)](https://github.com/myint/rstcheck){target=_blank} | [RST](descriptors/rst_rstcheck.md) | :heart: | [MegaLinter reference](https://rstcheck.readthedocs.io/en/latest/usage/integration/#use-with-mega-linter){target=_blank} | +| [**rstfmt**](https://github.com/dzhu/rstfmt){target=_blank} | linux/amd64
linux/arm64 | 0.0.13 | | | [RST](descriptors/rst_rstfmt.md) | :hammer_and_wrench: | [Pull Request](https://github.com/dzhu/rstfmt/pull/1){target=_blank} | +| [**rubocop**](https://github.com/rubocop-hq/rubocop){target=_blank} | linux/amd64
linux/arm64 | 1.54.2 | [MIT](licenses/rubocop.md) | [![GitHub stars](https://img.shields.io/github/stars/rubocop-hq/rubocop?cacheSeconds=3600)](https://github.com/rubocop-hq/rubocop){target=_blank} | [RUBY](descriptors/ruby_rubocop.md) | :heart: | [MegaLinter reference](https://docs.rubocop.org/rubocop/integration_with_other_tools.html#mega-linter-integration){target=_blank} | +| [**ruff**](https://github.com/charliermarsh/ruff){target=_blank} | | 0.0.278 | [MIT](licenses/ruff.md) | [![GitHub stars](https://img.shields.io/github/stars/charliermarsh/ruff?cacheSeconds=3600)](https://github.com/charliermarsh/ruff){target=_blank} | [PYTHON](descriptors/python_ruff.md) | :white_circle: | [Repository](https://github.com/charliermarsh/ruff){target=_blank} | +| [**scalafix**](https://github.com/scalacenter/scalafix){target=_blank} | linux/amd64
linux/arm64 | 0.11.0 | [Other](licenses/scalafix.md) | [![GitHub stars](https://img.shields.io/github/stars/scalacenter/scalafix?cacheSeconds=3600)](https://github.com/scalacenter/scalafix){target=_blank} | [SCALA](descriptors/scala_scalafix.md) | :heart: | [MegaLinter reference](https://scalacenter.github.io/scalafix/docs/users/installation.html#plugins-for-other-build-tools){target=_blank} | +| [**scss-lint**](https://github.com/sds/scss-lint){target=_blank} | linux/amd64
linux/arm64 | 0.60.0 | [MIT](licenses/scss-lint.md) | [![GitHub stars](https://img.shields.io/github/stars/sds/scss-lint?cacheSeconds=3600)](https://github.com/sds/scss-lint){target=_blank} | [CSS](descriptors/css_scss_lint.md) | :white_circle: | [Repository](https://github.com/sds/scss-lint){target=_blank} | +| [**secretlint**](https://github.com/secretlint/secretlint){target=_blank} | linux/amd64
linux/arm64 | 7.0.3 | [MIT](licenses/secretlint.md) | [![GitHub stars](https://img.shields.io/github/stars/secretlint/secretlint?cacheSeconds=3600)](https://github.com/secretlint/secretlint){target=_blank} | [REPOSITORY](descriptors/repository_secretlint.md) | :heart: | [MegaLinter reference](https://github.com/secretlint/secretlint#mega-linter){target=_blank} | +| [**semgrep**](https://github.com/returntocorp/semgrep){target=_blank} | linux/amd64
linux/arm64 | 1.32.0 | [LGPL-2.1](licenses/semgrep.md) | [![GitHub stars](https://img.shields.io/github/stars/returntocorp/semgrep?cacheSeconds=3600)](https://github.com/returntocorp/semgrep){target=_blank} | [REPOSITORY](descriptors/repository_semgrep.md) | :white_circle: | [Repository](https://github.com/returntocorp/semgrep){target=_blank} | +| [**sfdx-scanner-apex**](https://github.com/forcedotcom/sfdx-scanner){target=_blank} | linux/amd64
linux/arm64 | 3.14.0 | [MIT](licenses/sfdx-scanner-apex.md) | [![GitHub stars](https://img.shields.io/github/stars/forcedotcom/sfdx-scanner?cacheSeconds=3600)](https://github.com/forcedotcom/sfdx-scanner){target=_blank} | [SALESFORCE](descriptors/salesforce_sfdx_scanner_apex.md) | :hammer_and_wrench: | [Pull Request](https://github.com/forcedotcom/sfdx-scanner/pull/307){target=_blank} | +| [**sfdx-scanner-aura**](https://github.com/forcedotcom/sfdx-scanner){target=_blank} | linux/amd64
linux/arm64 | 3.14.0 | [MIT](licenses/sfdx-scanner-aura.md) | [![GitHub stars](https://img.shields.io/github/stars/forcedotcom/sfdx-scanner?cacheSeconds=3600)](https://github.com/forcedotcom/sfdx-scanner){target=_blank} | [SALESFORCE](descriptors/salesforce_sfdx_scanner_aura.md) | :hammer_and_wrench: | [Pull Request](https://github.com/forcedotcom/sfdx-scanner/pull/307){target=_blank} | +| [**sfdx-scanner-lwc**](https://github.com/forcedotcom/sfdx-scanner){target=_blank} | linux/amd64
linux/arm64 | 3.14.0 | [MIT](licenses/sfdx-scanner-lwc.md) | [![GitHub stars](https://img.shields.io/github/stars/forcedotcom/sfdx-scanner?cacheSeconds=3600)](https://github.com/forcedotcom/sfdx-scanner){target=_blank} | [SALESFORCE](descriptors/salesforce_sfdx_scanner_lwc.md) | :hammer_and_wrench: | [Pull Request](https://github.com/forcedotcom/sfdx-scanner/pull/307){target=_blank} | +| [**shellcheck**](https://github.com/koalaman/shellcheck){target=_blank} | linux/amd64
linux/arm64 | 0.9.0 | [GPL-3.0](licenses/shellcheck.md) | [![GitHub stars](https://img.shields.io/github/stars/koalaman/shellcheck?cacheSeconds=3600)](https://github.com/koalaman/shellcheck){target=_blank} | [BASH](descriptors/bash_shellcheck.md) | | [Repository](https://github.com/koalaman/shellcheck){target=_blank} | +| [**shfmt**](https://github.com/mvdan/sh){target=_blank} | linux/amd64
linux/arm64 | 3.7.0 | [BSD-3-Clause](licenses/shfmt.md) | [![GitHub stars](https://img.shields.io/github/stars/mvdan/sh?cacheSeconds=3600)](https://github.com/mvdan/sh){target=_blank} | [BASH](descriptors/bash_shfmt.md) | :no_entry_sign: | [Repository](https://github.com/mvdan/sh){target=_blank} | +| [**snakefmt**](https://github.com/snakemake/snakefmt){target=_blank} | linux/amd64
linux/arm64 | 0.8.4 | [MIT](licenses/snakefmt.md) | [![GitHub stars](https://img.shields.io/github/stars/snakemake/snakefmt?cacheSeconds=3600)](https://github.com/snakemake/snakefmt){target=_blank} | [SNAKEMAKE](descriptors/snakemake_snakefmt.md) | :white_circle: | [Repository](https://github.com/snakemake/snakefmt){target=_blank} | +| [**snakemake**](https://github.com/snakemake/snakemake){target=_blank} | linux/amd64
linux/arm64 | 7.30.1 | [MIT](licenses/snakemake.md) | [![GitHub stars](https://img.shields.io/github/stars/snakemake/snakemake?cacheSeconds=3600)](https://github.com/snakemake/snakemake){target=_blank} | [SNAKEMAKE](descriptors/snakemake_snakemake.md) | :white_circle: | [Repository](https://github.com/snakemake/snakemake){target=_blank} | +| [**spectral**](https://github.com/stoplightio/spectral){target=_blank} | linux/amd64
linux/arm64 | 6.8.0 | [Apache-2.0](licenses/spectral.md) | [![GitHub stars](https://img.shields.io/github/stars/stoplightio/spectral?cacheSeconds=3600)](https://github.com/stoplightio/spectral){target=_blank} | [OPENAPI](descriptors/openapi_spectral.md) | :white_circle: | [Repository](https://github.com/stoplightio/spectral){target=_blank} | +| [**sql-lint**](https://github.com/joereynolds/sql-lint){target=_blank} | linux/amd64
linux/arm64 | 1.0.0 | [MIT](licenses/sql-lint.md) | [![GitHub stars](https://img.shields.io/github/stars/joereynolds/sql-lint?cacheSeconds=3600)](https://github.com/joereynolds/sql-lint){target=_blank} | [SQL](descriptors/sql_sql_lint.md) | :white_circle: | [Repository](https://github.com/joereynolds/sql-lint){target=_blank} | +| [**sqlfluff**](https://github.com/sqlfluff/sqlfluff){target=_blank} | linux/amd64
linux/arm64 | 2.1.2 | [MIT](licenses/sqlfluff.md) | [![GitHub stars](https://img.shields.io/github/stars/sqlfluff/sqlfluff?cacheSeconds=3600)](https://github.com/sqlfluff/sqlfluff){target=_blank} | [SQL](descriptors/sql_sqlfluff.md) | :white_circle: | [Repository](https://github.com/sqlfluff/sqlfluff){target=_blank} | +| [**standard**](https://github.com/standard/standard){target=_blank} | linux/amd64
linux/arm64 | 17.1.0 | [MIT](licenses/standard.md) | [![GitHub stars](https://img.shields.io/github/stars/standard/standard?cacheSeconds=3600)](https://github.com/standard/standard){target=_blank} | [JAVASCRIPT](descriptors/javascript_standard.md) | :white_circle: | [Repository](https://github.com/standard/standard){target=_blank} | +| [**stylelint**](https://github.com/stylelint/stylelint){target=_blank} | linux/amd64
linux/arm64 | 15.10.1 | [MIT](licenses/stylelint.md) | [![GitHub stars](https://img.shields.io/github/stars/stylelint/stylelint?cacheSeconds=3600)](https://github.com/stylelint/stylelint){target=_blank} | [CSS](descriptors/css_stylelint.md) | :white_circle: | [Repository](https://github.com/stylelint/stylelint){target=_blank} | +| [**swiftlint**](https://github.com/realm/SwiftLint){target=_blank} | linux/amd64
linux/arm64 | 0.52.4 | [MIT](licenses/swiftlint.md) | [![GitHub stars](https://img.shields.io/github/stars/realm/SwiftLint?cacheSeconds=3600)](https://github.com/realm/SwiftLint){target=_blank} | [SWIFT](descriptors/swift_swiftlint.md) | :white_circle: | [Repository](https://github.com/realm/SwiftLint){target=_blank} | +| [**syft**](https://github.com/anchore/syft){target=_blank} | linux/amd64
linux/arm64 | 0.85.0 | [Apache-2.0](licenses/syft.md) | [![GitHub stars](https://img.shields.io/github/stars/anchore/syft?cacheSeconds=3600)](https://github.com/anchore/syft){target=_blank} | [REPOSITORY](descriptors/repository_syft.md) | :white_circle: | [Repository](https://github.com/anchore/syft){target=_blank} | +| [**tekton-lint**](https://github.com/IBM/tekton-lint){target=_blank} | linux/amd64
linux/arm64 | 0.6.0 | | [![GitHub stars](https://img.shields.io/github/stars/IBM/tekton-lint?cacheSeconds=3600)](https://github.com/IBM/tekton-lint){target=_blank} | [TEKTON](descriptors/tekton_tekton_lint.md) | :white_circle: | [Repository](https://github.com/IBM/tekton-lint){target=_blank} | +| [**terraform-fmt**](https://github.com/hashicorp/terraform){target=_blank} | linux/amd64
linux/arm64 | 1.5.3 | [MPL-2.0](licenses/terraform-fmt.md) | [![GitHub stars](https://img.shields.io/github/stars/hashicorp/terraform?cacheSeconds=3600)](https://github.com/hashicorp/terraform){target=_blank} | [TERRAFORM](descriptors/terraform_terraform_fmt.md) | :white_circle: | [Repository](https://github.com/hashicorp/terraform){target=_blank} | +| [**terragrunt**](https://github.com/gruntwork-io/terragrunt){target=_blank} | linux/amd64
linux/arm64 | 0.48.1 | [MIT](licenses/terragrunt.md) | [![GitHub stars](https://img.shields.io/github/stars/gruntwork-io/terragrunt?cacheSeconds=3600)](https://github.com/gruntwork-io/terragrunt){target=_blank} | [TERRAFORM](descriptors/terraform_terragrunt.md) | :white_circle: | [Repository](https://github.com/gruntwork-io/terragrunt){target=_blank} | +| [**terrascan**](https://github.com/tenable/terrascan){target=_blank} | linux/amd64
linux/arm64 | 1.18.1 | [Apache-2.0](licenses/terrascan.md) | [![GitHub stars](https://img.shields.io/github/stars/tenable/terrascan?cacheSeconds=3600)](https://github.com/tenable/terrascan){target=_blank} | [TERRAFORM](descriptors/terraform_terrascan.md) | :white_circle: | [Repository](https://github.com/tenable/terrascan){target=_blank} | +| [**tflint**](https://github.com/terraform-linters/tflint){target=_blank} | linux/amd64
linux/arm64 | 0.47.0 | [MPL-2.0](licenses/tflint.md) | [![GitHub stars](https://img.shields.io/github/stars/terraform-linters/tflint?cacheSeconds=3600)](https://github.com/terraform-linters/tflint){target=_blank} | [TERRAFORM](descriptors/terraform_tflint.md) | :white_circle: | [Repository](https://github.com/terraform-linters/tflint){target=_blank} | +| [**trivy**](https://github.com/aquasecurity/trivy){target=_blank} | linux/amd64
linux/arm64 | 0.43.1 | [Apache-2.0](licenses/trivy.md) | [![GitHub stars](https://img.shields.io/github/stars/aquasecurity/trivy?cacheSeconds=3600)](https://github.com/aquasecurity/trivy){target=_blank} | [REPOSITORY](descriptors/repository_trivy.md) | :white_circle: | [Repository](https://github.com/aquasecurity/trivy){target=_blank} | +| [**trivy-sbom**](https://github.com/aquasecurity/trivy){target=_blank} | linux/amd64
linux/arm64 | 0.43.1 | | [![GitHub stars](https://img.shields.io/github/stars/aquasecurity/trivy?cacheSeconds=3600)](https://github.com/aquasecurity/trivy){target=_blank} | [REPOSITORY](descriptors/repository_trivy_sbom.md) | :white_circle: | [Repository](https://github.com/aquasecurity/trivy){target=_blank} | +| [**trufflehog**](https://github.com/trufflesecurity/trufflehog){target=_blank} | linux/amd64
linux/arm64 | 3.44.0 | | [![GitHub stars](https://img.shields.io/github/stars/trufflesecurity/trufflehog?cacheSeconds=3600)](https://github.com/trufflesecurity/trufflehog){target=_blank} | [REPOSITORY](descriptors/repository_trufflehog.md) | :white_circle: | [Repository](https://github.com/trufflesecurity/trufflehog){target=_blank} | +| [**ts-standard**](https://github.com/standard/ts-standard){target=_blank} | linux/amd64
linux/arm64 | 12.0.2 | | [![GitHub stars](https://img.shields.io/github/stars/standard/ts-standard?cacheSeconds=3600)](https://github.com/standard/ts-standard){target=_blank} | [TYPESCRIPT](descriptors/typescript_ts_standard.md) | :white_circle: | [Repository](https://github.com/standard/ts-standard){target=_blank} | +| [**tsqllint**](https://github.com/tsqllint/tsqllint){target=_blank} | linux/amd64
linux/arm64 | 1.15.3.0 | [MIT](licenses/tsqllint.md) | [![GitHub stars](https://img.shields.io/github/stars/tsqllint/tsqllint?cacheSeconds=3600)](https://github.com/tsqllint/tsqllint){target=_blank} | [SQL](descriptors/sql_tsqllint.md) | :white_circle: | [Repository](https://github.com/tsqllint/tsqllint){target=_blank} | +| [**v8r**](https://github.com/chris48s/v8r){target=_blank} | linux/amd64
linux/arm64 | 2.0.0 | [MIT](licenses/v8r.md) | [![GitHub stars](https://img.shields.io/github/stars/chris48s/v8r?cacheSeconds=3600)](https://github.com/chris48s/v8r){target=_blank} | [JSON](descriptors/json_v8r.md)
[YAML](descriptors/yaml_v8r.md) | :no_entry_sign: | [Repository](https://github.com/chris48s/v8r){target=_blank} | +| [**vale**](https://github.com/errata-ai/vale){target=_blank} | | 2.28.0 | [MIT](licenses/vale.md) | [![GitHub stars](https://img.shields.io/github/stars/errata-ai/vale?cacheSeconds=3600)](https://github.com/errata-ai/vale){target=_blank} | [SPELL](descriptors/spell_vale.md) | :white_circle: | [Repository](https://github.com/errata-ai/vale){target=_blank} | +| [**xmllint**](http://xmlsoft.org/xmllint.html){target=_blank} | linux/amd64
linux/arm64 | 21004 | | | [XML](descriptors/xml_xmllint.md) | :white_circle: | [Web Site](http://xmlsoft.org/xmllint.html){target=_blank} | +| [**yamllint**](https://github.com/adrienverge/yamllint){target=_blank} | linux/amd64
linux/arm64 | 1.32.0 | [GPL-3.0](licenses/yamllint.md) | [![GitHub stars](https://img.shields.io/github/stars/adrienverge/yamllint?cacheSeconds=3600)](https://github.com/adrienverge/yamllint){target=_blank} | [YAML](descriptors/yaml_yamllint.md) | :no_entry_sign: | [Repository](https://github.com/adrienverge/yamllint){target=_blank} | diff --git a/docs/descriptors/arm_arm_ttk.md b/docs/descriptors/arm_arm_ttk.md index c687c16fb7f..db9a98c662b 100644 --- a/docs/descriptors/arm_arm_ttk.md +++ b/docs/descriptors/arm_arm_ttk.md @@ -111,15 +111,20 @@ Check the spelling of the name, or if a path was included, verify that the path - Dockerfile commands : ```dockerfile # Parent descriptor install +ARG TARGETPLATFORM ARG PWSH_VERSION='latest' ARG PWSH_DIRECTORY='/opt/microsoft/powershell' -RUN mkdir -p ${PWSH_DIRECTORY} \ +RUN case ${TARGETPLATFORM} in \ + "linux/amd64") POWERSHELL_ARCH=alpine-x64 ;; \ + "linux/arm64") POWERSHELL_ARCH=arm64 ;; \ + esac \ + && mkdir -p ${PWSH_DIRECTORY} \ && curl --retry 5 --retry-delay 5 -s \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer $(cat /run/secrets/GITHUB_TOKEN)" \ https://api.github.com/repos/powershell/powershell/releases/${PWSH_VERSION} \ | grep browser_download_url \ - | grep linux-alpine-x64 \ + | grep linux-${POWERSHELL_ARCH} \ | cut -d '"' -f 4 \ | xargs -n 1 wget -O - \ | tar -xzC ${PWSH_DIRECTORY} \ diff --git a/docs/descriptors/bash_bash_exec.md b/docs/descriptors/bash_bash_exec.md index f503a160698..31f15906bab 100644 --- a/docs/descriptors/bash_bash_exec.md +++ b/docs/descriptors/bash_bash_exec.md @@ -116,8 +116,6 @@ General help using GNU software: - Dockerfile commands : ```dockerfile -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 - +COPY --link --from=build-platform /usr/bin/bash-exec /usr/bin/bash-exec ``` diff --git a/docs/descriptors/bicep_bicep_linter.md b/docs/descriptors/bicep_bicep_linter.md index 476fcad61c9..9185bf2267e 100644 --- a/docs/descriptors/bicep_bicep_linter.md +++ b/docs/descriptors/bicep_bicep_linter.md @@ -247,12 +247,16 @@ Usage: - Dockerfile commands : ```dockerfile +ARG TARGETPLATFORM ARG BICEP_EXE='bicep' -ARG BICEP_URI='https://github.com/Azure/bicep/releases/latest/download/bicep-linux-musl-x64' ARG BICEP_DIR='/usr/local/bin' -RUN curl --retry 5 --retry-delay 5 -sLo ${BICEP_EXE} "${BICEP_URI}" \ - && chmod +x "${BICEP_EXE}" \ - && mv "${BICEP_EXE}" "${BICEP_DIR}" +RUN case ${TARGETPLATFORM} in \ + "linux/amd64") POWERSHELL_ARCH=musl-x64 ;; \ + "linux/arm64") POWERSHELL_ARCH=arm64 ;; \ +esac \ +&& curl --retry 5 --retry-delay 5 -sLo ${BICEP_EXE} "https://github.com/Azure/bicep/releases/latest/download/bicep-linux-${POWERSHELL_ARCH}" \ +&& chmod +x "${BICEP_EXE}" \ +&& mv "${BICEP_EXE}" "${BICEP_DIR}" ``` diff --git a/docs/descriptors/dart_dartanalyzer.md b/docs/descriptors/dart_dartanalyzer.md index dcded70f8d0..4e6b4fc7463 100644 --- a/docs/descriptors/dart_dartanalyzer.md +++ b/docs/descriptors/dart_dartanalyzer.md @@ -161,8 +161,13 @@ RUN ALPINE_GLIBC_BASE_URL="https://github.com/sgerrand/alpine-pkg-glibc/releases "$ALPINE_GLIBC_I18N_PACKAGE_FILENAME" # Linter install +ARG TARGETPLATFORM ARG DART_VERSION='2.8.4' -RUN wget --tries=5 https://storage.googleapis.com/dart-archive/channels/stable/release/${DART_VERSION}/sdk/dartsdk-linux-x64-release.zip -O - -q | unzip -q - \ +RUN case ${TARGETPLATFORM} in \ + "linux/amd64") DART_ARCH=x64 ;; \ + "linux/arm64") DART_ARCH=arm64 ;; \ + esac \ + && wget --tries=5 https://storage.googleapis.com/dart-archive/channels/stable/release/${DART_VERSION}/sdk/dartsdk-linux-${DART_ARCH}-release.zip -O - -q | unzip -q - \ && chmod +x dart-sdk/bin/dart* \ && mv dart-sdk/bin/* /usr/bin/ && mv dart-sdk/lib/* /usr/lib/ && mv dart-sdk/include/* /usr/include/ \ && rm -r dart-sdk/ diff --git a/docs/descriptors/env_dotenv_linter.md b/docs/descriptors/env_dotenv_linter.md index 17985382bcf..f9ee9808f94 100644 --- a/docs/descriptors/env_dotenv_linter.md +++ b/docs/descriptors/env_dotenv_linter.md @@ -122,6 +122,7 @@ SUBCOMMANDS: - Dockerfile commands : ```dockerfile -RUN wget -q -O - https://raw.githubusercontent.com/dotenv-linter/dotenv-linter/master/install.sh | sh -s +FROM dotenvlinter/dotenv-linter:latest as dotenvlinter +COPY --link --from=dotenvlinter /dotenv-linter /usr/bin/dotenv-linter ``` diff --git a/docs/descriptors/php_phpstan.md b/docs/descriptors/php_phpstan.md index 829742f485c..93e76001e88 100644 --- a/docs/descriptors/php_phpstan.md +++ b/docs/descriptors/php_phpstan.md @@ -137,7 +137,6 @@ RUN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GITHUB_TOKEN)" \ # Linter install FROM ghcr.io/phpstan/phpstan:latest-php8.1 as phpstan -COPY --link --from=phpstan /composer/vendor/phpstan/phpstan/phpstan.phar /usr/bin/phpstan -RUN chmod +x /usr/bin/phpstan +COPY --link --chmod=755 --from=phpstan /composer/vendor/phpstan/phpstan/phpstan.phar /usr/bin/phpstan ``` diff --git a/docs/descriptors/powershell_powershell.md b/docs/descriptors/powershell_powershell.md index 07da774f63e..55a1f3ffe6f 100644 --- a/docs/descriptors/powershell_powershell.md +++ b/docs/descriptors/powershell_powershell.md @@ -407,15 +407,20 @@ All parameters are case-insensitive. - Dockerfile commands : ```dockerfile # Parent descriptor install +ARG TARGETPLATFORM ARG PWSH_VERSION='latest' ARG PWSH_DIRECTORY='/opt/microsoft/powershell' -RUN mkdir -p ${PWSH_DIRECTORY} \ +RUN case ${TARGETPLATFORM} in \ + "linux/amd64") POWERSHELL_ARCH=alpine-x64 ;; \ + "linux/arm64") POWERSHELL_ARCH=arm64 ;; \ + esac \ + && mkdir -p ${PWSH_DIRECTORY} \ && curl --retry 5 --retry-delay 5 -s \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer $(cat /run/secrets/GITHUB_TOKEN)" \ https://api.github.com/repos/powershell/powershell/releases/${PWSH_VERSION} \ | grep browser_download_url \ - | grep linux-alpine-x64 \ + | grep linux-${POWERSHELL_ARCH} \ | cut -d '"' -f 4 \ | xargs -n 1 wget -O - \ | tar -xzC ${PWSH_DIRECTORY} \ diff --git a/docs/descriptors/powershell_powershell_formatter.md b/docs/descriptors/powershell_powershell_formatter.md index d298123c280..76a3f6f8d17 100644 --- a/docs/descriptors/powershell_powershell_formatter.md +++ b/docs/descriptors/powershell_powershell_formatter.md @@ -408,15 +408,20 @@ All parameters are case-insensitive. - Dockerfile commands : ```dockerfile # Parent descriptor install +ARG TARGETPLATFORM ARG PWSH_VERSION='latest' ARG PWSH_DIRECTORY='/opt/microsoft/powershell' -RUN mkdir -p ${PWSH_DIRECTORY} \ +RUN case ${TARGETPLATFORM} in \ + "linux/amd64") POWERSHELL_ARCH=alpine-x64 ;; \ + "linux/arm64") POWERSHELL_ARCH=arm64 ;; \ + esac \ + && mkdir -p ${PWSH_DIRECTORY} \ && curl --retry 5 --retry-delay 5 -s \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer $(cat /run/secrets/GITHUB_TOKEN)" \ https://api.github.com/repos/powershell/powershell/releases/${PWSH_VERSION} \ | grep browser_download_url \ - | grep linux-alpine-x64 \ + | grep linux-${POWERSHELL_ARCH} \ | cut -d '"' -f 4 \ | xargs -n 1 wget -O - \ | tar -xzC ${PWSH_DIRECTORY} \ diff --git a/docs/descriptors/python_ruff.md b/docs/descriptors/python_ruff.md index 8e9cce07cfd..c5cbcc7da77 100644 --- a/docs/descriptors/python_ruff.md +++ b/docs/descriptors/python_ruff.md @@ -115,5 +115,17 @@ For help with a specific command, see: `ruff help `. ### Installation on mega-linter Docker image -- PIP packages (Python): - - [ruff](https://pypi.org/project/ruff) +- Dockerfile commands : +```dockerfile +FROM --platform=$BUILDPLATFORM alpine:3 AS fetch-ruff +ARG BUILDARCH +RUN --mount=type=cache,target=/var/cache/apk,id=apk-${BUILDARCH},sharing=locked \ + apk add --update curl +WORKDIR / +ARG TARGETARCH +RUN export DL_LOCATION="https://github.com/charliermarsh/ruff/releases/latest/download/ruff-$([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64" || echo "aarch64")-unknown-linux-musl.tar.gz" \ + && echo "Downloading from ${DL_LOCATION}" \ + && curl --location "${DL_LOCATION}" | tar -xzv +COPY --link --from=fetch-ruff /ruff /usr/bin/ruff +``` + diff --git a/docs/descriptors/scala.md b/docs/descriptors/scala.md index 299a4177201..666b6f1ea80 100644 --- a/docs/descriptors/scala.md +++ b/docs/descriptors/scala.md @@ -30,12 +30,5 @@ description: scalafix is available to analyze SCALA files in MegaLinter ### Installation -- Dockerfile commands : -```dockerfile -RUN curl --retry-all-errors --retry 10 -fLo coursier https://git.io/coursier-cli && \ - chmod +x coursier - -``` - - APK packages (Linux): - [openjdk11](https://pkgs.alpinelinux.org/packages?branch=edge&name=openjdk11) diff --git a/docs/descriptors/scala_scalafix.md b/docs/descriptors/scala_scalafix.md index d6505eb954b..2bbd1793d43 100644 --- a/docs/descriptors/scala_scalafix.md +++ b/docs/descriptors/scala_scalafix.md @@ -231,11 +231,6 @@ Less common options: - Dockerfile commands : ```dockerfile -# Parent descriptor install -RUN curl --retry-all-errors --retry 10 -fLo coursier https://git.io/coursier-cli && \ - chmod +x coursier - -# Linter install -RUN ./coursier install scalafix --quiet --install-dir /usr/bin && rm -rf /root/.cache +COPY --link --from=build-platform /usr/bin/scalafix /usr/bin/ ``` diff --git a/docs/descriptors/xml_xmllint.md b/docs/descriptors/xml_xmllint.md index 466e8761afb..b05146f9f06 100644 --- a/docs/descriptors/xml_xmllint.md +++ b/docs/descriptors/xml_xmllint.md @@ -25,7 +25,7 @@ To apply file formatting you must set `XML_XMLLINT_CLI_LINT_MODE: file` and `XML | Variable | Description | Default value | |-----------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------| | XML_XMLLINT_AUTOFORMAT | If set to `true`, it will reformat and reindent the output | `false` | -| XML_XMLLINT_INDENT | The number of indentation spaces when `XML_XMLLINT_AUTOFORMAT` is `true` | `` | +| XML_XMLLINT_INDENT | The number of indentation spaces when `XML_XMLLINT_AUTOFORMAT` is `true` | ` ` | | XML_XMLLINT_ARGUMENTS | User custom arguments to add in linter CLI call
Ex: `-s --foo "bar"` | | | XML_XMLLINT_FILTER_REGEX_INCLUDE | Custom regex including filter
Ex: `(src\|lib)` | Include every file | | XML_XMLLINT_FILTER_REGEX_EXCLUDE | Custom regex excluding filter
Ex: `(test\|examples)` | Exclude no file | diff --git a/flavors/ci_light/Dockerfile b/flavors/ci_light/Dockerfile index a0f2260fdf3..e77dd37530f 100644 --- a/flavors/ci_light/Dockerfile +++ b/flavors/ci_light/Dockerfile @@ -15,6 +15,7 @@ FROM koalaman/shellcheck:stable as shellcheck FROM mvdan/shfmt:latest-alpine as shfmt FROM hadolint/hadolint:v2.12.0-alpine as hadolint +FROM dotenvlinter/dotenv-linter:latest as dotenvlinter FROM mrtazz/checkmake:latest as checkmake FROM zricethezav/gitleaks:v8.17.0 as gitleaks FROM trufflesecurity/trufflehog:latest as trufflehog @@ -94,10 +95,13 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END #PIPVENV__START -RUN PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir --upgrade pip virtualenv \ - && mkdir -p "/venvs/yamllint" && cd "/venvs/yamllint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir yamllint && deactivate && cd ./../.. \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf && rm -rf /root/.cache -ENV PATH="${PATH}":/venvs/yamllint/bin +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/yamllint" \ + && cd "/venvs/yamllint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip yamllint + #PIPVENV__END ############################ @@ -162,11 +166,7 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ ############################################################################################# #CARGO__START -RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable \ - && export PATH="/root/.cargo/bin:${PATH}" \ - && cargo install --force --locked sarif-fmt shellcheck-sarif \ - && rm -rf /root/.cargo/registry /root/.cargo/git /root/.cache/sccache /root/.rustup -ENV PATH="/root/.cargo/bin:${PATH}" + #CARGO__END ############################## @@ -178,7 +178,9 @@ ENV PATH="/root/.cargo/bin:${PATH}" #COPY__START COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck COPY --link --from=shfmt /bin/shfmt /usr/bin/ +COPY --link --from=node_modules /node-deps /node-deps COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint +COPY --link --from=dotenvlinter /dotenv-linter /usr/bin/dotenv-linter COPY --link --from=checkmake /checkmake /usr/bin/checkmake COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ COPY --link --from=trufflehog /usr/bin/trufflehog /usr/bin/ @@ -188,38 +190,17 @@ COPY --link --from=trufflehog /usr/bin/trufflehog /usr/bin/ ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #OTHER__START -# shellcheck installation -# Managed with COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck - -# shfmt installation -# Managed with COPY --link --from=shfmt /bin/shfmt /usr/bin/ - -# hadolint installation -# Managed with COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint - -# dotenv-linter installation -RUN wget -q -O - https://raw.githubusercontent.com/dotenv-linter/dotenv-linter/master/install.sh | sh -s \ - -# checkmake installation -# Managed with COPY --link --from=checkmake /checkmake /usr/bin/checkmake - -# gitleaks installation -# Managed with COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ - # grype installation - && curl -sSfL https://raw.githubusercontent.com/anchore/grype/main/install.sh | sh -s -- -b /usr/local/bin v0.63.1 \ - +RUN curl -sSfL https://raw.githubusercontent.com/anchore/grype/main/install.sh | sh -s -- -b /usr/local/bin v0.63.1 \ +# # trivy installation && wget --tries=5 -q -O - https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin - +# # trivy-sbom installation # Next line commented because already managed by another linter # RUN wget --tries=5 -q -O - https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin - -# trufflehog installation -# Managed with COPY --link --from=trufflehog /usr/bin/trufflehog /usr/bin/ - +# #OTHER__END ################################ @@ -277,7 +258,6 @@ LABEL com.github.actions.name="MegaLinter" \ org.opencontainers.image.description="Lint your code base with GitHub Actions" #EXTRA_DOCKERFILE_LINES__START -COPY entrypoint.sh /entrypoint.sh -RUN chmod +x entrypoint.sh +COPY --chmod=755 entrypoint.sh /entrypoint.sh ENTRYPOINT ["/bin/bash", "/entrypoint.sh"] #EXTRA_DOCKERFILE_LINES__END diff --git a/flavors/cupcake/Dockerfile b/flavors/cupcake/Dockerfile index 1f529951833..e86a81111c1 100644 --- a/flavors/cupcake/Dockerfile +++ b/flavors/cupcake/Dockerfile @@ -21,6 +21,7 @@ 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 dotenvlinter/dotenv-linter:latest as dotenvlinter FROM golang:1-alpine as revive ## The golang image used as a builder is a temporary workaround ## for the released revive binaries not returning version numbers (devel). @@ -30,6 +31,15 @@ RUN GOBIN=/usr/bin go install github.com/mgechev/revive@latest FROM ghcr.io/yannh/kubeconform:latest-alpine as kubeconform FROM mrtazz/checkmake:latest as checkmake FROM ghcr.io/phpstan/phpstan:latest-php8.1 as phpstan +FROM --platform=$BUILDPLATFORM alpine:3 AS fetch-ruff +ARG BUILDARCH +RUN --mount=type=cache,target=/var/cache/apk,id=apk-${BUILDARCH},sharing=locked \ + apk add --update curl +WORKDIR / +ARG TARGETARCH +RUN export DL_LOCATION="https://github.com/charliermarsh/ruff/releases/latest/download/ruff-$([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64" || echo "aarch64")-unknown-linux-musl.tar.gz" \ + && echo "Downloading from ${DL_LOCATION}" \ + && curl --location "${DL_LOCATION}" | tar -xzv FROM zricethezav/gitleaks:v8.17.0 as gitleaks FROM checkmarx/kics:alpine as kics FROM trufflesecurity/trufflehog:latest as trufflehog @@ -39,6 +49,43 @@ FROM tenable/terrascan:1.18.1 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 --platform=$BUILDPLATFORM alpine:3 AS cargo-build +WORKDIR /cargo +ENV HOME=/cargo +USER 0 +RUN --mount=type=cache,target=/var/cache/apk,id=apk-${BUILDARCH},sharing=locked \ + apk add --update \ + gcc \ + rustup \ + bash \ + git \ + musl-dev \ + llvm \ + clang \ + curl +RUN curl --location "https://github.com/cargo-bins/cargo-binstall/releases/latest/download/cargo-binstall-$([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64" || echo "aarch64")-unknown-linux-musl.tgz" | tar -xzv \ + && mkdir -p /cargo/.cargo/bin \ + && mv cargo-binstall /cargo/.cargo/bin \ + && chown -R 63425:63425 /cargo +USER 63425 +ENV CC_aarch64_unknown_linux_musl=clang \ + AR_aarch64_unknown_linux_musl=llvm-ar \ + CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_RUSTFLAGS="-Clink-self-contained=yes -Clinker=rust-lld" \ + CC_x86_64_unknown_linux_musl=clang \ + AR_x86_64_unknown_linux_musl=llvm-ar \ + CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_RUSTFLAGS="-Clink-self-contained=yes -Clinker=rust-lld" +ARG TARGETARCH +RUN rustup-init -y --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") + +RUN --mount=type=cache,id=cargo-${TARGETARCH},sharing=locked,target=/cargo/.cargo/registry/,uid=63425 \ + . /cargo/.cargo/env \ + && cargo binstall --no-confirm --no-symlinks sarif-fmt shellcheck-sarif --root /tmp --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") + +FROM scratch AS cargo +COPY --link --from=cargo-build /tmp/bin/* /bin/ +RUN ["/bin/sarif-fmt", "--help"] +RUN ["/bin/shellcheck-sarif", "--help"] + #FROM__END ################## @@ -138,28 +185,115 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END #PIPVENV__START -RUN PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir --upgrade pip virtualenv \ - && mkdir -p "/venvs/ansible-lint" && cd "/venvs/ansible-lint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir ansible-lint && deactivate && cd ./../.. \ - && mkdir -p "/venvs/cpplint" && cd "/venvs/cpplint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir cpplint && deactivate && cd ./../.. \ - && mkdir -p "/venvs/cfn-lint" && cd "/venvs/cfn-lint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir cfn-lint && deactivate && cd ./../.. \ - && mkdir -p "/venvs/djlint" && cd "/venvs/djlint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir djlint && deactivate && cd ./../.. \ - && mkdir -p "/venvs/pylint" && cd "/venvs/pylint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir pylint typing-extensions && deactivate && cd ./../.. \ - && mkdir -p "/venvs/black" && cd "/venvs/black" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir black && deactivate && cd ./../.. \ - && mkdir -p "/venvs/flake8" && cd "/venvs/flake8" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir flake8 && deactivate && cd ./../.. \ - && mkdir -p "/venvs/isort" && cd "/venvs/isort" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir isort black && deactivate && cd ./../.. \ - && mkdir -p "/venvs/mypy" && cd "/venvs/mypy" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir mypy && deactivate && cd ./../.. \ - && mkdir -p "/venvs/pyright" && cd "/venvs/pyright" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir pyright && deactivate && cd ./../.. \ - && mkdir -p "/venvs/ruff" && cd "/venvs/ruff" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir ruff && deactivate && cd ./../.. \ - && mkdir -p "/venvs/checkov" && cd "/venvs/checkov" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir packaging checkov && deactivate && cd ./../.. \ - && mkdir -p "/venvs/semgrep" && cd "/venvs/semgrep" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir semgrep && deactivate && cd ./../.. \ - && mkdir -p "/venvs/rst-lint" && cd "/venvs/rst-lint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir restructuredtext_lint && deactivate && cd ./../.. \ - && mkdir -p "/venvs/rstcheck" && cd "/venvs/rstcheck" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir rstcheck && deactivate && cd ./../.. \ - && mkdir -p "/venvs/rstfmt" && cd "/venvs/rstfmt" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir rstfmt && deactivate && cd ./../.. \ - && mkdir -p "/venvs/proselint" && cd "/venvs/proselint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir proselint && deactivate && cd ./../.. \ - && mkdir -p "/venvs/sqlfluff" && cd "/venvs/sqlfluff" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir sqlfluff && deactivate && cd ./../.. \ - && mkdir -p "/venvs/yamllint" && cd "/venvs/yamllint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir yamllint && deactivate && cd ./../.. \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf && rm -rf /root/.cache -ENV PATH="${PATH}":/venvs/ansible-lint/bin:/venvs/cpplint/bin:/venvs/cfn-lint/bin:/venvs/djlint/bin:/venvs/pylint/bin:/venvs/black/bin:/venvs/flake8/bin:/venvs/isort/bin:/venvs/mypy/bin:/venvs/pyright/bin:/venvs/ruff/bin:/venvs/checkov/bin:/venvs/semgrep/bin:/venvs/rst-lint/bin:/venvs/rstcheck/bin:/venvs/rstfmt/bin:/venvs/proselint/bin:/venvs/sqlfluff/bin:/venvs/yamllint/bin +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/ansible-lint" \ + && cd "/venvs/ansible-lint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip ansible-lint +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/cpplint" \ + && cd "/venvs/cpplint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip cpplint +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/cfn-lint" \ + && cd "/venvs/cfn-lint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip cfn-lint +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/djlint" \ + && cd "/venvs/djlint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip djlint +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/pylint" \ + && cd "/venvs/pylint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip pylint typing-extensions +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/black" \ + && cd "/venvs/black" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip black +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/flake8" \ + && cd "/venvs/flake8" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip flake8 +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/isort" \ + && cd "/venvs/isort" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip isort black +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/mypy" \ + && cd "/venvs/mypy" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip mypy +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/pyright" \ + && cd "/venvs/pyright" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip pyright +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/checkov" \ + && cd "/venvs/checkov" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip packaging checkov +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/semgrep" \ + && cd "/venvs/semgrep" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip semgrep +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/rst-lint" \ + && cd "/venvs/rst-lint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip restructuredtext_lint +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/rstcheck" \ + && cd "/venvs/rstcheck" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip rstcheck +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/rstfmt" \ + && cd "/venvs/rstfmt" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip rstfmt +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/proselint" \ + && cd "/venvs/proselint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip proselint +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/sqlfluff" \ + && cd "/venvs/sqlfluff" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip sqlfluff +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/yamllint" \ + && cd "/venvs/yamllint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip yamllint + #PIPVENV__END ############################ @@ -267,7 +401,7 @@ RUN echo 'gem: --no-document' >> ~/.gemrc && \ #CARGO__START RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable \ && export PATH="/root/.cargo/bin:${PATH}" \ - && rustup component add clippy && cargo install --force --locked sarif-fmt shellcheck-sarif \ + && rustup component add clippy \ && rm -rf /root/.cargo/registry /root/.cargo/git /root/.cache/sccache ENV PATH="/root/.cargo/bin:${PATH}" #CARGO__END @@ -279,19 +413,23 @@ ENV PATH="/root/.cargo/bin:${PATH}" ############################################################################################# #COPY__START +COPY --link --from=node_modules /node-deps /node-deps 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 --link --from=build-platform /usr/bin/bash-exec /usr/bin/bash-exec # 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=dotenvlinter /dotenv-linter /usr/bin/dotenv-linter COPY --link --from=revive /usr/bin/revive /usr/bin/revive COPY --link --from=kubeconform /kubeconform /usr/bin/ COPY --link --from=checkmake /checkmake /usr/bin/checkmake -COPY --link --from=phpstan /composer/vendor/phpstan/phpstan/phpstan.phar /usr/bin/phpstan +COPY --link --chmod=755 --from=phpstan /composer/vendor/phpstan/phpstan/phpstan.phar /usr/bin/phpstan +COPY --link --from=fetch-ruff /ruff /usr/bin/ruff COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ COPY --link --from=kics /app/bin/kics /usr/bin/ COPY --from=kics /app/bin/assets /opt/kics/assets/ @@ -301,6 +439,7 @@ 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=cargo /bin/* /usr/bin/ #COPY__END ############################################################################################# @@ -350,11 +489,11 @@ RUN ALPINE_GLIBC_BASE_URL="https://github.com/sgerrand/alpine-pkg-glibc/releases "$ALPINE_GLIBC_BIN_PACKAGE_FILENAME" \ "$ALPINE_GLIBC_I18N_PACKAGE_FILENAME" - +# # JAVA installation ENV JAVA_HOME=/usr/lib/jvm/java-11-openjdk ENV PATH="$JAVA_HOME/bin:${PATH}" - +# # PHP installation RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GITHUB_TOKEN)" \ && export GITHUB_AUTH_TOKEN \ @@ -371,50 +510,22 @@ RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GI && rm phive.phar.asc \ && update-alternatives --install /usr/bin/php php /usr/bin/php81 110 - -# actionlint installation -# 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 -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 -# 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 --link --from=shfmt /bin/shfmt /usr/bin/ - +# # clj-kondo installation - && curl --retry 5 --retry-delay 5 -sLO https://raw.githubusercontent.com/clj-kondo/clj-kondo/master/script/install-clj-kondo \ +RUN curl --retry 5 --retry-delay 5 -sLO https://raw.githubusercontent.com/clj-kondo/clj-kondo/master/script/install-clj-kondo \ && chmod +x install-clj-kondo \ && ./install-clj-kondo \ - +# # cljstyle installation && curl --retry 5 --retry-delay 5 -sLO https://raw.githubusercontent.com/greglook/cljstyle/main/script/install-cljstyle \ && chmod +x install-cljstyle \ && ./install-cljstyle \ - -# hadolint installation -# Managed with COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint - -# editorconfig-checker installation -# 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 - -# revive installation -# 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 \ -H "Accept: application/vnd.github+json" \ @@ -426,87 +537,54 @@ RUN --mount=type=secret,id=GITHUB_TOKEN CHECKSTYLE_LATEST=$(curl -s \ && curl --retry 5 --retry-delay 5 -sSL $CHECKSTYLE_LATEST \ --output /usr/bin/checkstyle - +# # pmd installation RUN wget --quiet https://github.com/pmd/pmd/releases/download/pmd_releases%2F${PMD_VERSION}/pmd-bin-${PMD_VERSION}.zip && \ unzip pmd-bin-${PMD_VERSION}.zip && \ rm pmd-bin-${PMD_VERSION}.zip && \ mv pmd-bin-${PMD_VERSION} /usr/bin/pmd && \ chmod +x /usr/bin/pmd/bin/run.sh \ - +# # ktlint installation && curl --retry 5 --retry-delay 5 -sSLO https://github.com/pinterest/ktlint/releases/latest/download/ktlint && \ chmod a+x ktlint && \ mv "ktlint" /usr/bin/ \ - -# kubeconform installation -# Managed with COPY --link --from=kubeconform /kubeconform /usr/bin/ - +# # kubescape installation && ln -s /lib/libc.so.6 /usr/lib/libresolv.so.2 && \ curl --retry 5 --retry-delay 5 -sLv https://raw.githubusercontent.com/kubescape/kubescape/master/install.sh | /bin/bash -s -- -v v2.3.6 - -# 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 - -# phpstan installation -# Managed with COPY --link --from=phpstan /composer/vendor/phpstan/phpstan/phpstan.phar /usr/bin/phpstan -RUN chmod +x /usr/bin/phpstan - +# # psalm installation RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GITHUB_TOKEN)" && export GITHUB_AUTH_TOKEN && phive --no-progress install psalm -g --trust-gpg-keys 8A03EA3B385DBAA1,12CE0F1D262429A5 - +# # phplint installation RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GITHUB_TOKEN)" && export GITHUB_AUTH_TOKEN && phive --no-progress install overtrue/phplint --force-accept-unsigned -g - +# # mypy installation ENV MYPY_CACHE_DIR=/tmp - -# gitleaks installation -# Managed with COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ - +# # grype installation RUN curl -sSfL https://raw.githubusercontent.com/anchore/grype/main/install.sh | sh -s -- -b /usr/local/bin v0.63.1 \ - +# # kics installation -# 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/ - +# # trivy installation RUN wget --tries=5 -q -O - https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin - +# # trivy-sbom installation # Next line commented because already managed by another linter # RUN wget --tries=5 -q -O - https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin - -# trufflehog installation -# Managed with COPY --link --from=trufflehog /usr/bin/trufflehog /usr/bin/ - -# lychee installation -# Managed with COPY --link --from=lychee /usr/local/bin/lychee /usr/bin/ - -# tflint installation -# Managed with COPY --link --from=tflint /usr/local/bin/tflint /usr/bin/ - -# terrascan installation -# Managed with COPY --link --from=terrascan /go/bin/terrascan /usr/bin/ - -# terragrunt installation -# Managed with COPY --link --from=terragrunt /usr/local/bin/terragrunt /usr/bin/ - -# terraform-fmt installation -# Managed with COPY --link --from=terragrunt /bin/terraform /usr/bin/ - +# #OTHER__END ################################ @@ -564,7 +642,6 @@ LABEL com.github.actions.name="MegaLinter" \ org.opencontainers.image.description="Lint your code base with GitHub Actions" #EXTRA_DOCKERFILE_LINES__START -COPY entrypoint.sh /entrypoint.sh -RUN chmod +x entrypoint.sh +COPY --chmod=755 entrypoint.sh /entrypoint.sh ENTRYPOINT ["/bin/bash", "/entrypoint.sh"] #EXTRA_DOCKERFILE_LINES__END diff --git a/flavors/documentation/Dockerfile b/flavors/documentation/Dockerfile index 919080d98be..8de56abbe4c 100644 --- a/flavors/documentation/Dockerfile +++ b/flavors/documentation/Dockerfile @@ -21,6 +21,7 @@ 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 dotenvlinter/dotenv-linter:latest as dotenvlinter FROM ghcr.io/yannh/kubeconform:latest-alpine as kubeconform FROM mrtazz/checkmake:latest as checkmake FROM yoheimuta/protolint:latest as protolint @@ -113,18 +114,61 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END #PIPVENV__START -RUN PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir --upgrade pip virtualenv \ - && mkdir -p "/venvs/ansible-lint" && cd "/venvs/ansible-lint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir ansible-lint && deactivate && cd ./../.. \ - && mkdir -p "/venvs/djlint" && cd "/venvs/djlint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir djlint && deactivate && cd ./../.. \ - && mkdir -p "/venvs/checkov" && cd "/venvs/checkov" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir packaging checkov && deactivate && cd ./../.. \ - && mkdir -p "/venvs/semgrep" && cd "/venvs/semgrep" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir semgrep && deactivate && cd ./../.. \ - && mkdir -p "/venvs/snakemake" && cd "/venvs/snakemake" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir snakemake && deactivate && cd ./../.. \ - && mkdir -p "/venvs/snakefmt" && cd "/venvs/snakefmt" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir snakefmt && deactivate && cd ./../.. \ - && mkdir -p "/venvs/proselint" && cd "/venvs/proselint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir proselint && deactivate && cd ./../.. \ - && mkdir -p "/venvs/sqlfluff" && cd "/venvs/sqlfluff" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir sqlfluff && deactivate && cd ./../.. \ - && mkdir -p "/venvs/yamllint" && cd "/venvs/yamllint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir yamllint && deactivate && cd ./../.. \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf && rm -rf /root/.cache -ENV PATH="${PATH}":/venvs/ansible-lint/bin:/venvs/djlint/bin:/venvs/checkov/bin:/venvs/semgrep/bin:/venvs/snakemake/bin:/venvs/snakefmt/bin:/venvs/proselint/bin:/venvs/sqlfluff/bin:/venvs/yamllint/bin +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/ansible-lint" \ + && cd "/venvs/ansible-lint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip ansible-lint +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/djlint" \ + && cd "/venvs/djlint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip djlint +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/checkov" \ + && cd "/venvs/checkov" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip packaging checkov +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/semgrep" \ + && cd "/venvs/semgrep" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip semgrep +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/snakemake" \ + && cd "/venvs/snakemake" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakemake +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/snakefmt" \ + && cd "/venvs/snakefmt" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakefmt +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/proselint" \ + && cd "/venvs/proselint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip proselint +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/sqlfluff" \ + && cd "/venvs/sqlfluff" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip sqlfluff +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/yamllint" \ + && cd "/venvs/yamllint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip yamllint + #PIPVENV__END ############################ @@ -205,11 +249,7 @@ RUN echo 'gem: --no-document' >> ~/.gemrc && \ ############################################################################################# #CARGO__START -RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable \ - && export PATH="/root/.cargo/bin:${PATH}" \ - && cargo install --force --locked sarif-fmt shellcheck-sarif \ - && rm -rf /root/.cargo/registry /root/.cargo/git /root/.cache/sccache /root/.rustup -ENV PATH="/root/.cargo/bin:${PATH}" + #CARGO__END ############################## @@ -223,11 +263,14 @@ 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 --link --from=build-platform /usr/bin/bash-exec /usr/bin/bash-exec # 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=node_modules /node-deps /node-deps COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker +COPY --link --from=dotenvlinter /dotenv-linter /usr/bin/dotenv-linter COPY --link --from=kubeconform /kubeconform /usr/bin/ COPY --link --from=checkmake /checkmake /usr/bin/checkmake COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ @@ -241,72 +284,26 @@ COPY --link --from=lychee /usr/local/bin/lychee /usr/bin/ ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #OTHER__START -# actionlint installation -# 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 -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 -# 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 --link --from=shfmt /bin/shfmt /usr/bin/ - -# hadolint installation -# Managed with COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint - -# editorconfig-checker installation -# 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 \ - # ktlint installation - && curl --retry 5 --retry-delay 5 -sSLO https://github.com/pinterest/ktlint/releases/latest/download/ktlint && \ +RUN curl --retry 5 --retry-delay 5 -sSLO https://github.com/pinterest/ktlint/releases/latest/download/ktlint && \ chmod a+x ktlint && \ mv "ktlint" /usr/bin/ \ - -# kubeconform installation -# Managed with COPY --link --from=kubeconform /kubeconform /usr/bin/ - +# # kubescape installation && ln -s /lib/libc.so.6 /usr/lib/libresolv.so.2 && \ curl --retry 5 --retry-delay 5 -sLv https://raw.githubusercontent.com/kubescape/kubescape/master/install.sh | /bin/bash -s -- -v v2.3.6 \ - -# checkmake installation -# Managed with COPY --link --from=checkmake /checkmake /usr/bin/checkmake - -# protolint installation -# Managed with COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ - -# gitleaks installation -# Managed with COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ - +# # grype installation && curl -sSfL https://raw.githubusercontent.com/anchore/grype/main/install.sh | sh -s -- -b /usr/local/bin v0.63.1 \ - +# # trivy installation && wget --tries=5 -q -O - https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin - +# # trivy-sbom installation # Next line commented because already managed by another linter # RUN wget --tries=5 -q -O - https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin - -# trufflehog installation -# Managed with COPY --link --from=trufflehog /usr/bin/trufflehog /usr/bin/ - -# vale installation -# Managed with COPY --link --from=vale /bin/vale /bin/vale - -# lychee installation -# Managed with COPY --link --from=lychee /usr/local/bin/lychee /usr/bin/ - +# #OTHER__END ################################ @@ -364,7 +361,6 @@ LABEL com.github.actions.name="MegaLinter" \ org.opencontainers.image.description="Lint your code base with GitHub Actions" #EXTRA_DOCKERFILE_LINES__START -COPY entrypoint.sh /entrypoint.sh -RUN chmod +x entrypoint.sh +COPY --chmod=755 entrypoint.sh /entrypoint.sh ENTRYPOINT ["/bin/bash", "/entrypoint.sh"] #EXTRA_DOCKERFILE_LINES__END diff --git a/flavors/dotnet/Dockerfile b/flavors/dotnet/Dockerfile index 26fa3dab155..eeeda2f2067 100644 --- a/flavors/dotnet/Dockerfile +++ b/flavors/dotnet/Dockerfile @@ -21,6 +21,7 @@ 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 dotenvlinter/dotenv-linter:latest as dotenvlinter FROM ghcr.io/yannh/kubeconform:latest-alpine as kubeconform FROM mrtazz/checkmake:latest as checkmake FROM yoheimuta/protolint:latest as protolint @@ -128,19 +129,67 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END #PIPVENV__START -RUN PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir --upgrade pip virtualenv \ - && mkdir -p "/venvs/ansible-lint" && cd "/venvs/ansible-lint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir ansible-lint && deactivate && cd ./../.. \ - && mkdir -p "/venvs/cpplint" && cd "/venvs/cpplint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir cpplint && deactivate && cd ./../.. \ - && mkdir -p "/venvs/djlint" && cd "/venvs/djlint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir djlint && deactivate && cd ./../.. \ - && mkdir -p "/venvs/checkov" && cd "/venvs/checkov" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir packaging checkov && deactivate && cd ./../.. \ - && mkdir -p "/venvs/semgrep" && cd "/venvs/semgrep" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir semgrep && deactivate && cd ./../.. \ - && mkdir -p "/venvs/snakemake" && cd "/venvs/snakemake" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir snakemake && deactivate && cd ./../.. \ - && mkdir -p "/venvs/snakefmt" && cd "/venvs/snakefmt" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir snakefmt && deactivate && cd ./../.. \ - && mkdir -p "/venvs/proselint" && cd "/venvs/proselint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir proselint && deactivate && cd ./../.. \ - && mkdir -p "/venvs/sqlfluff" && cd "/venvs/sqlfluff" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir sqlfluff && deactivate && cd ./../.. \ - && mkdir -p "/venvs/yamllint" && cd "/venvs/yamllint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir yamllint && deactivate && cd ./../.. \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf && rm -rf /root/.cache -ENV PATH="${PATH}":/venvs/ansible-lint/bin:/venvs/cpplint/bin:/venvs/djlint/bin:/venvs/checkov/bin:/venvs/semgrep/bin:/venvs/snakemake/bin:/venvs/snakefmt/bin:/venvs/proselint/bin:/venvs/sqlfluff/bin:/venvs/yamllint/bin +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/ansible-lint" \ + && cd "/venvs/ansible-lint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip ansible-lint +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/cpplint" \ + && cd "/venvs/cpplint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip cpplint +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/djlint" \ + && cd "/venvs/djlint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip djlint +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/checkov" \ + && cd "/venvs/checkov" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip packaging checkov +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/semgrep" \ + && cd "/venvs/semgrep" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip semgrep +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/snakemake" \ + && cd "/venvs/snakemake" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakemake +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/snakefmt" \ + && cd "/venvs/snakefmt" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakefmt +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/proselint" \ + && cd "/venvs/proselint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip proselint +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/sqlfluff" \ + && cd "/venvs/sqlfluff" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip sqlfluff +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/yamllint" \ + && cd "/venvs/yamllint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip yamllint + #PIPVENV__END ############################ @@ -224,11 +273,7 @@ RUN echo 'gem: --no-document' >> ~/.gemrc && \ ############################################################################################# #CARGO__START -RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable \ - && export PATH="/root/.cargo/bin:${PATH}" \ - && cargo install --force --locked sarif-fmt shellcheck-sarif \ - && rm -rf /root/.cargo/registry /root/.cargo/git /root/.cache/sccache /root/.rustup -ENV PATH="/root/.cargo/bin:${PATH}" + #CARGO__END ############################## @@ -242,11 +287,14 @@ 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 --link --from=build-platform /usr/bin/bash-exec /usr/bin/bash-exec # 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=node_modules /node-deps /node-deps COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker +COPY --link --from=dotenvlinter /dotenv-linter /usr/bin/dotenv-linter COPY --link --from=kubeconform /kubeconform /usr/bin/ COPY --link --from=checkmake /checkmake /usr/bin/checkmake COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ @@ -277,14 +325,14 @@ RUN --mount=type=secret,id=GITHUB_TOKEN case ${TARGETPLATFORM} in \ | tar -xzC ${PWSH_DIRECTORY} \ && ln -sf ${PWSH_DIRECTORY}/pwsh /usr/bin/pwsh - +# # CSHARP installation RUN wget --tries=5 -q -O dotnet-install.sh https://dot.net/v1/dotnet-install.sh \ && chmod +x dotnet-install.sh \ && ./dotnet-install.sh --install-dir /usr/share/dotnet -channel 6.0 -version latest ENV PATH="${PATH}:/root/.dotnet/tools:/usr/share/dotnet" - +# # POWERSHELL installation RUN --mount=type=secret,id=GITHUB_TOKEN case ${TARGETPLATFORM} in \ "linux/amd64") POWERSHELL_ARCH=alpine-x64 ;; \ @@ -303,7 +351,7 @@ RUN --mount=type=secret,id=GITHUB_TOKEN case ${TARGETPLATFORM} in \ && ln -sf ${PWSH_DIRECTORY}/pwsh /usr/bin/pwsh \ && chmod +x /usr/bin/pwsh - +# # VBDOTNET installation # Next line commented because already managed by another linter # RUN wget --tries=5 -q -O dotnet-install.sh https://dot.net/v1/dotnet-install.sh \ @@ -311,12 +359,7 @@ RUN --mount=type=secret,id=GITHUB_TOKEN case ${TARGETPLATFORM} in \ # && ./dotnet-install.sh --install-dir /usr/share/dotnet -channel 6.0 -version latest # Next line commented because already managed by another linter # ENV PATH="${PATH}:/root/.dotnet/tools:/usr/share/dotnet" - -# actionlint installation -# 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" RUN curl --retry 5 --retry-delay 5 -sLO "${ARM_TTK_URI}" \ @@ -324,18 +367,7 @@ RUN curl --retry 5 --retry-delay 5 -sLO "${ARM_TTK_URI}" \ && rm "${ARM_TTK_NAME}" \ && ln -sTf "${ARM_TTK_PSD1}" /usr/bin/arm-ttk \ && chmod a+x /usr/bin/arm-ttk \ - -# 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 -# 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 --link --from=shfmt /bin/shfmt /usr/bin/ - +# # bicep_linter installation && case ${TARGETPLATFORM} in \ "linux/amd64") POWERSHELL_ARCH=musl-x64 ;; \ @@ -344,66 +376,36 @@ esac \ && curl --retry 5 --retry-delay 5 -sLo ${BICEP_EXE} "https://github.com/Azure/bicep/releases/latest/download/bicep-linux-${POWERSHELL_ARCH}" \ && chmod +x "${BICEP_EXE}" \ && mv "${BICEP_EXE}" "${BICEP_DIR}" \ - +# # csharpier installation && /usr/share/dotnet/dotnet tool install -g csharpier \ - -# hadolint installation -# Managed with COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint - -# editorconfig-checker installation -# 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 \ - +# # ktlint installation && curl --retry 5 --retry-delay 5 -sSLO https://github.com/pinterest/ktlint/releases/latest/download/ktlint && \ chmod a+x ktlint && \ mv "ktlint" /usr/bin/ \ - -# kubeconform installation -# Managed with COPY --link --from=kubeconform /kubeconform /usr/bin/ - +# # kubescape installation && ln -s /lib/libc.so.6 /usr/lib/libresolv.so.2 && \ curl --retry 5 --retry-delay 5 -sLv https://raw.githubusercontent.com/kubescape/kubescape/master/install.sh | /bin/bash -s -- -v v2.3.6 \ - -# checkmake installation -# Managed with COPY --link --from=checkmake /checkmake /usr/bin/checkmake - +# # powershell installation && pwsh -c 'Install-Module -Name PSScriptAnalyzer -RequiredVersion ${PSSA_VERSION} -Scope AllUsers -Force' \ - +# # powershell_formatter installation # Next line commented because already managed by another linter # RUN pwsh -c 'Install-Module -Name PSScriptAnalyzer -RequiredVersion ${PSSA_VERSION} -Scope AllUsers -Force' - -# protolint installation -# Managed with COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ - -# gitleaks installation -# Managed with COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ - +# # grype installation && curl -sSfL https://raw.githubusercontent.com/anchore/grype/main/install.sh | sh -s -- -b /usr/local/bin v0.63.1 \ - +# # trivy installation && wget --tries=5 -q -O - https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin \ - +# # trivy-sbom installation # Next line commented because already managed by another linter # RUN wget --tries=5 -q -O - https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin - -# trufflehog installation -# Managed with COPY --link --from=trufflehog /usr/bin/trufflehog /usr/bin/ - -# vale installation -# Managed with COPY --link --from=vale /bin/vale /bin/vale - -# lychee installation -# Managed with COPY --link --from=lychee /usr/local/bin/lychee /usr/bin/ - +# # tsqllint installation # Next line commented because already managed by another linter # RUN wget --tries=5 -q -O dotnet-install.sh https://dot.net/v1/dotnet-install.sh \ @@ -412,7 +414,7 @@ esac \ # Next line commented because already managed by another linter # ENV PATH="${PATH}:/root/.dotnet/tools:/usr/share/dotnet" && dotnet tool install --global TSQLLint - +# #OTHER__END ################################ @@ -470,7 +472,6 @@ LABEL com.github.actions.name="MegaLinter" \ org.opencontainers.image.description="Lint your code base with GitHub Actions" #EXTRA_DOCKERFILE_LINES__START -COPY entrypoint.sh /entrypoint.sh -RUN chmod +x entrypoint.sh +COPY --chmod=755 entrypoint.sh /entrypoint.sh ENTRYPOINT ["/bin/bash", "/entrypoint.sh"] #EXTRA_DOCKERFILE_LINES__END diff --git a/flavors/dotnetweb/Dockerfile b/flavors/dotnetweb/Dockerfile index c0766b0efc2..83a6eb57290 100644 --- a/flavors/dotnetweb/Dockerfile +++ b/flavors/dotnetweb/Dockerfile @@ -21,6 +21,7 @@ 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 dotenvlinter/dotenv-linter:latest as dotenvlinter FROM ghcr.io/yannh/kubeconform:latest-alpine as kubeconform FROM mrtazz/checkmake:latest as checkmake FROM yoheimuta/protolint:latest as protolint @@ -128,19 +129,67 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END #PIPVENV__START -RUN PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir --upgrade pip virtualenv \ - && mkdir -p "/venvs/ansible-lint" && cd "/venvs/ansible-lint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir ansible-lint && deactivate && cd ./../.. \ - && mkdir -p "/venvs/cpplint" && cd "/venvs/cpplint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir cpplint && deactivate && cd ./../.. \ - && mkdir -p "/venvs/djlint" && cd "/venvs/djlint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir djlint && deactivate && cd ./../.. \ - && mkdir -p "/venvs/checkov" && cd "/venvs/checkov" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir packaging checkov && deactivate && cd ./../.. \ - && mkdir -p "/venvs/semgrep" && cd "/venvs/semgrep" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir semgrep && deactivate && cd ./../.. \ - && mkdir -p "/venvs/snakemake" && cd "/venvs/snakemake" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir snakemake && deactivate && cd ./../.. \ - && mkdir -p "/venvs/snakefmt" && cd "/venvs/snakefmt" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir snakefmt && deactivate && cd ./../.. \ - && mkdir -p "/venvs/proselint" && cd "/venvs/proselint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir proselint && deactivate && cd ./../.. \ - && mkdir -p "/venvs/sqlfluff" && cd "/venvs/sqlfluff" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir sqlfluff && deactivate && cd ./../.. \ - && mkdir -p "/venvs/yamllint" && cd "/venvs/yamllint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir yamllint && deactivate && cd ./../.. \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf && rm -rf /root/.cache -ENV PATH="${PATH}":/venvs/ansible-lint/bin:/venvs/cpplint/bin:/venvs/djlint/bin:/venvs/checkov/bin:/venvs/semgrep/bin:/venvs/snakemake/bin:/venvs/snakefmt/bin:/venvs/proselint/bin:/venvs/sqlfluff/bin:/venvs/yamllint/bin +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/ansible-lint" \ + && cd "/venvs/ansible-lint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip ansible-lint +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/cpplint" \ + && cd "/venvs/cpplint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip cpplint +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/djlint" \ + && cd "/venvs/djlint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip djlint +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/checkov" \ + && cd "/venvs/checkov" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip packaging checkov +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/semgrep" \ + && cd "/venvs/semgrep" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip semgrep +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/snakemake" \ + && cd "/venvs/snakemake" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakemake +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/snakefmt" \ + && cd "/venvs/snakefmt" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakefmt +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/proselint" \ + && cd "/venvs/proselint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip proselint +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/sqlfluff" \ + && cd "/venvs/sqlfluff" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip sqlfluff +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/yamllint" \ + && cd "/venvs/yamllint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip yamllint + #PIPVENV__END ############################ @@ -244,11 +293,7 @@ RUN echo 'gem: --no-document' >> ~/.gemrc && \ ############################################################################################# #CARGO__START -RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable \ - && export PATH="/root/.cargo/bin:${PATH}" \ - && cargo install --force --locked sarif-fmt shellcheck-sarif \ - && rm -rf /root/.cargo/registry /root/.cargo/git /root/.cache/sccache /root/.rustup -ENV PATH="/root/.cargo/bin:${PATH}" + #CARGO__END ############################## @@ -258,15 +303,18 @@ ENV PATH="/root/.cargo/bin:${PATH}" ############################################################################################# #COPY__START +COPY --link --from=node_modules /node-deps /node-deps 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 --link --from=build-platform /usr/bin/bash-exec /usr/bin/bash-exec # 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=dotenvlinter /dotenv-linter /usr/bin/dotenv-linter COPY --link --from=kubeconform /kubeconform /usr/bin/ COPY --link --from=checkmake /checkmake /usr/bin/checkmake COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ @@ -297,14 +345,14 @@ RUN --mount=type=secret,id=GITHUB_TOKEN case ${TARGETPLATFORM} in \ | tar -xzC ${PWSH_DIRECTORY} \ && ln -sf ${PWSH_DIRECTORY}/pwsh /usr/bin/pwsh - +# # CSHARP installation RUN wget --tries=5 -q -O dotnet-install.sh https://dot.net/v1/dotnet-install.sh \ && chmod +x dotnet-install.sh \ && ./dotnet-install.sh --install-dir /usr/share/dotnet -channel 6.0 -version latest ENV PATH="${PATH}:/root/.dotnet/tools:/usr/share/dotnet" - +# # POWERSHELL installation RUN --mount=type=secret,id=GITHUB_TOKEN case ${TARGETPLATFORM} in \ "linux/amd64") POWERSHELL_ARCH=alpine-x64 ;; \ @@ -323,7 +371,7 @@ RUN --mount=type=secret,id=GITHUB_TOKEN case ${TARGETPLATFORM} in \ && ln -sf ${PWSH_DIRECTORY}/pwsh /usr/bin/pwsh \ && chmod +x /usr/bin/pwsh - +# # VBDOTNET installation # Next line commented because already managed by another linter # RUN wget --tries=5 -q -O dotnet-install.sh https://dot.net/v1/dotnet-install.sh \ @@ -331,12 +379,7 @@ RUN --mount=type=secret,id=GITHUB_TOKEN case ${TARGETPLATFORM} in \ # && ./dotnet-install.sh --install-dir /usr/share/dotnet -channel 6.0 -version latest # Next line commented because already managed by another linter # ENV PATH="${PATH}:/root/.dotnet/tools:/usr/share/dotnet" - -# actionlint installation -# 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" RUN curl --retry 5 --retry-delay 5 -sLO "${ARM_TTK_URI}" \ @@ -344,18 +387,7 @@ RUN curl --retry 5 --retry-delay 5 -sLO "${ARM_TTK_URI}" \ && rm "${ARM_TTK_NAME}" \ && ln -sTf "${ARM_TTK_PSD1}" /usr/bin/arm-ttk \ && chmod a+x /usr/bin/arm-ttk \ - -# 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 -# 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 --link --from=shfmt /bin/shfmt /usr/bin/ - +# # bicep_linter installation && case ${TARGETPLATFORM} in \ "linux/amd64") POWERSHELL_ARCH=musl-x64 ;; \ @@ -364,66 +396,36 @@ esac \ && curl --retry 5 --retry-delay 5 -sLo ${BICEP_EXE} "https://github.com/Azure/bicep/releases/latest/download/bicep-linux-${POWERSHELL_ARCH}" \ && chmod +x "${BICEP_EXE}" \ && mv "${BICEP_EXE}" "${BICEP_DIR}" \ - +# # csharpier installation && /usr/share/dotnet/dotnet tool install -g csharpier \ - -# hadolint installation -# Managed with COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint - -# editorconfig-checker installation -# 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 \ - +# # ktlint installation && curl --retry 5 --retry-delay 5 -sSLO https://github.com/pinterest/ktlint/releases/latest/download/ktlint && \ chmod a+x ktlint && \ mv "ktlint" /usr/bin/ \ - -# kubeconform installation -# Managed with COPY --link --from=kubeconform /kubeconform /usr/bin/ - +# # kubescape installation && ln -s /lib/libc.so.6 /usr/lib/libresolv.so.2 && \ curl --retry 5 --retry-delay 5 -sLv https://raw.githubusercontent.com/kubescape/kubescape/master/install.sh | /bin/bash -s -- -v v2.3.6 \ - -# checkmake installation -# Managed with COPY --link --from=checkmake /checkmake /usr/bin/checkmake - +# # powershell installation && pwsh -c 'Install-Module -Name PSScriptAnalyzer -RequiredVersion ${PSSA_VERSION} -Scope AllUsers -Force' \ - +# # powershell_formatter installation # Next line commented because already managed by another linter # RUN pwsh -c 'Install-Module -Name PSScriptAnalyzer -RequiredVersion ${PSSA_VERSION} -Scope AllUsers -Force' - -# protolint installation -# Managed with COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ - -# gitleaks installation -# Managed with COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ - +# # grype installation && curl -sSfL https://raw.githubusercontent.com/anchore/grype/main/install.sh | sh -s -- -b /usr/local/bin v0.63.1 \ - +# # trivy installation && wget --tries=5 -q -O - https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin \ - +# # trivy-sbom installation # Next line commented because already managed by another linter # RUN wget --tries=5 -q -O - https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin - -# trufflehog installation -# Managed with COPY --link --from=trufflehog /usr/bin/trufflehog /usr/bin/ - -# vale installation -# Managed with COPY --link --from=vale /bin/vale /bin/vale - -# lychee installation -# Managed with COPY --link --from=lychee /usr/local/bin/lychee /usr/bin/ - +# # tsqllint installation # Next line commented because already managed by another linter # RUN wget --tries=5 -q -O dotnet-install.sh https://dot.net/v1/dotnet-install.sh \ @@ -432,7 +434,7 @@ esac \ # Next line commented because already managed by another linter # ENV PATH="${PATH}:/root/.dotnet/tools:/usr/share/dotnet" && dotnet tool install --global TSQLLint - +# #OTHER__END ################################ @@ -490,7 +492,6 @@ LABEL com.github.actions.name="MegaLinter" \ org.opencontainers.image.description="Lint your code base with GitHub Actions" #EXTRA_DOCKERFILE_LINES__START -COPY entrypoint.sh /entrypoint.sh -RUN chmod +x entrypoint.sh +COPY --chmod=755 entrypoint.sh /entrypoint.sh ENTRYPOINT ["/bin/bash", "/entrypoint.sh"] #EXTRA_DOCKERFILE_LINES__END diff --git a/flavors/go/Dockerfile b/flavors/go/Dockerfile index 68d5fd2e39d..4daca4d53ef 100644 --- a/flavors/go/Dockerfile +++ b/flavors/go/Dockerfile @@ -21,6 +21,7 @@ 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 dotenvlinter/dotenv-linter:latest as dotenvlinter FROM golang:1-alpine as revive ## The golang image used as a builder is a temporary workaround ## for the released revive binaries not returning version numbers (devel). @@ -120,18 +121,61 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END #PIPVENV__START -RUN PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir --upgrade pip virtualenv \ - && mkdir -p "/venvs/ansible-lint" && cd "/venvs/ansible-lint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir ansible-lint && deactivate && cd ./../.. \ - && mkdir -p "/venvs/djlint" && cd "/venvs/djlint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir djlint && deactivate && cd ./../.. \ - && mkdir -p "/venvs/checkov" && cd "/venvs/checkov" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir packaging checkov && deactivate && cd ./../.. \ - && mkdir -p "/venvs/semgrep" && cd "/venvs/semgrep" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir semgrep && deactivate && cd ./../.. \ - && mkdir -p "/venvs/snakemake" && cd "/venvs/snakemake" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir snakemake && deactivate && cd ./../.. \ - && mkdir -p "/venvs/snakefmt" && cd "/venvs/snakefmt" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir snakefmt && deactivate && cd ./../.. \ - && mkdir -p "/venvs/proselint" && cd "/venvs/proselint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir proselint && deactivate && cd ./../.. \ - && mkdir -p "/venvs/sqlfluff" && cd "/venvs/sqlfluff" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir sqlfluff && deactivate && cd ./../.. \ - && mkdir -p "/venvs/yamllint" && cd "/venvs/yamllint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir yamllint && deactivate && cd ./../.. \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf && rm -rf /root/.cache -ENV PATH="${PATH}":/venvs/ansible-lint/bin:/venvs/djlint/bin:/venvs/checkov/bin:/venvs/semgrep/bin:/venvs/snakemake/bin:/venvs/snakefmt/bin:/venvs/proselint/bin:/venvs/sqlfluff/bin:/venvs/yamllint/bin +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/ansible-lint" \ + && cd "/venvs/ansible-lint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip ansible-lint +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/djlint" \ + && cd "/venvs/djlint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip djlint +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/checkov" \ + && cd "/venvs/checkov" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip packaging checkov +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/semgrep" \ + && cd "/venvs/semgrep" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip semgrep +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/snakemake" \ + && cd "/venvs/snakemake" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakemake +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/snakefmt" \ + && cd "/venvs/snakefmt" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakefmt +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/proselint" \ + && cd "/venvs/proselint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip proselint +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/sqlfluff" \ + && cd "/venvs/sqlfluff" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip sqlfluff +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/yamllint" \ + && cd "/venvs/yamllint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip yamllint + #PIPVENV__END ############################ @@ -212,11 +256,7 @@ RUN echo 'gem: --no-document' >> ~/.gemrc && \ ############################################################################################# #CARGO__START -RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable \ - && export PATH="/root/.cargo/bin:${PATH}" \ - && cargo install --force --locked sarif-fmt shellcheck-sarif \ - && rm -rf /root/.cargo/registry /root/.cargo/git /root/.cache/sccache /root/.rustup -ENV PATH="/root/.cargo/bin:${PATH}" + #CARGO__END ############################## @@ -230,11 +270,14 @@ 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 --link --from=build-platform /usr/bin/bash-exec /usr/bin/bash-exec # 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=node_modules /node-deps /node-deps COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker +COPY --link --from=dotenvlinter /dotenv-linter /usr/bin/dotenv-linter COPY --link --from=revive /usr/bin/revive /usr/bin/revive COPY --link --from=kubeconform /kubeconform /usr/bin/ COPY --link --from=checkmake /checkmake /usr/bin/checkmake @@ -249,79 +292,30 @@ COPY --link --from=lychee /usr/local/bin/lychee /usr/bin/ ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #OTHER__START -# actionlint installation -# 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 -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 -# 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 --link --from=shfmt /bin/shfmt /usr/bin/ - -# hadolint installation -# Managed with COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint - -# editorconfig-checker installation -# 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 \ +RUN wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh \ && golangci-lint --version \ - -# revive installation -# 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 && \ chmod a+x ktlint && \ mv "ktlint" /usr/bin/ \ - -# kubeconform installation -# Managed with COPY --link --from=kubeconform /kubeconform /usr/bin/ - +# # kubescape installation && ln -s /lib/libc.so.6 /usr/lib/libresolv.so.2 && \ curl --retry 5 --retry-delay 5 -sLv https://raw.githubusercontent.com/kubescape/kubescape/master/install.sh | /bin/bash -s -- -v v2.3.6 \ - -# checkmake installation -# Managed with COPY --link --from=checkmake /checkmake /usr/bin/checkmake - -# protolint installation -# Managed with COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ - -# gitleaks installation -# Managed with COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ - +# # grype installation && curl -sSfL https://raw.githubusercontent.com/anchore/grype/main/install.sh | sh -s -- -b /usr/local/bin v0.63.1 \ - +# # trivy installation && wget --tries=5 -q -O - https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin - +# # trivy-sbom installation # Next line commented because already managed by another linter # RUN wget --tries=5 -q -O - https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin - -# trufflehog installation -# Managed with COPY --link --from=trufflehog /usr/bin/trufflehog /usr/bin/ - -# vale installation -# Managed with COPY --link --from=vale /bin/vale /bin/vale - -# lychee installation -# Managed with COPY --link --from=lychee /usr/local/bin/lychee /usr/bin/ - +# #OTHER__END ################################ @@ -379,7 +373,6 @@ LABEL com.github.actions.name="MegaLinter" \ org.opencontainers.image.description="Lint your code base with GitHub Actions" #EXTRA_DOCKERFILE_LINES__START -COPY entrypoint.sh /entrypoint.sh -RUN chmod +x entrypoint.sh +COPY --chmod=755 entrypoint.sh /entrypoint.sh ENTRYPOINT ["/bin/bash", "/entrypoint.sh"] #EXTRA_DOCKERFILE_LINES__END diff --git a/flavors/java/Dockerfile b/flavors/java/Dockerfile index 8941fa8918b..1a3ab88d6f7 100644 --- a/flavors/java/Dockerfile +++ b/flavors/java/Dockerfile @@ -21,6 +21,7 @@ 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 dotenvlinter/dotenv-linter:latest as dotenvlinter FROM ghcr.io/yannh/kubeconform:latest-alpine as kubeconform FROM mrtazz/checkmake:latest as checkmake FROM yoheimuta/protolint:latest as protolint @@ -113,18 +114,61 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END #PIPVENV__START -RUN PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir --upgrade pip virtualenv \ - && mkdir -p "/venvs/ansible-lint" && cd "/venvs/ansible-lint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir ansible-lint && deactivate && cd ./../.. \ - && mkdir -p "/venvs/djlint" && cd "/venvs/djlint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir djlint && deactivate && cd ./../.. \ - && mkdir -p "/venvs/checkov" && cd "/venvs/checkov" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir packaging checkov && deactivate && cd ./../.. \ - && mkdir -p "/venvs/semgrep" && cd "/venvs/semgrep" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir semgrep && deactivate && cd ./../.. \ - && mkdir -p "/venvs/snakemake" && cd "/venvs/snakemake" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir snakemake && deactivate && cd ./../.. \ - && mkdir -p "/venvs/snakefmt" && cd "/venvs/snakefmt" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir snakefmt && deactivate && cd ./../.. \ - && mkdir -p "/venvs/proselint" && cd "/venvs/proselint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir proselint && deactivate && cd ./../.. \ - && mkdir -p "/venvs/sqlfluff" && cd "/venvs/sqlfluff" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir sqlfluff && deactivate && cd ./../.. \ - && mkdir -p "/venvs/yamllint" && cd "/venvs/yamllint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir yamllint && deactivate && cd ./../.. \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf && rm -rf /root/.cache -ENV PATH="${PATH}":/venvs/ansible-lint/bin:/venvs/djlint/bin:/venvs/checkov/bin:/venvs/semgrep/bin:/venvs/snakemake/bin:/venvs/snakefmt/bin:/venvs/proselint/bin:/venvs/sqlfluff/bin:/venvs/yamllint/bin +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/ansible-lint" \ + && cd "/venvs/ansible-lint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip ansible-lint +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/djlint" \ + && cd "/venvs/djlint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip djlint +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/checkov" \ + && cd "/venvs/checkov" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip packaging checkov +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/semgrep" \ + && cd "/venvs/semgrep" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip semgrep +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/snakemake" \ + && cd "/venvs/snakemake" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakemake +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/snakefmt" \ + && cd "/venvs/snakefmt" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakefmt +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/proselint" \ + && cd "/venvs/proselint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip proselint +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/sqlfluff" \ + && cd "/venvs/sqlfluff" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip sqlfluff +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/yamllint" \ + && cd "/venvs/yamllint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip yamllint + #PIPVENV__END ############################ @@ -205,11 +249,7 @@ RUN echo 'gem: --no-document' >> ~/.gemrc && \ ############################################################################################# #CARGO__START -RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable \ - && export PATH="/root/.cargo/bin:${PATH}" \ - && cargo install --force --locked sarif-fmt shellcheck-sarif \ - && rm -rf /root/.cargo/registry /root/.cargo/git /root/.cache/sccache /root/.rustup -ENV PATH="/root/.cargo/bin:${PATH}" + #CARGO__END ############################## @@ -223,11 +263,14 @@ 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 --link --from=build-platform /usr/bin/bash-exec /usr/bin/bash-exec # 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=node_modules /node-deps /node-deps COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker +COPY --link --from=dotenvlinter /dotenv-linter /usr/bin/dotenv-linter COPY --link --from=kubeconform /kubeconform /usr/bin/ COPY --link --from=checkmake /checkmake /usr/bin/checkmake COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ @@ -283,46 +326,22 @@ RUN ALPINE_GLIBC_BASE_URL="https://github.com/sgerrand/alpine-pkg-glibc/releases "$ALPINE_GLIBC_BIN_PACKAGE_FILENAME" \ "$ALPINE_GLIBC_I18N_PACKAGE_FILENAME" - +# # JAVA installation ENV JAVA_HOME=/usr/lib/jvm/java-11-openjdk ENV PATH="$JAVA_HOME/bin:${PATH}" - -# actionlint installation -# 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 -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 -# 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 --link --from=shfmt /bin/shfmt /usr/bin/ - +# # clj-kondo installation - && curl --retry 5 --retry-delay 5 -sLO https://raw.githubusercontent.com/clj-kondo/clj-kondo/master/script/install-clj-kondo \ +RUN curl --retry 5 --retry-delay 5 -sLO https://raw.githubusercontent.com/clj-kondo/clj-kondo/master/script/install-clj-kondo \ && chmod +x install-clj-kondo \ && ./install-clj-kondo \ - +# # cljstyle installation && curl --retry 5 --retry-delay 5 -sLO https://raw.githubusercontent.com/greglook/cljstyle/main/script/install-cljstyle \ && chmod +x install-cljstyle \ - && ./install-cljstyle \ - -# hadolint installation -# Managed with COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint - -# editorconfig-checker installation -# 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 + && ./install-cljstyle +# # checkstyle installation RUN --mount=type=secret,id=GITHUB_TOKEN CHECKSTYLE_LATEST=$(curl -s \ -H "Accept: application/vnd.github+json" \ @@ -334,55 +353,34 @@ RUN --mount=type=secret,id=GITHUB_TOKEN CHECKSTYLE_LATEST=$(curl -s \ && curl --retry 5 --retry-delay 5 -sSL $CHECKSTYLE_LATEST \ --output /usr/bin/checkstyle - +# # pmd installation RUN wget --quiet https://github.com/pmd/pmd/releases/download/pmd_releases%2F${PMD_VERSION}/pmd-bin-${PMD_VERSION}.zip && \ unzip pmd-bin-${PMD_VERSION}.zip && \ rm pmd-bin-${PMD_VERSION}.zip && \ mv pmd-bin-${PMD_VERSION} /usr/bin/pmd && \ chmod +x /usr/bin/pmd/bin/run.sh \ - +# # ktlint installation && curl --retry 5 --retry-delay 5 -sSLO https://github.com/pinterest/ktlint/releases/latest/download/ktlint && \ chmod a+x ktlint && \ mv "ktlint" /usr/bin/ \ - -# kubeconform installation -# Managed with COPY --link --from=kubeconform /kubeconform /usr/bin/ - +# # kubescape installation && ln -s /lib/libc.so.6 /usr/lib/libresolv.so.2 && \ curl --retry 5 --retry-delay 5 -sLv https://raw.githubusercontent.com/kubescape/kubescape/master/install.sh | /bin/bash -s -- -v v2.3.6 \ - -# checkmake installation -# Managed with COPY --link --from=checkmake /checkmake /usr/bin/checkmake - -# protolint installation -# Managed with COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ - -# gitleaks installation -# Managed with COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ - +# # grype installation && curl -sSfL https://raw.githubusercontent.com/anchore/grype/main/install.sh | sh -s -- -b /usr/local/bin v0.63.1 \ - +# # trivy installation && wget --tries=5 -q -O - https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin - +# # trivy-sbom installation # Next line commented because already managed by another linter # RUN wget --tries=5 -q -O - https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin - -# trufflehog installation -# Managed with COPY --link --from=trufflehog /usr/bin/trufflehog /usr/bin/ - -# vale installation -# Managed with COPY --link --from=vale /bin/vale /bin/vale - -# lychee installation -# Managed with COPY --link --from=lychee /usr/local/bin/lychee /usr/bin/ - +# #OTHER__END ################################ @@ -440,7 +438,6 @@ LABEL com.github.actions.name="MegaLinter" \ org.opencontainers.image.description="Lint your code base with GitHub Actions" #EXTRA_DOCKERFILE_LINES__START -COPY entrypoint.sh /entrypoint.sh -RUN chmod +x entrypoint.sh +COPY --chmod=755 entrypoint.sh /entrypoint.sh ENTRYPOINT ["/bin/bash", "/entrypoint.sh"] #EXTRA_DOCKERFILE_LINES__END diff --git a/flavors/javascript/Dockerfile b/flavors/javascript/Dockerfile index d2113d52d7a..0095b48025d 100644 --- a/flavors/javascript/Dockerfile +++ b/flavors/javascript/Dockerfile @@ -21,6 +21,7 @@ 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 dotenvlinter/dotenv-linter:latest as dotenvlinter FROM ghcr.io/yannh/kubeconform:latest-alpine as kubeconform FROM yoheimuta/protolint:latest as protolint FROM zricethezav/gitleaks:v8.17.0 as gitleaks @@ -112,18 +113,61 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END #PIPVENV__START -RUN PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir --upgrade pip virtualenv \ - && mkdir -p "/venvs/ansible-lint" && cd "/venvs/ansible-lint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir ansible-lint && deactivate && cd ./../.. \ - && mkdir -p "/venvs/djlint" && cd "/venvs/djlint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir djlint && deactivate && cd ./../.. \ - && mkdir -p "/venvs/checkov" && cd "/venvs/checkov" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir packaging checkov && deactivate && cd ./../.. \ - && mkdir -p "/venvs/semgrep" && cd "/venvs/semgrep" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir semgrep && deactivate && cd ./../.. \ - && mkdir -p "/venvs/snakemake" && cd "/venvs/snakemake" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir snakemake && deactivate && cd ./../.. \ - && mkdir -p "/venvs/snakefmt" && cd "/venvs/snakefmt" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir snakefmt && deactivate && cd ./../.. \ - && mkdir -p "/venvs/proselint" && cd "/venvs/proselint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir proselint && deactivate && cd ./../.. \ - && mkdir -p "/venvs/sqlfluff" && cd "/venvs/sqlfluff" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir sqlfluff && deactivate && cd ./../.. \ - && mkdir -p "/venvs/yamllint" && cd "/venvs/yamllint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir yamllint && deactivate && cd ./../.. \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf && rm -rf /root/.cache -ENV PATH="${PATH}":/venvs/ansible-lint/bin:/venvs/djlint/bin:/venvs/checkov/bin:/venvs/semgrep/bin:/venvs/snakemake/bin:/venvs/snakefmt/bin:/venvs/proselint/bin:/venvs/sqlfluff/bin:/venvs/yamllint/bin +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/ansible-lint" \ + && cd "/venvs/ansible-lint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip ansible-lint +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/djlint" \ + && cd "/venvs/djlint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip djlint +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/checkov" \ + && cd "/venvs/checkov" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip packaging checkov +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/semgrep" \ + && cd "/venvs/semgrep" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip semgrep +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/snakemake" \ + && cd "/venvs/snakemake" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakemake +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/snakefmt" \ + && cd "/venvs/snakefmt" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakefmt +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/proselint" \ + && cd "/venvs/proselint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip proselint +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/sqlfluff" \ + && cd "/venvs/sqlfluff" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip sqlfluff +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/yamllint" \ + && cd "/venvs/yamllint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip yamllint + #PIPVENV__END ############################ @@ -226,11 +270,7 @@ RUN echo 'gem: --no-document' >> ~/.gemrc && \ ############################################################################################# #CARGO__START -RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable \ - && export PATH="/root/.cargo/bin:${PATH}" \ - && cargo install --force --locked sarif-fmt shellcheck-sarif \ - && rm -rf /root/.cargo/registry /root/.cargo/git /root/.cache/sccache /root/.rustup -ENV PATH="/root/.cargo/bin:${PATH}" + #CARGO__END ############################## @@ -240,15 +280,18 @@ ENV PATH="/root/.cargo/bin:${PATH}" ############################################################################################# #COPY__START +COPY --link --from=node_modules /node-deps /node-deps 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 --link --from=build-platform /usr/bin/bash-exec /usr/bin/bash-exec # 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=dotenvlinter /dotenv-linter /usr/bin/dotenv-linter COPY --link --from=kubeconform /kubeconform /usr/bin/ COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ @@ -261,69 +304,26 @@ COPY --link --from=lychee /usr/local/bin/lychee /usr/bin/ ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #OTHER__START -# actionlint installation -# 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 -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 -# 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 --link --from=shfmt /bin/shfmt /usr/bin/ - -# hadolint installation -# Managed with COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint - -# editorconfig-checker installation -# 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 \ - # ktlint installation - && curl --retry 5 --retry-delay 5 -sSLO https://github.com/pinterest/ktlint/releases/latest/download/ktlint && \ +RUN curl --retry 5 --retry-delay 5 -sSLO https://github.com/pinterest/ktlint/releases/latest/download/ktlint && \ chmod a+x ktlint && \ mv "ktlint" /usr/bin/ \ - -# kubeconform installation -# Managed with COPY --link --from=kubeconform /kubeconform /usr/bin/ - +# # kubescape installation && ln -s /lib/libc.so.6 /usr/lib/libresolv.so.2 && \ curl --retry 5 --retry-delay 5 -sLv https://raw.githubusercontent.com/kubescape/kubescape/master/install.sh | /bin/bash -s -- -v v2.3.6 \ - -# protolint installation -# Managed with COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ - -# gitleaks installation -# Managed with COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ - +# # grype installation && curl -sSfL https://raw.githubusercontent.com/anchore/grype/main/install.sh | sh -s -- -b /usr/local/bin v0.63.1 \ - +# # trivy installation && wget --tries=5 -q -O - https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin - +# # trivy-sbom installation # Next line commented because already managed by another linter # RUN wget --tries=5 -q -O - https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin - -# trufflehog installation -# Managed with COPY --link --from=trufflehog /usr/bin/trufflehog /usr/bin/ - -# vale installation -# Managed with COPY --link --from=vale /bin/vale /bin/vale - -# lychee installation -# Managed with COPY --link --from=lychee /usr/local/bin/lychee /usr/bin/ - +# #OTHER__END ################################ @@ -381,7 +381,6 @@ LABEL com.github.actions.name="MegaLinter" \ org.opencontainers.image.description="Lint your code base with GitHub Actions" #EXTRA_DOCKERFILE_LINES__START -COPY entrypoint.sh /entrypoint.sh -RUN chmod +x entrypoint.sh +COPY --chmod=755 entrypoint.sh /entrypoint.sh ENTRYPOINT ["/bin/bash", "/entrypoint.sh"] #EXTRA_DOCKERFILE_LINES__END diff --git a/flavors/php/Dockerfile b/flavors/php/Dockerfile index 07a21c69d6b..95a97860c9c 100644 --- a/flavors/php/Dockerfile +++ b/flavors/php/Dockerfile @@ -21,6 +21,7 @@ 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 dotenvlinter/dotenv-linter:latest as dotenvlinter FROM ghcr.io/yannh/kubeconform:latest-alpine as kubeconform FROM ghcr.io/phpstan/phpstan:latest-php8.1 as phpstan FROM yoheimuta/protolint:latest as protolint @@ -124,18 +125,61 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END #PIPVENV__START -RUN PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir --upgrade pip virtualenv \ - && mkdir -p "/venvs/ansible-lint" && cd "/venvs/ansible-lint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir ansible-lint && deactivate && cd ./../.. \ - && mkdir -p "/venvs/djlint" && cd "/venvs/djlint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir djlint && deactivate && cd ./../.. \ - && mkdir -p "/venvs/checkov" && cd "/venvs/checkov" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir packaging checkov && deactivate && cd ./../.. \ - && mkdir -p "/venvs/semgrep" && cd "/venvs/semgrep" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir semgrep && deactivate && cd ./../.. \ - && mkdir -p "/venvs/snakemake" && cd "/venvs/snakemake" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir snakemake && deactivate && cd ./../.. \ - && mkdir -p "/venvs/snakefmt" && cd "/venvs/snakefmt" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir snakefmt && deactivate && cd ./../.. \ - && mkdir -p "/venvs/proselint" && cd "/venvs/proselint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir proselint && deactivate && cd ./../.. \ - && mkdir -p "/venvs/sqlfluff" && cd "/venvs/sqlfluff" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir sqlfluff && deactivate && cd ./../.. \ - && mkdir -p "/venvs/yamllint" && cd "/venvs/yamllint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir yamllint && deactivate && cd ./../.. \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf && rm -rf /root/.cache -ENV PATH="${PATH}":/venvs/ansible-lint/bin:/venvs/djlint/bin:/venvs/checkov/bin:/venvs/semgrep/bin:/venvs/snakemake/bin:/venvs/snakefmt/bin:/venvs/proselint/bin:/venvs/sqlfluff/bin:/venvs/yamllint/bin +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/ansible-lint" \ + && cd "/venvs/ansible-lint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip ansible-lint +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/djlint" \ + && cd "/venvs/djlint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip djlint +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/checkov" \ + && cd "/venvs/checkov" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip packaging checkov +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/semgrep" \ + && cd "/venvs/semgrep" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip semgrep +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/snakemake" \ + && cd "/venvs/snakemake" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakemake +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/snakefmt" \ + && cd "/venvs/snakefmt" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakefmt +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/proselint" \ + && cd "/venvs/proselint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip proselint +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/sqlfluff" \ + && cd "/venvs/sqlfluff" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip sqlfluff +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/yamllint" \ + && cd "/venvs/yamllint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip yamllint + #PIPVENV__END ############################ @@ -216,11 +260,7 @@ RUN echo 'gem: --no-document' >> ~/.gemrc && \ ############################################################################################# #CARGO__START -RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable \ - && export PATH="/root/.cargo/bin:${PATH}" \ - && cargo install --force --locked sarif-fmt shellcheck-sarif \ - && rm -rf /root/.cargo/registry /root/.cargo/git /root/.cache/sccache /root/.rustup -ENV PATH="/root/.cargo/bin:${PATH}" + #CARGO__END ############################## @@ -234,13 +274,16 @@ 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 --link --from=build-platform /usr/bin/bash-exec /usr/bin/bash-exec # 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=node_modules /node-deps /node-deps COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker +COPY --link --from=dotenvlinter /dotenv-linter /usr/bin/dotenv-linter COPY --link --from=kubeconform /kubeconform /usr/bin/ -COPY --link --from=phpstan /composer/vendor/phpstan/phpstan/phpstan.phar /usr/bin/phpstan +COPY --link --chmod=755 --from=phpstan /composer/vendor/phpstan/phpstan/phpstan.phar /usr/bin/phpstan COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ COPY --link --from=trufflehog /usr/bin/trufflehog /usr/bin/ @@ -268,87 +311,40 @@ RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GI && rm phive.phar.asc \ && update-alternatives --install /usr/bin/php php /usr/bin/php81 110 - -# actionlint installation -# 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 -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 -# 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 --link --from=shfmt /bin/shfmt /usr/bin/ - -# hadolint installation -# Managed with COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint - -# editorconfig-checker installation -# 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 \ - +# # ktlint installation - && curl --retry 5 --retry-delay 5 -sSLO https://github.com/pinterest/ktlint/releases/latest/download/ktlint && \ +RUN curl --retry 5 --retry-delay 5 -sSLO https://github.com/pinterest/ktlint/releases/latest/download/ktlint && \ chmod a+x ktlint && \ mv "ktlint" /usr/bin/ \ - -# kubeconform installation -# Managed with COPY --link --from=kubeconform /kubeconform /usr/bin/ - +# # kubescape installation && ln -s /lib/libc.so.6 /usr/lib/libresolv.so.2 && \ curl --retry 5 --retry-delay 5 -sLv https://raw.githubusercontent.com/kubescape/kubescape/master/install.sh | /bin/bash -s -- -v v2.3.6 - +# # 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 - -# phpstan installation -# Managed with COPY --link --from=phpstan /composer/vendor/phpstan/phpstan/phpstan.phar /usr/bin/phpstan -RUN chmod +x /usr/bin/phpstan - +# # psalm installation RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GITHUB_TOKEN)" && export GITHUB_AUTH_TOKEN && phive --no-progress install psalm -g --trust-gpg-keys 8A03EA3B385DBAA1,12CE0F1D262429A5 - +# # phplint installation RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GITHUB_TOKEN)" && export GITHUB_AUTH_TOKEN && phive --no-progress install overtrue/phplint --force-accept-unsigned -g - -# protolint installation -# Managed with COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ - -# gitleaks installation -# Managed with COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ - +# # grype installation RUN curl -sSfL https://raw.githubusercontent.com/anchore/grype/main/install.sh | sh -s -- -b /usr/local/bin v0.63.1 \ - +# # trivy installation && wget --tries=5 -q -O - https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin - +# # trivy-sbom installation # Next line commented because already managed by another linter # RUN wget --tries=5 -q -O - https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin - -# trufflehog installation -# Managed with COPY --link --from=trufflehog /usr/bin/trufflehog /usr/bin/ - -# vale installation -# Managed with COPY --link --from=vale /bin/vale /bin/vale - -# lychee installation -# Managed with COPY --link --from=lychee /usr/local/bin/lychee /usr/bin/ - +# #OTHER__END ################################ @@ -406,7 +402,6 @@ LABEL com.github.actions.name="MegaLinter" \ org.opencontainers.image.description="Lint your code base with GitHub Actions" #EXTRA_DOCKERFILE_LINES__START -COPY entrypoint.sh /entrypoint.sh -RUN chmod +x entrypoint.sh +COPY --chmod=755 entrypoint.sh /entrypoint.sh ENTRYPOINT ["/bin/bash", "/entrypoint.sh"] #EXTRA_DOCKERFILE_LINES__END diff --git a/flavors/python/Dockerfile b/flavors/python/Dockerfile index f11d26ccbcd..65137d94083 100644 --- a/flavors/python/Dockerfile +++ b/flavors/python/Dockerfile @@ -21,9 +21,19 @@ 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 dotenvlinter/dotenv-linter:latest as dotenvlinter FROM ghcr.io/yannh/kubeconform:latest-alpine as kubeconform FROM mrtazz/checkmake:latest as checkmake FROM yoheimuta/protolint:latest as protolint +FROM --platform=$BUILDPLATFORM alpine:3 AS fetch-ruff +ARG BUILDARCH +RUN --mount=type=cache,target=/var/cache/apk,id=apk-${BUILDARCH},sharing=locked \ + apk add --update curl +WORKDIR / +ARG TARGETARCH +RUN export DL_LOCATION="https://github.com/charliermarsh/ruff/releases/latest/download/ruff-$([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64" || echo "aarch64")-unknown-linux-musl.tar.gz" \ + && echo "Downloading from ${DL_LOCATION}" \ + && curl --location "${DL_LOCATION}" | tar -xzv FROM zricethezav/gitleaks:v8.17.0 as gitleaks FROM trufflesecurity/trufflehog:latest as trufflehog FROM jdkato/vale:latest as vale @@ -113,29 +123,121 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END #PIPVENV__START -RUN PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir --upgrade pip virtualenv \ - && mkdir -p "/venvs/ansible-lint" && cd "/venvs/ansible-lint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir ansible-lint && deactivate && cd ./../.. \ - && mkdir -p "/venvs/djlint" && cd "/venvs/djlint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir djlint && deactivate && cd ./../.. \ - && mkdir -p "/venvs/pylint" && cd "/venvs/pylint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir pylint typing-extensions && deactivate && cd ./../.. \ - && mkdir -p "/venvs/black" && cd "/venvs/black" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir black && deactivate && cd ./../.. \ - && mkdir -p "/venvs/flake8" && cd "/venvs/flake8" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir flake8 && deactivate && cd ./../.. \ - && mkdir -p "/venvs/isort" && cd "/venvs/isort" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir isort black && deactivate && cd ./../.. \ - && mkdir -p "/venvs/bandit" && cd "/venvs/bandit" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir bandit bandit_sarif_formatter bandit[toml] && deactivate && cd ./../.. \ - && mkdir -p "/venvs/mypy" && cd "/venvs/mypy" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir mypy && deactivate && cd ./../.. \ - && mkdir -p "/venvs/pyright" && cd "/venvs/pyright" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir pyright && deactivate && cd ./../.. \ - && mkdir -p "/venvs/ruff" && cd "/venvs/ruff" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir ruff && deactivate && cd ./../.. \ - && mkdir -p "/venvs/checkov" && cd "/venvs/checkov" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir packaging checkov && deactivate && cd ./../.. \ - && mkdir -p "/venvs/semgrep" && cd "/venvs/semgrep" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir semgrep && deactivate && cd ./../.. \ - && mkdir -p "/venvs/rst-lint" && cd "/venvs/rst-lint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir restructuredtext_lint && deactivate && cd ./../.. \ - && mkdir -p "/venvs/rstcheck" && cd "/venvs/rstcheck" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir rstcheck && deactivate && cd ./../.. \ - && mkdir -p "/venvs/rstfmt" && cd "/venvs/rstfmt" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir rstfmt && deactivate && cd ./../.. \ - && mkdir -p "/venvs/snakemake" && cd "/venvs/snakemake" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir snakemake && deactivate && cd ./../.. \ - && mkdir -p "/venvs/snakefmt" && cd "/venvs/snakefmt" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir snakefmt && deactivate && cd ./../.. \ - && mkdir -p "/venvs/proselint" && cd "/venvs/proselint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir proselint && deactivate && cd ./../.. \ - && mkdir -p "/venvs/sqlfluff" && cd "/venvs/sqlfluff" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir sqlfluff && deactivate && cd ./../.. \ - && mkdir -p "/venvs/yamllint" && cd "/venvs/yamllint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir yamllint && deactivate && cd ./../.. \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf && rm -rf /root/.cache -ENV PATH="${PATH}":/venvs/ansible-lint/bin:/venvs/djlint/bin:/venvs/pylint/bin:/venvs/black/bin:/venvs/flake8/bin:/venvs/isort/bin:/venvs/bandit/bin:/venvs/mypy/bin:/venvs/pyright/bin:/venvs/ruff/bin:/venvs/checkov/bin:/venvs/semgrep/bin:/venvs/rst-lint/bin:/venvs/rstcheck/bin:/venvs/rstfmt/bin:/venvs/snakemake/bin:/venvs/snakefmt/bin:/venvs/proselint/bin:/venvs/sqlfluff/bin:/venvs/yamllint/bin +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/ansible-lint" \ + && cd "/venvs/ansible-lint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip ansible-lint +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/djlint" \ + && cd "/venvs/djlint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip djlint +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/pylint" \ + && cd "/venvs/pylint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip pylint typing-extensions +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/black" \ + && cd "/venvs/black" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip black +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/flake8" \ + && cd "/venvs/flake8" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip flake8 +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/isort" \ + && cd "/venvs/isort" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip isort black +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/bandit" \ + && cd "/venvs/bandit" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip bandit bandit_sarif_formatter bandit[toml] +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/mypy" \ + && cd "/venvs/mypy" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip mypy +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/pyright" \ + && cd "/venvs/pyright" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip pyright +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/checkov" \ + && cd "/venvs/checkov" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip packaging checkov +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/semgrep" \ + && cd "/venvs/semgrep" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip semgrep +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/rst-lint" \ + && cd "/venvs/rst-lint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip restructuredtext_lint +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/rstcheck" \ + && cd "/venvs/rstcheck" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip rstcheck +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/rstfmt" \ + && cd "/venvs/rstfmt" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip rstfmt +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/snakemake" \ + && cd "/venvs/snakemake" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakemake +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/snakefmt" \ + && cd "/venvs/snakefmt" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakefmt +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/proselint" \ + && cd "/venvs/proselint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip proselint +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/sqlfluff" \ + && cd "/venvs/sqlfluff" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip sqlfluff +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/yamllint" \ + && cd "/venvs/yamllint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip yamllint + #PIPVENV__END ############################ @@ -216,11 +318,7 @@ RUN echo 'gem: --no-document' >> ~/.gemrc && \ ############################################################################################# #CARGO__START -RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable \ - && export PATH="/root/.cargo/bin:${PATH}" \ - && cargo install --force --locked sarif-fmt shellcheck-sarif \ - && rm -rf /root/.cargo/registry /root/.cargo/git /root/.cache/sccache /root/.rustup -ENV PATH="/root/.cargo/bin:${PATH}" + #CARGO__END ############################## @@ -234,14 +332,18 @@ 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 --link --from=build-platform /usr/bin/bash-exec /usr/bin/bash-exec # 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=node_modules /node-deps /node-deps COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker +COPY --link --from=dotenvlinter /dotenv-linter /usr/bin/dotenv-linter COPY --link --from=kubeconform /kubeconform /usr/bin/ COPY --link --from=checkmake /checkmake /usr/bin/checkmake COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ +COPY --link --from=fetch-ruff /ruff /usr/bin/ruff COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ COPY --link --from=trufflehog /usr/bin/trufflehog /usr/bin/ COPY --link --from=vale /bin/vale /bin/vale @@ -252,76 +354,30 @@ COPY --link --from=lychee /usr/local/bin/lychee /usr/bin/ ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #OTHER__START -# actionlint installation -# 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 -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 -# 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 --link --from=shfmt /bin/shfmt /usr/bin/ - -# hadolint installation -# Managed with COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint - -# editorconfig-checker installation -# 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 \ - # ktlint installation - && curl --retry 5 --retry-delay 5 -sSLO https://github.com/pinterest/ktlint/releases/latest/download/ktlint && \ +RUN curl --retry 5 --retry-delay 5 -sSLO https://github.com/pinterest/ktlint/releases/latest/download/ktlint && \ chmod a+x ktlint && \ mv "ktlint" /usr/bin/ \ - -# kubeconform installation -# Managed with COPY --link --from=kubeconform /kubeconform /usr/bin/ - +# # kubescape installation && ln -s /lib/libc.so.6 /usr/lib/libresolv.so.2 && \ curl --retry 5 --retry-delay 5 -sLv https://raw.githubusercontent.com/kubescape/kubescape/master/install.sh | /bin/bash -s -- -v v2.3.6 - -# checkmake installation -# Managed with COPY --link --from=checkmake /checkmake /usr/bin/checkmake - -# protolint installation -# Managed with COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ - +# # mypy installation ENV MYPY_CACHE_DIR=/tmp - -# gitleaks installation -# Managed with COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ - +# # grype installation RUN curl -sSfL https://raw.githubusercontent.com/anchore/grype/main/install.sh | sh -s -- -b /usr/local/bin v0.63.1 \ - +# # trivy installation && wget --tries=5 -q -O - https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin - +# # trivy-sbom installation # Next line commented because already managed by another linter # RUN wget --tries=5 -q -O - https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin - -# trufflehog installation -# Managed with COPY --link --from=trufflehog /usr/bin/trufflehog /usr/bin/ - -# vale installation -# Managed with COPY --link --from=vale /bin/vale /bin/vale - -# lychee installation -# Managed with COPY --link --from=lychee /usr/local/bin/lychee /usr/bin/ - +# #OTHER__END ################################ @@ -379,7 +435,6 @@ LABEL com.github.actions.name="MegaLinter" \ org.opencontainers.image.description="Lint your code base with GitHub Actions" #EXTRA_DOCKERFILE_LINES__START -COPY entrypoint.sh /entrypoint.sh -RUN chmod +x entrypoint.sh +COPY --chmod=755 entrypoint.sh /entrypoint.sh ENTRYPOINT ["/bin/bash", "/entrypoint.sh"] #EXTRA_DOCKERFILE_LINES__END diff --git a/flavors/ruby/Dockerfile b/flavors/ruby/Dockerfile index 9bb0147e79b..0d6785b52e4 100644 --- a/flavors/ruby/Dockerfile +++ b/flavors/ruby/Dockerfile @@ -21,6 +21,7 @@ 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 dotenvlinter/dotenv-linter:latest as dotenvlinter FROM ghcr.io/yannh/kubeconform:latest-alpine as kubeconform FROM yoheimuta/protolint:latest as protolint FROM zricethezav/gitleaks:v8.17.0 as gitleaks @@ -112,18 +113,61 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END #PIPVENV__START -RUN PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir --upgrade pip virtualenv \ - && mkdir -p "/venvs/ansible-lint" && cd "/venvs/ansible-lint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir ansible-lint && deactivate && cd ./../.. \ - && mkdir -p "/venvs/djlint" && cd "/venvs/djlint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir djlint && deactivate && cd ./../.. \ - && mkdir -p "/venvs/checkov" && cd "/venvs/checkov" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir packaging checkov && deactivate && cd ./../.. \ - && mkdir -p "/venvs/semgrep" && cd "/venvs/semgrep" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir semgrep && deactivate && cd ./../.. \ - && mkdir -p "/venvs/snakemake" && cd "/venvs/snakemake" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir snakemake && deactivate && cd ./../.. \ - && mkdir -p "/venvs/snakefmt" && cd "/venvs/snakefmt" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir snakefmt && deactivate && cd ./../.. \ - && mkdir -p "/venvs/proselint" && cd "/venvs/proselint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir proselint && deactivate && cd ./../.. \ - && mkdir -p "/venvs/sqlfluff" && cd "/venvs/sqlfluff" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir sqlfluff && deactivate && cd ./../.. \ - && mkdir -p "/venvs/yamllint" && cd "/venvs/yamllint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir yamllint && deactivate && cd ./../.. \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf && rm -rf /root/.cache -ENV PATH="${PATH}":/venvs/ansible-lint/bin:/venvs/djlint/bin:/venvs/checkov/bin:/venvs/semgrep/bin:/venvs/snakemake/bin:/venvs/snakefmt/bin:/venvs/proselint/bin:/venvs/sqlfluff/bin:/venvs/yamllint/bin +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/ansible-lint" \ + && cd "/venvs/ansible-lint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip ansible-lint +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/djlint" \ + && cd "/venvs/djlint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip djlint +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/checkov" \ + && cd "/venvs/checkov" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip packaging checkov +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/semgrep" \ + && cd "/venvs/semgrep" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip semgrep +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/snakemake" \ + && cd "/venvs/snakemake" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakemake +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/snakefmt" \ + && cd "/venvs/snakefmt" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakefmt +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/proselint" \ + && cd "/venvs/proselint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip proselint +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/sqlfluff" \ + && cd "/venvs/sqlfluff" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip sqlfluff +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/yamllint" \ + && cd "/venvs/yamllint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip yamllint + #PIPVENV__END ############################ @@ -210,11 +254,7 @@ RUN echo 'gem: --no-document' >> ~/.gemrc && \ ############################################################################################# #CARGO__START -RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable \ - && export PATH="/root/.cargo/bin:${PATH}" \ - && cargo install --force --locked sarif-fmt shellcheck-sarif \ - && rm -rf /root/.cargo/registry /root/.cargo/git /root/.cache/sccache /root/.rustup -ENV PATH="/root/.cargo/bin:${PATH}" + #CARGO__END ############################## @@ -228,11 +268,14 @@ 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 --link --from=build-platform /usr/bin/bash-exec /usr/bin/bash-exec # 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=node_modules /node-deps /node-deps COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker +COPY --link --from=dotenvlinter /dotenv-linter /usr/bin/dotenv-linter COPY --link --from=kubeconform /kubeconform /usr/bin/ COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ @@ -245,69 +288,26 @@ COPY --link --from=lychee /usr/local/bin/lychee /usr/bin/ ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #OTHER__START -# actionlint installation -# 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 -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 -# 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 --link --from=shfmt /bin/shfmt /usr/bin/ - -# hadolint installation -# Managed with COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint - -# editorconfig-checker installation -# 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 \ - # ktlint installation - && curl --retry 5 --retry-delay 5 -sSLO https://github.com/pinterest/ktlint/releases/latest/download/ktlint && \ +RUN curl --retry 5 --retry-delay 5 -sSLO https://github.com/pinterest/ktlint/releases/latest/download/ktlint && \ chmod a+x ktlint && \ mv "ktlint" /usr/bin/ \ - -# kubeconform installation -# Managed with COPY --link --from=kubeconform /kubeconform /usr/bin/ - +# # kubescape installation && ln -s /lib/libc.so.6 /usr/lib/libresolv.so.2 && \ curl --retry 5 --retry-delay 5 -sLv https://raw.githubusercontent.com/kubescape/kubescape/master/install.sh | /bin/bash -s -- -v v2.3.6 \ - -# protolint installation -# Managed with COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ - -# gitleaks installation -# Managed with COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ - +# # grype installation && curl -sSfL https://raw.githubusercontent.com/anchore/grype/main/install.sh | sh -s -- -b /usr/local/bin v0.63.1 \ - +# # trivy installation && wget --tries=5 -q -O - https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin - +# # trivy-sbom installation # Next line commented because already managed by another linter # RUN wget --tries=5 -q -O - https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin - -# trufflehog installation -# Managed with COPY --link --from=trufflehog /usr/bin/trufflehog /usr/bin/ - -# vale installation -# Managed with COPY --link --from=vale /bin/vale /bin/vale - -# lychee installation -# Managed with COPY --link --from=lychee /usr/local/bin/lychee /usr/bin/ - +# #OTHER__END ################################ @@ -365,7 +365,6 @@ LABEL com.github.actions.name="MegaLinter" \ org.opencontainers.image.description="Lint your code base with GitHub Actions" #EXTRA_DOCKERFILE_LINES__START -COPY entrypoint.sh /entrypoint.sh -RUN chmod +x entrypoint.sh +COPY --chmod=755 entrypoint.sh /entrypoint.sh ENTRYPOINT ["/bin/bash", "/entrypoint.sh"] #EXTRA_DOCKERFILE_LINES__END diff --git a/flavors/rust/Dockerfile b/flavors/rust/Dockerfile index 07b58b494c3..4514cac49dc 100644 --- a/flavors/rust/Dockerfile +++ b/flavors/rust/Dockerfile @@ -21,12 +21,50 @@ 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 dotenvlinter/dotenv-linter:latest as dotenvlinter FROM ghcr.io/yannh/kubeconform:latest-alpine as kubeconform FROM yoheimuta/protolint:latest as protolint FROM zricethezav/gitleaks:v8.17.0 as gitleaks FROM trufflesecurity/trufflehog:latest as trufflehog FROM jdkato/vale:latest as vale FROM lycheeverse/lychee:latest-alpine as lychee +FROM --platform=$BUILDPLATFORM alpine:3 AS cargo-build +WORKDIR /cargo +ENV HOME=/cargo +USER 0 +RUN --mount=type=cache,target=/var/cache/apk,id=apk-${BUILDARCH},sharing=locked \ + apk add --update \ + gcc \ + rustup \ + bash \ + git \ + musl-dev \ + llvm \ + clang \ + curl +RUN curl --location "https://github.com/cargo-bins/cargo-binstall/releases/latest/download/cargo-binstall-$([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64" || echo "aarch64")-unknown-linux-musl.tgz" | tar -xzv \ + && mkdir -p /cargo/.cargo/bin \ + && mv cargo-binstall /cargo/.cargo/bin \ + && chown -R 63425:63425 /cargo +USER 63425 +ENV CC_aarch64_unknown_linux_musl=clang \ + AR_aarch64_unknown_linux_musl=llvm-ar \ + CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_RUSTFLAGS="-Clink-self-contained=yes -Clinker=rust-lld" \ + CC_x86_64_unknown_linux_musl=clang \ + AR_x86_64_unknown_linux_musl=llvm-ar \ + CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_RUSTFLAGS="-Clink-self-contained=yes -Clinker=rust-lld" +ARG TARGETARCH +RUN rustup-init -y --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") + +RUN --mount=type=cache,id=cargo-${TARGETARCH},sharing=locked,target=/cargo/.cargo/registry/,uid=63425 \ + . /cargo/.cargo/env \ + && cargo binstall --no-confirm --no-symlinks sarif-fmt shellcheck-sarif --root /tmp --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") + +FROM scratch AS cargo +COPY --link --from=cargo-build /tmp/bin/* /bin/ +RUN ["/bin/sarif-fmt", "--help"] +RUN ["/bin/shellcheck-sarif", "--help"] + #FROM__END ################## @@ -112,18 +150,61 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END #PIPVENV__START -RUN PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir --upgrade pip virtualenv \ - && mkdir -p "/venvs/ansible-lint" && cd "/venvs/ansible-lint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir ansible-lint && deactivate && cd ./../.. \ - && mkdir -p "/venvs/djlint" && cd "/venvs/djlint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir djlint && deactivate && cd ./../.. \ - && mkdir -p "/venvs/checkov" && cd "/venvs/checkov" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir packaging checkov && deactivate && cd ./../.. \ - && mkdir -p "/venvs/semgrep" && cd "/venvs/semgrep" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir semgrep && deactivate && cd ./../.. \ - && mkdir -p "/venvs/snakemake" && cd "/venvs/snakemake" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir snakemake && deactivate && cd ./../.. \ - && mkdir -p "/venvs/snakefmt" && cd "/venvs/snakefmt" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir snakefmt && deactivate && cd ./../.. \ - && mkdir -p "/venvs/proselint" && cd "/venvs/proselint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir proselint && deactivate && cd ./../.. \ - && mkdir -p "/venvs/sqlfluff" && cd "/venvs/sqlfluff" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir sqlfluff && deactivate && cd ./../.. \ - && mkdir -p "/venvs/yamllint" && cd "/venvs/yamllint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir yamllint && deactivate && cd ./../.. \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf && rm -rf /root/.cache -ENV PATH="${PATH}":/venvs/ansible-lint/bin:/venvs/djlint/bin:/venvs/checkov/bin:/venvs/semgrep/bin:/venvs/snakemake/bin:/venvs/snakefmt/bin:/venvs/proselint/bin:/venvs/sqlfluff/bin:/venvs/yamllint/bin +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/ansible-lint" \ + && cd "/venvs/ansible-lint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip ansible-lint +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/djlint" \ + && cd "/venvs/djlint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip djlint +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/checkov" \ + && cd "/venvs/checkov" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip packaging checkov +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/semgrep" \ + && cd "/venvs/semgrep" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip semgrep +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/snakemake" \ + && cd "/venvs/snakemake" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakemake +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/snakefmt" \ + && cd "/venvs/snakefmt" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakefmt +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/proselint" \ + && cd "/venvs/proselint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip proselint +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/sqlfluff" \ + && cd "/venvs/sqlfluff" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip sqlfluff +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/yamllint" \ + && cd "/venvs/yamllint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip yamllint + #PIPVENV__END ############################ @@ -206,7 +287,7 @@ RUN echo 'gem: --no-document' >> ~/.gemrc && \ #CARGO__START RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable \ && export PATH="/root/.cargo/bin:${PATH}" \ - && rustup component add clippy && cargo install --force --locked sarif-fmt shellcheck-sarif \ + && rustup component add clippy \ && rm -rf /root/.cargo/registry /root/.cargo/git /root/.cache/sccache ENV PATH="/root/.cargo/bin:${PATH}" #CARGO__END @@ -222,86 +303,47 @@ 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 --link --from=build-platform /usr/bin/bash-exec /usr/bin/bash-exec # 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=node_modules /node-deps /node-deps COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker +COPY --link --from=dotenvlinter /dotenv-linter /usr/bin/dotenv-linter COPY --link --from=kubeconform /kubeconform /usr/bin/ COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ COPY --link --from=trufflehog /usr/bin/trufflehog /usr/bin/ COPY --link --from=vale /bin/vale /bin/vale COPY --link --from=lychee /usr/local/bin/lychee /usr/bin/ +COPY --link --from=cargo /bin/* /usr/bin/ #COPY__END ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #OTHER__START -# actionlint installation -# 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 -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 -# 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 --link --from=shfmt /bin/shfmt /usr/bin/ - -# hadolint installation -# Managed with COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint - -# editorconfig-checker installation -# 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 \ - # ktlint installation - && curl --retry 5 --retry-delay 5 -sSLO https://github.com/pinterest/ktlint/releases/latest/download/ktlint && \ +RUN curl --retry 5 --retry-delay 5 -sSLO https://github.com/pinterest/ktlint/releases/latest/download/ktlint && \ chmod a+x ktlint && \ mv "ktlint" /usr/bin/ \ - -# kubeconform installation -# Managed with COPY --link --from=kubeconform /kubeconform /usr/bin/ - +# # kubescape installation && ln -s /lib/libc.so.6 /usr/lib/libresolv.so.2 && \ curl --retry 5 --retry-delay 5 -sLv https://raw.githubusercontent.com/kubescape/kubescape/master/install.sh | /bin/bash -s -- -v v2.3.6 \ - -# protolint installation -# Managed with COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ - -# gitleaks installation -# Managed with COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ - +# # grype installation && curl -sSfL https://raw.githubusercontent.com/anchore/grype/main/install.sh | sh -s -- -b /usr/local/bin v0.63.1 \ - +# # trivy installation && wget --tries=5 -q -O - https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin - +# # trivy-sbom installation # Next line commented because already managed by another linter # RUN wget --tries=5 -q -O - https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin - -# trufflehog installation -# Managed with COPY --link --from=trufflehog /usr/bin/trufflehog /usr/bin/ - -# vale installation -# Managed with COPY --link --from=vale /bin/vale /bin/vale - -# lychee installation -# Managed with COPY --link --from=lychee /usr/local/bin/lychee /usr/bin/ - +# #OTHER__END ################################ @@ -359,7 +401,6 @@ LABEL com.github.actions.name="MegaLinter" \ org.opencontainers.image.description="Lint your code base with GitHub Actions" #EXTRA_DOCKERFILE_LINES__START -COPY entrypoint.sh /entrypoint.sh -RUN chmod +x entrypoint.sh +COPY --chmod=755 entrypoint.sh /entrypoint.sh ENTRYPOINT ["/bin/bash", "/entrypoint.sh"] #EXTRA_DOCKERFILE_LINES__END diff --git a/flavors/salesforce/Dockerfile b/flavors/salesforce/Dockerfile index 5713ae3435c..af33b000c95 100644 --- a/flavors/salesforce/Dockerfile +++ b/flavors/salesforce/Dockerfile @@ -21,6 +21,7 @@ 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 dotenvlinter/dotenv-linter:latest as dotenvlinter FROM ghcr.io/yannh/kubeconform:latest-alpine as kubeconform FROM yoheimuta/protolint:latest as protolint FROM zricethezav/gitleaks:v8.17.0 as gitleaks @@ -112,18 +113,61 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END #PIPVENV__START -RUN PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir --upgrade pip virtualenv \ - && mkdir -p "/venvs/ansible-lint" && cd "/venvs/ansible-lint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir ansible-lint && deactivate && cd ./../.. \ - && mkdir -p "/venvs/djlint" && cd "/venvs/djlint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir djlint && deactivate && cd ./../.. \ - && mkdir -p "/venvs/checkov" && cd "/venvs/checkov" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir packaging checkov && deactivate && cd ./../.. \ - && mkdir -p "/venvs/semgrep" && cd "/venvs/semgrep" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir semgrep && deactivate && cd ./../.. \ - && mkdir -p "/venvs/snakemake" && cd "/venvs/snakemake" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir snakemake && deactivate && cd ./../.. \ - && mkdir -p "/venvs/snakefmt" && cd "/venvs/snakefmt" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir snakefmt && deactivate && cd ./../.. \ - && mkdir -p "/venvs/proselint" && cd "/venvs/proselint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir proselint && deactivate && cd ./../.. \ - && mkdir -p "/venvs/sqlfluff" && cd "/venvs/sqlfluff" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir sqlfluff && deactivate && cd ./../.. \ - && mkdir -p "/venvs/yamllint" && cd "/venvs/yamllint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir yamllint && deactivate && cd ./../.. \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf && rm -rf /root/.cache -ENV PATH="${PATH}":/venvs/ansible-lint/bin:/venvs/djlint/bin:/venvs/checkov/bin:/venvs/semgrep/bin:/venvs/snakemake/bin:/venvs/snakefmt/bin:/venvs/proselint/bin:/venvs/sqlfluff/bin:/venvs/yamllint/bin +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/ansible-lint" \ + && cd "/venvs/ansible-lint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip ansible-lint +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/djlint" \ + && cd "/venvs/djlint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip djlint +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/checkov" \ + && cd "/venvs/checkov" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip packaging checkov +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/semgrep" \ + && cd "/venvs/semgrep" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip semgrep +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/snakemake" \ + && cd "/venvs/snakemake" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakemake +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/snakefmt" \ + && cd "/venvs/snakefmt" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakefmt +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/proselint" \ + && cd "/venvs/proselint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip proselint +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/sqlfluff" \ + && cd "/venvs/sqlfluff" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip sqlfluff +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/yamllint" \ + && cd "/venvs/yamllint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip yamllint + #PIPVENV__END ############################ @@ -207,11 +251,7 @@ RUN echo 'gem: --no-document' >> ~/.gemrc && \ ############################################################################################# #CARGO__START -RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable \ - && export PATH="/root/.cargo/bin:${PATH}" \ - && cargo install --force --locked sarif-fmt shellcheck-sarif \ - && rm -rf /root/.cargo/registry /root/.cargo/git /root/.cache/sccache /root/.rustup -ENV PATH="/root/.cargo/bin:${PATH}" + #CARGO__END ############################## @@ -221,15 +261,18 @@ ENV PATH="/root/.cargo/bin:${PATH}" ############################################################################################# #COPY__START +COPY --link --from=node_modules /node-deps /node-deps 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 --link --from=build-platform /usr/bin/bash-exec /usr/bin/bash-exec # 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=dotenvlinter /dotenv-linter /usr/bin/dotenv-linter COPY --link --from=kubeconform /kubeconform /usr/bin/ COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ @@ -248,87 +291,44 @@ ENV PATH="$JAVA_HOME/bin:${PATH}" RUN echo y|sfdx plugins:install sfdx-hardis \ && npm cache clean --force || true \ && rm -rf /root/.npm/_cacache \ - -# actionlint installation -# 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 -# 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 --link --from=shfmt /bin/shfmt /usr/bin/ - -# hadolint installation -# Managed with COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint - -# editorconfig-checker installation -# 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 \ - +# # ktlint installation && curl --retry 5 --retry-delay 5 -sSLO https://github.com/pinterest/ktlint/releases/latest/download/ktlint && \ chmod a+x ktlint && \ mv "ktlint" /usr/bin/ \ - -# kubeconform installation -# Managed with COPY --link --from=kubeconform /kubeconform /usr/bin/ - +# # kubescape installation && ln -s /lib/libc.so.6 /usr/lib/libresolv.so.2 && \ curl --retry 5 --retry-delay 5 -sLv https://raw.githubusercontent.com/kubescape/kubescape/master/install.sh | /bin/bash -s -- -v v2.3.6 \ - -# protolint installation -# Managed with COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ - -# gitleaks installation -# Managed with COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ - +# # grype installation && curl -sSfL https://raw.githubusercontent.com/anchore/grype/main/install.sh | sh -s -- -b /usr/local/bin v0.63.1 \ - +# # trivy installation && wget --tries=5 -q -O - https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin \ - +# # trivy-sbom installation # Next line commented because already managed by another linter # RUN wget --tries=5 -q -O - https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin - -# trufflehog installation -# Managed with COPY --link --from=trufflehog /usr/bin/trufflehog /usr/bin/ - +# # sfdx-scanner-apex installation && sfdx plugins:install @salesforce/sfdx-scanner \ && npm cache clean --force || true \ && rm -rf /root/.npm/_cacache - +# # sfdx-scanner-aura installation # Next line commented because already managed by another linter # RUN sfdx plugins:install @salesforce/sfdx-scanner \ # && npm cache clean --force || true \ # && rm -rf /root/.npm/_cacache - +# # sfdx-scanner-lwc installation # Next line commented because already managed by another linter # RUN sfdx plugins:install @salesforce/sfdx-scanner \ # && npm cache clean --force || true \ # && rm -rf /root/.npm/_cacache - -# vale installation -# Managed with COPY --link --from=vale /bin/vale /bin/vale - -# lychee installation -# Managed with COPY --link --from=lychee /usr/local/bin/lychee /usr/bin/ - +# #OTHER__END ################################ @@ -386,7 +386,6 @@ LABEL com.github.actions.name="MegaLinter" \ org.opencontainers.image.description="Lint your code base with GitHub Actions" #EXTRA_DOCKERFILE_LINES__START -COPY entrypoint.sh /entrypoint.sh -RUN chmod +x entrypoint.sh +COPY --chmod=755 entrypoint.sh /entrypoint.sh ENTRYPOINT ["/bin/bash", "/entrypoint.sh"] #EXTRA_DOCKERFILE_LINES__END diff --git a/flavors/security/Dockerfile b/flavors/security/Dockerfile index 4093ce3dbf4..dc9d95d1770 100644 --- a/flavors/security/Dockerfile +++ b/flavors/security/Dockerfile @@ -105,14 +105,37 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END #PIPVENV__START -RUN PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir --upgrade pip virtualenv \ - && mkdir -p "/venvs/ansible-lint" && cd "/venvs/ansible-lint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir ansible-lint && deactivate && cd ./../.. \ - && mkdir -p "/venvs/cfn-lint" && cd "/venvs/cfn-lint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir cfn-lint && deactivate && cd ./../.. \ - && mkdir -p "/venvs/bandit" && cd "/venvs/bandit" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir bandit bandit_sarif_formatter bandit[toml] && deactivate && cd ./../.. \ - && mkdir -p "/venvs/checkov" && cd "/venvs/checkov" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir packaging checkov && deactivate && cd ./../.. \ - && mkdir -p "/venvs/semgrep" && cd "/venvs/semgrep" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir semgrep && deactivate && cd ./../.. \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf && rm -rf /root/.cache -ENV PATH="${PATH}":/venvs/ansible-lint/bin:/venvs/cfn-lint/bin:/venvs/bandit/bin:/venvs/checkov/bin:/venvs/semgrep/bin +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/ansible-lint" \ + && cd "/venvs/ansible-lint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip ansible-lint +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/cfn-lint" \ + && cd "/venvs/cfn-lint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip cfn-lint +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/bandit" \ + && cd "/venvs/bandit" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip bandit bandit_sarif_formatter bandit[toml] +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/checkov" \ + && cd "/venvs/checkov" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip packaging checkov +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/semgrep" \ + && cd "/venvs/semgrep" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip semgrep + #PIPVENV__END ############################ @@ -169,11 +192,7 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ ############################################################################################# #CARGO__START -RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable \ - && export PATH="/root/.cargo/bin:${PATH}" \ - && cargo install --force --locked sarif-fmt shellcheck-sarif \ - && rm -rf /root/.cargo/registry /root/.cargo/git /root/.cache/sccache /root/.rustup -ENV PATH="/root/.cargo/bin:${PATH}" + #CARGO__END ############################## @@ -183,6 +202,7 @@ ENV PATH="/root/.cargo/bin:${PATH}" ############################################################################################# #COPY__START +COPY --link --from=build-platform /usr/bin/bash-exec /usr/bin/bash-exec COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint COPY --link --from=kubeconform /kubeconform /usr/bin/ @@ -190,6 +210,7 @@ COPY --link --from=dustilock /usr/bin/dustilock /usr/bin/dustilock COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ COPY --link --from=kics /app/bin/kics /usr/bin/ COPY --from=kics /app/bin/assets /opt/kics/assets/ +COPY --link --from=node_modules /node-deps /node-deps COPY --link --from=trufflehog /usr/bin/trufflehog /usr/bin/ COPY --link --from=tflint /usr/local/bin/tflint /usr/bin/ COPY --link --from=terrascan /go/bin/terrascan /usr/bin/ @@ -200,23 +221,10 @@ COPY --link --from=terragrunt /usr/local/bin/terragrunt /usr/bin/ ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #OTHER__START -# bash-exec installation -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 -# Managed with COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck - -# hadolint installation -# Managed with COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint - -# kubeconform installation -# Managed with COPY --link --from=kubeconform /kubeconform /usr/bin/ - # kubescape installation - && ln -s /lib/libc.so.6 /usr/lib/libresolv.so.2 && \ +RUN ln -s /lib/libc.so.6 /usr/lib/libresolv.so.2 && \ curl --retry 5 --retry-delay 5 -sLv https://raw.githubusercontent.com/kubescape/kubescape/master/install.sh | /bin/bash -s -- -v v2.3.6 \ - +# # devskim installation && wget --tries=5 -q -O dotnet-install.sh https://dot.net/v1/dotnet-install.sh \ && chmod +x dotnet-install.sh \ @@ -224,45 +232,25 @@ RUN printf '#!/bin/bash \n\nif [[ -x "$1" ]]; then exit 0; else echo "Error: Fil ENV PATH="${PATH}:/root/.dotnet/tools:/usr/share/dotnet" RUN dotnet tool install --global Microsoft.CST.DevSkim.CLI \ - -# dustilock installation -# Managed with COPY --link --from=dustilock /usr/bin/dustilock /usr/bin/dustilock - -# gitleaks installation -# Managed with COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ - +# # grype installation && curl -sSfL https://raw.githubusercontent.com/anchore/grype/main/install.sh | sh -s -- -b /usr/local/bin v0.63.1 \ - +# # kics installation -# 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/ - +# # syft installation RUN curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b /usr/local/bin \ - +# # trivy installation && wget --tries=5 -q -O - https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin - +# # trivy-sbom installation # Next line commented because already managed by another linter # RUN wget --tries=5 -q -O - https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin - -# trufflehog installation -# Managed with COPY --link --from=trufflehog /usr/bin/trufflehog /usr/bin/ - -# tflint installation -# Managed with COPY --link --from=tflint /usr/local/bin/tflint /usr/bin/ - -# terrascan installation -# Managed with COPY --link --from=terrascan /go/bin/terrascan /usr/bin/ - -# terragrunt installation -# Managed with COPY --link --from=terragrunt /usr/local/bin/terragrunt /usr/bin/ - +# #OTHER__END ################################ @@ -320,7 +308,6 @@ LABEL com.github.actions.name="MegaLinter" \ org.opencontainers.image.description="Lint your code base with GitHub Actions" #EXTRA_DOCKERFILE_LINES__START -COPY entrypoint.sh /entrypoint.sh -RUN chmod +x entrypoint.sh +COPY --chmod=755 entrypoint.sh /entrypoint.sh ENTRYPOINT ["/bin/bash", "/entrypoint.sh"] #EXTRA_DOCKERFILE_LINES__END diff --git a/flavors/swift/Dockerfile b/flavors/swift/Dockerfile index 2164f58a4e6..5a79296e2ae 100644 --- a/flavors/swift/Dockerfile +++ b/flavors/swift/Dockerfile @@ -21,6 +21,7 @@ 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 dotenvlinter/dotenv-linter:latest as dotenvlinter FROM ghcr.io/yannh/kubeconform:latest-alpine as kubeconform FROM yoheimuta/protolint:latest as protolint FROM zricethezav/gitleaks:v8.17.0 as gitleaks @@ -114,18 +115,61 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END #PIPVENV__START -RUN PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir --upgrade pip virtualenv \ - && mkdir -p "/venvs/ansible-lint" && cd "/venvs/ansible-lint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir ansible-lint && deactivate && cd ./../.. \ - && mkdir -p "/venvs/djlint" && cd "/venvs/djlint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir djlint && deactivate && cd ./../.. \ - && mkdir -p "/venvs/checkov" && cd "/venvs/checkov" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir packaging checkov && deactivate && cd ./../.. \ - && mkdir -p "/venvs/semgrep" && cd "/venvs/semgrep" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir semgrep && deactivate && cd ./../.. \ - && mkdir -p "/venvs/snakemake" && cd "/venvs/snakemake" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir snakemake && deactivate && cd ./../.. \ - && mkdir -p "/venvs/snakefmt" && cd "/venvs/snakefmt" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir snakefmt && deactivate && cd ./../.. \ - && mkdir -p "/venvs/proselint" && cd "/venvs/proselint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir proselint && deactivate && cd ./../.. \ - && mkdir -p "/venvs/sqlfluff" && cd "/venvs/sqlfluff" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir sqlfluff && deactivate && cd ./../.. \ - && mkdir -p "/venvs/yamllint" && cd "/venvs/yamllint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir yamllint && deactivate && cd ./../.. \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf && rm -rf /root/.cache -ENV PATH="${PATH}":/venvs/ansible-lint/bin:/venvs/djlint/bin:/venvs/checkov/bin:/venvs/semgrep/bin:/venvs/snakemake/bin:/venvs/snakefmt/bin:/venvs/proselint/bin:/venvs/sqlfluff/bin:/venvs/yamllint/bin +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/ansible-lint" \ + && cd "/venvs/ansible-lint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip ansible-lint +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/djlint" \ + && cd "/venvs/djlint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip djlint +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/checkov" \ + && cd "/venvs/checkov" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip packaging checkov +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/semgrep" \ + && cd "/venvs/semgrep" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip semgrep +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/snakemake" \ + && cd "/venvs/snakemake" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakemake +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/snakefmt" \ + && cd "/venvs/snakefmt" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakefmt +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/proselint" \ + && cd "/venvs/proselint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip proselint +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/sqlfluff" \ + && cd "/venvs/sqlfluff" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip sqlfluff +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/yamllint" \ + && cd "/venvs/yamllint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip yamllint + #PIPVENV__END ############################ @@ -206,11 +250,7 @@ RUN echo 'gem: --no-document' >> ~/.gemrc && \ ############################################################################################# #CARGO__START -RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable \ - && export PATH="/root/.cargo/bin:${PATH}" \ - && cargo install --force --locked sarif-fmt shellcheck-sarif \ - && rm -rf /root/.cargo/registry /root/.cargo/git /root/.cache/sccache /root/.rustup -ENV PATH="/root/.cargo/bin:${PATH}" + #CARGO__END ############################## @@ -224,11 +264,14 @@ 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 --link --from=build-platform /usr/bin/bash-exec /usr/bin/bash-exec # 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=node_modules /node-deps /node-deps COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker +COPY --link --from=dotenvlinter /dotenv-linter /usr/bin/dotenv-linter COPY --link --from=kubeconform /kubeconform /usr/bin/ COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ @@ -242,69 +285,26 @@ COPY --link --from=lychee /usr/local/bin/lychee /usr/bin/ ############################################################################################# #OTHER__START RUN rc-update add docker boot && rc-service docker start || true \ -# actionlint installation -# 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 -# 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 --link --from=shfmt /bin/shfmt /usr/bin/ - -# hadolint installation -# Managed with COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint - -# editorconfig-checker installation -# 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 \ - # ktlint installation && curl --retry 5 --retry-delay 5 -sSLO https://github.com/pinterest/ktlint/releases/latest/download/ktlint && \ chmod a+x ktlint && \ mv "ktlint" /usr/bin/ \ - -# kubeconform installation -# Managed with COPY --link --from=kubeconform /kubeconform /usr/bin/ - +# # kubescape installation && ln -s /lib/libc.so.6 /usr/lib/libresolv.so.2 && \ curl --retry 5 --retry-delay 5 -sLv https://raw.githubusercontent.com/kubescape/kubescape/master/install.sh | /bin/bash -s -- -v v2.3.6 \ - -# protolint installation -# Managed with COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ - -# gitleaks installation -# Managed with COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ - +# # grype installation && curl -sSfL https://raw.githubusercontent.com/anchore/grype/main/install.sh | sh -s -- -b /usr/local/bin v0.63.1 \ - +# # trivy installation && wget --tries=5 -q -O - https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin - +# # trivy-sbom installation # Next line commented because already managed by another linter # RUN wget --tries=5 -q -O - https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin - -# trufflehog installation -# Managed with COPY --link --from=trufflehog /usr/bin/trufflehog /usr/bin/ - -# vale installation -# Managed with COPY --link --from=vale /bin/vale /bin/vale - -# lychee installation -# Managed with COPY --link --from=lychee /usr/local/bin/lychee /usr/bin/ - +# #OTHER__END ################################ @@ -362,7 +362,6 @@ LABEL com.github.actions.name="MegaLinter" \ org.opencontainers.image.description="Lint your code base with GitHub Actions" #EXTRA_DOCKERFILE_LINES__START -COPY entrypoint.sh /entrypoint.sh -RUN chmod +x entrypoint.sh +COPY --chmod=755 entrypoint.sh /entrypoint.sh ENTRYPOINT ["/bin/bash", "/entrypoint.sh"] #EXTRA_DOCKERFILE_LINES__END diff --git a/flavors/terraform/Dockerfile b/flavors/terraform/Dockerfile index ee2237ee838..127f53ddf5f 100644 --- a/flavors/terraform/Dockerfile +++ b/flavors/terraform/Dockerfile @@ -21,6 +21,7 @@ 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 dotenvlinter/dotenv-linter:latest as dotenvlinter FROM ghcr.io/yannh/kubeconform:latest-alpine as kubeconform FROM yoheimuta/protolint:latest as protolint FROM zricethezav/gitleaks:v8.17.0 as gitleaks @@ -118,18 +119,61 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END #PIPVENV__START -RUN PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir --upgrade pip virtualenv \ - && mkdir -p "/venvs/ansible-lint" && cd "/venvs/ansible-lint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir ansible-lint && deactivate && cd ./../.. \ - && mkdir -p "/venvs/djlint" && cd "/venvs/djlint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir djlint && deactivate && cd ./../.. \ - && mkdir -p "/venvs/checkov" && cd "/venvs/checkov" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir packaging checkov && deactivate && cd ./../.. \ - && mkdir -p "/venvs/semgrep" && cd "/venvs/semgrep" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir semgrep && deactivate && cd ./../.. \ - && mkdir -p "/venvs/snakemake" && cd "/venvs/snakemake" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir snakemake && deactivate && cd ./../.. \ - && mkdir -p "/venvs/snakefmt" && cd "/venvs/snakefmt" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir snakefmt && deactivate && cd ./../.. \ - && mkdir -p "/venvs/proselint" && cd "/venvs/proselint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir proselint && deactivate && cd ./../.. \ - && mkdir -p "/venvs/sqlfluff" && cd "/venvs/sqlfluff" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir sqlfluff && deactivate && cd ./../.. \ - && mkdir -p "/venvs/yamllint" && cd "/venvs/yamllint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir yamllint && deactivate && cd ./../.. \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf && rm -rf /root/.cache -ENV PATH="${PATH}":/venvs/ansible-lint/bin:/venvs/djlint/bin:/venvs/checkov/bin:/venvs/semgrep/bin:/venvs/snakemake/bin:/venvs/snakefmt/bin:/venvs/proselint/bin:/venvs/sqlfluff/bin:/venvs/yamllint/bin +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/ansible-lint" \ + && cd "/venvs/ansible-lint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip ansible-lint +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/djlint" \ + && cd "/venvs/djlint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip djlint +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/checkov" \ + && cd "/venvs/checkov" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip packaging checkov +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/semgrep" \ + && cd "/venvs/semgrep" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip semgrep +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/snakemake" \ + && cd "/venvs/snakemake" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakemake +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/snakefmt" \ + && cd "/venvs/snakefmt" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakefmt +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/proselint" \ + && cd "/venvs/proselint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip proselint +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/sqlfluff" \ + && cd "/venvs/sqlfluff" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip sqlfluff +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/yamllint" \ + && cd "/venvs/yamllint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip yamllint + #PIPVENV__END ############################ @@ -210,11 +254,7 @@ RUN echo 'gem: --no-document' >> ~/.gemrc && \ ############################################################################################# #CARGO__START -RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable \ - && export PATH="/root/.cargo/bin:${PATH}" \ - && cargo install --force --locked sarif-fmt shellcheck-sarif \ - && rm -rf /root/.cargo/registry /root/.cargo/git /root/.cache/sccache /root/.rustup -ENV PATH="/root/.cargo/bin:${PATH}" + #CARGO__END ############################## @@ -228,11 +268,14 @@ 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 --link --from=build-platform /usr/bin/bash-exec /usr/bin/bash-exec # 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=node_modules /node-deps /node-deps COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker +COPY --link --from=dotenvlinter /dotenv-linter /usr/bin/dotenv-linter COPY --link --from=kubeconform /kubeconform /usr/bin/ COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ @@ -251,87 +294,30 @@ COPY --link --from=terragrunt /bin/terraform /usr/bin/ ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #OTHER__START -# actionlint installation -# 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 -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 -# 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 --link --from=shfmt /bin/shfmt /usr/bin/ - -# hadolint installation -# Managed with COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint - -# editorconfig-checker installation -# 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 \ - # ktlint installation - && curl --retry 5 --retry-delay 5 -sSLO https://github.com/pinterest/ktlint/releases/latest/download/ktlint && \ +RUN curl --retry 5 --retry-delay 5 -sSLO https://github.com/pinterest/ktlint/releases/latest/download/ktlint && \ chmod a+x ktlint && \ mv "ktlint" /usr/bin/ \ - -# kubeconform installation -# Managed with COPY --link --from=kubeconform /kubeconform /usr/bin/ - +# # kubescape installation && ln -s /lib/libc.so.6 /usr/lib/libresolv.so.2 && \ curl --retry 5 --retry-delay 5 -sLv https://raw.githubusercontent.com/kubescape/kubescape/master/install.sh | /bin/bash -s -- -v v2.3.6 \ - -# protolint installation -# Managed with COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ - -# gitleaks installation -# Managed with COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ - +# # grype installation && curl -sSfL https://raw.githubusercontent.com/anchore/grype/main/install.sh | sh -s -- -b /usr/local/bin v0.63.1 \ - +# # kics installation -# 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/ - +# # trivy installation RUN wget --tries=5 -q -O - https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin - +# # trivy-sbom installation # Next line commented because already managed by another linter # RUN wget --tries=5 -q -O - https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin - -# trufflehog installation -# Managed with COPY --link --from=trufflehog /usr/bin/trufflehog /usr/bin/ - -# vale installation -# Managed with COPY --link --from=vale /bin/vale /bin/vale - -# lychee installation -# Managed with COPY --link --from=lychee /usr/local/bin/lychee /usr/bin/ - -# tflint installation -# Managed with COPY --link --from=tflint /usr/local/bin/tflint /usr/bin/ - -# terrascan installation -# Managed with COPY --link --from=terrascan /go/bin/terrascan /usr/bin/ - -# terragrunt installation -# Managed with COPY --link --from=terragrunt /usr/local/bin/terragrunt /usr/bin/ - -# terraform-fmt installation -# Managed with COPY --link --from=terragrunt /bin/terraform /usr/bin/ - +# #OTHER__END ################################ @@ -389,7 +375,6 @@ LABEL com.github.actions.name="MegaLinter" \ org.opencontainers.image.description="Lint your code base with GitHub Actions" #EXTRA_DOCKERFILE_LINES__START -COPY entrypoint.sh /entrypoint.sh -RUN chmod +x entrypoint.sh +COPY --chmod=755 entrypoint.sh /entrypoint.sh ENTRYPOINT ["/bin/bash", "/entrypoint.sh"] #EXTRA_DOCKERFILE_LINES__END diff --git a/linters/action_actionlint/Dockerfile b/linters/action_actionlint/Dockerfile index 96ae36393df..ef5318d3428 100644 --- a/linters/action_actionlint/Dockerfile +++ b/linters/action_actionlint/Dockerfile @@ -139,10 +139,6 @@ COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #OTHER__START -# actionlint installation -# 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 a67bc68da4f..1b795df4bc1 100644 --- a/linters/ansible_ansible_lint/Dockerfile +++ b/linters/ansible_ansible_lint/Dockerfile @@ -79,10 +79,13 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END #PIPVENV__START -RUN PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir --upgrade pip virtualenv \ - && mkdir -p "/venvs/ansible-lint" && cd "/venvs/ansible-lint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir ansible-lint && deactivate && cd ./../.. \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf && rm -rf /root/.cache -ENV PATH="${PATH}":/venvs/ansible-lint/bin +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/ansible-lint" \ + && cd "/venvs/ansible-lint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip ansible-lint + #PIPVENV__END ############################ diff --git a/linters/arm_arm_ttk/Dockerfile b/linters/arm_arm_ttk/Dockerfile index f4fc9e5537a..427eb372a27 100644 --- a/linters/arm_arm_ttk/Dockerfile +++ b/linters/arm_arm_ttk/Dockerfile @@ -155,7 +155,7 @@ RUN --mount=type=secret,id=GITHUB_TOKEN case ${TARGETPLATFORM} in \ | tar -xzC ${PWSH_DIRECTORY} \ && ln -sf ${PWSH_DIRECTORY}/pwsh /usr/bin/pwsh - +# # arm-ttk installation ENV ARM_TTK_PSD1="${ARM_TTK_DIRECTORY}/arm-ttk-master/arm-ttk/arm-ttk.psd1" RUN curl --retry 5 --retry-delay 5 -sLO "${ARM_TTK_URI}" \ @@ -164,7 +164,7 @@ RUN curl --retry 5 --retry-delay 5 -sLO "${ARM_TTK_URI}" \ && ln -sTf "${ARM_TTK_PSD1}" /usr/bin/arm-ttk \ && chmod a+x /usr/bin/arm-ttk - +# #OTHER__END ################################ diff --git a/linters/bash_exec/Dockerfile b/linters/bash_exec/Dockerfile index d7418f9b452..817411757a9 100644 --- a/linters/bash_exec/Dockerfile +++ b/linters/bash_exec/Dockerfile @@ -125,17 +125,13 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ ############################################################################################# #COPY__START - +COPY --link --from=build-platform /usr/bin/bash-exec /usr/bin/bash-exec #COPY__END ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #OTHER__START -# bash-exec installation -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 - #OTHER__END diff --git a/linters/bash_shellcheck/Dockerfile b/linters/bash_shellcheck/Dockerfile index 7e02f08b634..74f29b42b21 100644 --- a/linters/bash_shellcheck/Dockerfile +++ b/linters/bash_shellcheck/Dockerfile @@ -115,11 +115,7 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ ############################################################################################# #CARGO__START -RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable \ - && export PATH="/root/.cargo/bin:${PATH}" \ - && cargo install --force --locked shellcheck-sarif \ - && rm -rf /root/.cargo/registry /root/.cargo/git /root/.cache/sccache /root/.rustup -ENV PATH="/root/.cargo/bin:${PATH}" + #CARGO__END ############################## @@ -136,8 +132,6 @@ COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #OTHER__START -# shellcheck installation -# 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 65d8370c923..95caacf2721 100644 --- a/linters/bash_shfmt/Dockerfile +++ b/linters/bash_shfmt/Dockerfile @@ -132,8 +132,6 @@ COPY --link --from=shfmt /bin/shfmt /usr/bin/ ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #OTHER__START -# shfmt installation -# 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 de9dd6a6ac5..2973088f735 100644 --- a/linters/bicep_bicep_linter/Dockerfile +++ b/linters/bicep_bicep_linter/Dockerfile @@ -144,7 +144,7 @@ esac \ && chmod +x "${BICEP_EXE}" \ && mv "${BICEP_EXE}" "${BICEP_DIR}" - +# #OTHER__END ################################ diff --git a/linters/c_cpplint/Dockerfile b/linters/c_cpplint/Dockerfile index c37da991433..3f0cefd5f8e 100644 --- a/linters/c_cpplint/Dockerfile +++ b/linters/c_cpplint/Dockerfile @@ -79,10 +79,13 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END #PIPVENV__START -RUN PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir --upgrade pip virtualenv \ - && mkdir -p "/venvs/cpplint" && cd "/venvs/cpplint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir cpplint && deactivate && cd ./../.. \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf && rm -rf /root/.cache -ENV PATH="${PATH}":/venvs/cpplint/bin +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/cpplint" \ + && cd "/venvs/cpplint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip cpplint + #PIPVENV__END ############################ diff --git a/linters/clojure_clj_kondo/Dockerfile b/linters/clojure_clj_kondo/Dockerfile index 3085bcfa2d0..3277ec6ad7e 100644 --- a/linters/clojure_clj_kondo/Dockerfile +++ b/linters/clojure_clj_kondo/Dockerfile @@ -173,13 +173,13 @@ RUN ALPINE_GLIBC_BASE_URL="https://github.com/sgerrand/alpine-pkg-glibc/releases "$ALPINE_GLIBC_BASE_PACKAGE_FILENAME" \ "$ALPINE_GLIBC_BIN_PACKAGE_FILENAME" \ "$ALPINE_GLIBC_I18N_PACKAGE_FILENAME" \ - +# # clj-kondo installation && curl --retry 5 --retry-delay 5 -sLO https://raw.githubusercontent.com/clj-kondo/clj-kondo/master/script/install-clj-kondo \ && chmod +x install-clj-kondo \ && ./install-clj-kondo - +# #OTHER__END ################################ diff --git a/linters/clojure_cljstyle/Dockerfile b/linters/clojure_cljstyle/Dockerfile index c306add18be..8bff8574841 100644 --- a/linters/clojure_cljstyle/Dockerfile +++ b/linters/clojure_cljstyle/Dockerfile @@ -173,13 +173,13 @@ RUN ALPINE_GLIBC_BASE_URL="https://github.com/sgerrand/alpine-pkg-glibc/releases "$ALPINE_GLIBC_BASE_PACKAGE_FILENAME" \ "$ALPINE_GLIBC_BIN_PACKAGE_FILENAME" \ "$ALPINE_GLIBC_I18N_PACKAGE_FILENAME" \ - +# # cljstyle installation && curl --retry 5 --retry-delay 5 -sLO https://raw.githubusercontent.com/greglook/cljstyle/main/script/install-cljstyle \ && chmod +x install-cljstyle \ && ./install-cljstyle - +# #OTHER__END ################################ diff --git a/linters/cloudformation_cfn_lint/Dockerfile b/linters/cloudformation_cfn_lint/Dockerfile index 6f2a696485d..c13bb5554c5 100644 --- a/linters/cloudformation_cfn_lint/Dockerfile +++ b/linters/cloudformation_cfn_lint/Dockerfile @@ -79,10 +79,13 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END #PIPVENV__START -RUN PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir --upgrade pip virtualenv \ - && mkdir -p "/venvs/cfn-lint" && cd "/venvs/cfn-lint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir cfn-lint && deactivate && cd ./../.. \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf && rm -rf /root/.cache -ENV PATH="${PATH}":/venvs/cfn-lint/bin +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/cfn-lint" \ + && cd "/venvs/cfn-lint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip cfn-lint + #PIPVENV__END ############################ diff --git a/linters/coffee_coffeelint/Dockerfile b/linters/coffee_coffeelint/Dockerfile index 9d8fc753127..bb405bf1b94 100644 --- a/linters/coffee_coffeelint/Dockerfile +++ b/linters/coffee_coffeelint/Dockerfile @@ -147,7 +147,7 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ ############################################################################################# #COPY__START - +COPY --link --from=node_modules /node-deps /node-deps #COPY__END ############################################################################################# diff --git a/linters/copypaste_jscpd/Dockerfile b/linters/copypaste_jscpd/Dockerfile index bf102fd3049..ee354c002c1 100644 --- a/linters/copypaste_jscpd/Dockerfile +++ b/linters/copypaste_jscpd/Dockerfile @@ -148,7 +148,7 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ ############################################################################################# #COPY__START - +COPY --link --from=node_modules /node-deps /node-deps #COPY__END ############################################################################################# diff --git a/linters/cpp_cpplint/Dockerfile b/linters/cpp_cpplint/Dockerfile index 05277e19099..1af00fadf1d 100644 --- a/linters/cpp_cpplint/Dockerfile +++ b/linters/cpp_cpplint/Dockerfile @@ -79,10 +79,13 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END #PIPVENV__START -RUN PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir --upgrade pip virtualenv \ - && mkdir -p "/venvs/cpplint" && cd "/venvs/cpplint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir cpplint && deactivate && cd ./../.. \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf && rm -rf /root/.cache -ENV PATH="${PATH}":/venvs/cpplint/bin +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/cpplint" \ + && cd "/venvs/cpplint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip cpplint + #PIPVENV__END ############################ diff --git a/linters/csharp_csharpier/Dockerfile b/linters/csharp_csharpier/Dockerfile index 05fa7b68e7b..fe906cec8f5 100644 --- a/linters/csharp_csharpier/Dockerfile +++ b/linters/csharp_csharpier/Dockerfile @@ -146,10 +146,10 @@ RUN wget --tries=5 -q -O dotnet-install.sh https://dot.net/v1/dotnet-install.sh && ./dotnet-install.sh --install-dir /usr/share/dotnet -channel 6.0 -version latest ENV PATH="${PATH}:/root/.dotnet/tools:/usr/share/dotnet" - +# # csharpier installation RUN /usr/share/dotnet/dotnet tool install -g csharpier - +# #OTHER__END ################################ diff --git a/linters/csharp_dotnet_format/Dockerfile b/linters/csharp_dotnet_format/Dockerfile index d703f9b23e7..9661d16d9d4 100644 --- a/linters/csharp_dotnet_format/Dockerfile +++ b/linters/csharp_dotnet_format/Dockerfile @@ -146,7 +146,7 @@ RUN wget --tries=5 -q -O dotnet-install.sh https://dot.net/v1/dotnet-install.sh && ./dotnet-install.sh --install-dir /usr/share/dotnet -channel 6.0 -version latest ENV PATH="${PATH}:/root/.dotnet/tools:/usr/share/dotnet" - +# #OTHER__END ################################ diff --git a/linters/css_stylelint/Dockerfile b/linters/css_stylelint/Dockerfile index fe8f03dedbf..f467e4e5377 100644 --- a/linters/css_stylelint/Dockerfile +++ b/linters/css_stylelint/Dockerfile @@ -150,7 +150,7 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ ############################################################################################# #COPY__START - +COPY --link --from=node_modules /node-deps /node-deps #COPY__END ############################################################################################# diff --git a/linters/dart_dartanalyzer/Dockerfile b/linters/dart_dartanalyzer/Dockerfile index bd41e85d8f2..d185b773df8 100644 --- a/linters/dart_dartanalyzer/Dockerfile +++ b/linters/dart_dartanalyzer/Dockerfile @@ -174,7 +174,7 @@ RUN ALPINE_GLIBC_BASE_URL="https://github.com/sgerrand/alpine-pkg-glibc/releases "$ALPINE_GLIBC_BASE_PACKAGE_FILENAME" \ "$ALPINE_GLIBC_BIN_PACKAGE_FILENAME" \ "$ALPINE_GLIBC_I18N_PACKAGE_FILENAME" \ - +# # dartanalyzer installation && case ${TARGETPLATFORM} in \ "linux/amd64") DART_ARCH=x64 ;; \ @@ -185,7 +185,7 @@ RUN ALPINE_GLIBC_BASE_URL="https://github.com/sgerrand/alpine-pkg-glibc/releases && mv dart-sdk/bin/* /usr/bin/ && mv dart-sdk/lib/* /usr/lib/ && mv dart-sdk/include/* /usr/include/ \ && rm -r dart-sdk/ - +# #OTHER__END ################################ diff --git a/linters/dockerfile_hadolint/Dockerfile b/linters/dockerfile_hadolint/Dockerfile index 61d8e81d10f..b51c6e398d9 100644 --- a/linters/dockerfile_hadolint/Dockerfile +++ b/linters/dockerfile_hadolint/Dockerfile @@ -132,8 +132,6 @@ COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #OTHER__START -# hadolint installation -# 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 23e1978dcd5..85decd23ce0 100644 --- a/linters/editorconfig_editorconfig_checker/Dockerfile +++ b/linters/editorconfig_editorconfig_checker/Dockerfile @@ -132,8 +132,6 @@ COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checke ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #OTHER__START -# editorconfig-checker installation -# 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 edc755ab5d6..8fac98e6b1c 100644 --- a/linters/env_dotenv_linter/Dockerfile +++ b/linters/env_dotenv_linter/Dockerfile @@ -11,7 +11,7 @@ ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #FROM__START - +FROM dotenvlinter/dotenv-linter:latest as dotenvlinter #FROM__END ################## @@ -125,15 +125,13 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ ############################################################################################# #COPY__START - +COPY --link --from=dotenvlinter /dotenv-linter /usr/bin/dotenv-linter #COPY__END ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #OTHER__START -# dotenv-linter installation -RUN wget -q -O - https://raw.githubusercontent.com/dotenv-linter/dotenv-linter/master/install.sh | sh -s #OTHER__END diff --git a/linters/gherkin_gherkin_lint/Dockerfile b/linters/gherkin_gherkin_lint/Dockerfile index e295b6ba33a..85e4f13c41d 100644 --- a/linters/gherkin_gherkin_lint/Dockerfile +++ b/linters/gherkin_gherkin_lint/Dockerfile @@ -147,7 +147,7 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ ############################################################################################# #COPY__START - +COPY --link --from=node_modules /node-deps /node-deps #COPY__END ############################################################################################# diff --git a/linters/go_golangci_lint/Dockerfile b/linters/go_golangci_lint/Dockerfile index 275abbf7829..764c1e8d89f 100644 --- a/linters/go_golangci_lint/Dockerfile +++ b/linters/go_golangci_lint/Dockerfile @@ -137,7 +137,7 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ RUN wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh \ && golangci-lint --version - +# #OTHER__END ################################ diff --git a/linters/go_revive/Dockerfile b/linters/go_revive/Dockerfile index 934e478cfe5..df2bc293b36 100644 --- a/linters/go_revive/Dockerfile +++ b/linters/go_revive/Dockerfile @@ -137,8 +137,6 @@ COPY --link --from=revive /usr/bin/revive /usr/bin/revive ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #OTHER__START -# revive installation -# 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 18d271c8051..47c9a903610 100644 --- a/linters/graphql_graphql_schema_linter/Dockerfile +++ b/linters/graphql_graphql_schema_linter/Dockerfile @@ -148,7 +148,7 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ ############################################################################################# #COPY__START - +COPY --link --from=node_modules /node-deps /node-deps #COPY__END ############################################################################################# diff --git a/linters/groovy_npm_groovy_lint/Dockerfile b/linters/groovy_npm_groovy_lint/Dockerfile index 1d37b083737..571f8540dc8 100644 --- a/linters/groovy_npm_groovy_lint/Dockerfile +++ b/linters/groovy_npm_groovy_lint/Dockerfile @@ -148,7 +148,7 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ ############################################################################################# #COPY__START - +COPY --link --from=node_modules /node-deps /node-deps #COPY__END ############################################################################################# diff --git a/linters/html_djlint/Dockerfile b/linters/html_djlint/Dockerfile index 5e646e71ed4..5685e1e7070 100644 --- a/linters/html_djlint/Dockerfile +++ b/linters/html_djlint/Dockerfile @@ -79,10 +79,13 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END #PIPVENV__START -RUN PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir --upgrade pip virtualenv \ - && mkdir -p "/venvs/djlint" && cd "/venvs/djlint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir djlint && deactivate && cd ./../.. \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf && rm -rf /root/.cache -ENV PATH="${PATH}":/venvs/djlint/bin +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/djlint" \ + && cd "/venvs/djlint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip djlint + #PIPVENV__END ############################ diff --git a/linters/html_htmlhint/Dockerfile b/linters/html_htmlhint/Dockerfile index 57eab7de3c1..8b2c3a7a466 100644 --- a/linters/html_htmlhint/Dockerfile +++ b/linters/html_htmlhint/Dockerfile @@ -147,7 +147,7 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ ############################################################################################# #COPY__START - +COPY --link --from=node_modules /node-deps /node-deps #COPY__END ############################################################################################# diff --git a/linters/java_checkstyle/Dockerfile b/linters/java_checkstyle/Dockerfile index ec02973dbec..405f76cab59 100644 --- a/linters/java_checkstyle/Dockerfile +++ b/linters/java_checkstyle/Dockerfile @@ -136,7 +136,7 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ # JAVA installation ENV JAVA_HOME=/usr/lib/jvm/java-11-openjdk ENV PATH="$JAVA_HOME/bin:${PATH}" - +# # checkstyle installation RUN --mount=type=secret,id=GITHUB_TOKEN CHECKSTYLE_LATEST=$(curl -s \ -H "Accept: application/vnd.github+json" \ @@ -148,7 +148,7 @@ RUN --mount=type=secret,id=GITHUB_TOKEN CHECKSTYLE_LATEST=$(curl -s \ && curl --retry 5 --retry-delay 5 -sSL $CHECKSTYLE_LATEST \ --output /usr/bin/checkstyle - +# #OTHER__END ################################ diff --git a/linters/java_pmd/Dockerfile b/linters/java_pmd/Dockerfile index b88cacb541e..c8fc4a44832 100644 --- a/linters/java_pmd/Dockerfile +++ b/linters/java_pmd/Dockerfile @@ -136,7 +136,7 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ # JAVA installation ENV JAVA_HOME=/usr/lib/jvm/java-11-openjdk ENV PATH="$JAVA_HOME/bin:${PATH}" - +# # pmd installation RUN wget --quiet https://github.com/pmd/pmd/releases/download/pmd_releases%2F${PMD_VERSION}/pmd-bin-${PMD_VERSION}.zip && \ unzip pmd-bin-${PMD_VERSION}.zip && \ @@ -144,7 +144,7 @@ RUN wget --quiet https://github.com/pmd/pmd/releases/download/pmd_releases%2F${P mv pmd-bin-${PMD_VERSION} /usr/bin/pmd && \ chmod +x /usr/bin/pmd/bin/run.sh - +# #OTHER__END ################################ diff --git a/linters/javascript_es/Dockerfile b/linters/javascript_es/Dockerfile index fd45b6a7710..26a339baedd 100644 --- a/linters/javascript_es/Dockerfile +++ b/linters/javascript_es/Dockerfile @@ -159,7 +159,7 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ ############################################################################################# #COPY__START - +COPY --link --from=node_modules /node-deps /node-deps #COPY__END ############################################################################################# diff --git a/linters/javascript_prettier/Dockerfile b/linters/javascript_prettier/Dockerfile index 1ec52c59373..021b69cf8c3 100644 --- a/linters/javascript_prettier/Dockerfile +++ b/linters/javascript_prettier/Dockerfile @@ -147,7 +147,7 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ ############################################################################################# #COPY__START - +COPY --link --from=node_modules /node-deps /node-deps #COPY__END ############################################################################################# diff --git a/linters/javascript_standard/Dockerfile b/linters/javascript_standard/Dockerfile index 300717c04ec..0e1d8813393 100644 --- a/linters/javascript_standard/Dockerfile +++ b/linters/javascript_standard/Dockerfile @@ -147,7 +147,7 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ ############################################################################################# #COPY__START - +COPY --link --from=node_modules /node-deps /node-deps #COPY__END ############################################################################################# diff --git a/linters/json_eslint_plugin_jsonc/Dockerfile b/linters/json_eslint_plugin_jsonc/Dockerfile index 0157ee34423..64d002dfaf1 100644 --- a/linters/json_eslint_plugin_jsonc/Dockerfile +++ b/linters/json_eslint_plugin_jsonc/Dockerfile @@ -149,7 +149,7 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ ############################################################################################# #COPY__START - +COPY --link --from=node_modules /node-deps /node-deps #COPY__END ############################################################################################# diff --git a/linters/json_jsonlint/Dockerfile b/linters/json_jsonlint/Dockerfile index 1223207beb3..858a174f1ef 100644 --- a/linters/json_jsonlint/Dockerfile +++ b/linters/json_jsonlint/Dockerfile @@ -147,7 +147,7 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ ############################################################################################# #COPY__START - +COPY --link --from=node_modules /node-deps /node-deps #COPY__END ############################################################################################# diff --git a/linters/json_npm_package_json_lint/Dockerfile b/linters/json_npm_package_json_lint/Dockerfile index af1c6646ab3..bfab601a323 100644 --- a/linters/json_npm_package_json_lint/Dockerfile +++ b/linters/json_npm_package_json_lint/Dockerfile @@ -148,7 +148,7 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ ############################################################################################# #COPY__START - +COPY --link --from=node_modules /node-deps /node-deps #COPY__END ############################################################################################# diff --git a/linters/json_prettier/Dockerfile b/linters/json_prettier/Dockerfile index e94e77f139a..78b1d941d4b 100644 --- a/linters/json_prettier/Dockerfile +++ b/linters/json_prettier/Dockerfile @@ -147,7 +147,7 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ ############################################################################################# #COPY__START - +COPY --link --from=node_modules /node-deps /node-deps #COPY__END ############################################################################################# diff --git a/linters/json_v8r/Dockerfile b/linters/json_v8r/Dockerfile index 880ae8648ca..9bb49b3bd45 100644 --- a/linters/json_v8r/Dockerfile +++ b/linters/json_v8r/Dockerfile @@ -147,7 +147,7 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ ############################################################################################# #COPY__START - +COPY --link --from=node_modules /node-deps /node-deps #COPY__END ############################################################################################# diff --git a/linters/jsx_eslint/Dockerfile b/linters/jsx_eslint/Dockerfile index 8b79ebe2a4d..188efeda003 100644 --- a/linters/jsx_eslint/Dockerfile +++ b/linters/jsx_eslint/Dockerfile @@ -150,7 +150,7 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ ############################################################################################# #COPY__START - +COPY --link --from=node_modules /node-deps /node-deps #COPY__END ############################################################################################# diff --git a/linters/kotlin_ktlint/Dockerfile b/linters/kotlin_ktlint/Dockerfile index 5982c969d22..417d2100b07 100644 --- a/linters/kotlin_ktlint/Dockerfile +++ b/linters/kotlin_ktlint/Dockerfile @@ -138,7 +138,7 @@ RUN curl --retry 5 --retry-delay 5 -sSLO https://github.com/pinterest/ktlint/rel chmod a+x ktlint && \ mv "ktlint" /usr/bin/ - +# #OTHER__END ################################ diff --git a/linters/kubernetes_kubeconform/Dockerfile b/linters/kubernetes_kubeconform/Dockerfile index dfa90f76ce3..19fc6d68209 100644 --- a/linters/kubernetes_kubeconform/Dockerfile +++ b/linters/kubernetes_kubeconform/Dockerfile @@ -132,8 +132,6 @@ COPY --link --from=kubeconform /kubeconform /usr/bin/ ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #OTHER__START -# kubeconform installation -# Managed with COPY --link --from=kubeconform /kubeconform /usr/bin/ #OTHER__END diff --git a/linters/kubernetes_kubescape/Dockerfile b/linters/kubernetes_kubescape/Dockerfile index 6b86fa583a6..8c53d9c3edc 100644 --- a/linters/kubernetes_kubescape/Dockerfile +++ b/linters/kubernetes_kubescape/Dockerfile @@ -139,7 +139,7 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ RUN ln -s /lib/libc.so.6 /usr/lib/libresolv.so.2 && \ curl --retry 5 --retry-delay 5 -sLv https://raw.githubusercontent.com/kubescape/kubescape/master/install.sh | /bin/bash -s -- -v v2.3.6 - +# #OTHER__END ################################ diff --git a/linters/latex_chktex/Dockerfile b/linters/latex_chktex/Dockerfile index 86093c27091..ab76e5f16cb 100644 --- a/linters/latex_chktex/Dockerfile +++ b/linters/latex_chktex/Dockerfile @@ -133,9 +133,8 @@ COPY --link --from=chktex /usr/bin/chktex /usr/bin/ ############################################################################################# #OTHER__START # chktex installation -# 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 ff4df962a8a..13859b5a79f 100644 --- a/linters/lua_luacheck/Dockerfile +++ b/linters/lua_luacheck/Dockerfile @@ -149,7 +149,7 @@ RUN wget --tries=5 https://www.lua.org/ftp/lua-5.3.5.tar.gz -O - -q | tar -xzf - && luarocks install luacheck \ && cd / - +# #OTHER__END ################################ diff --git a/linters/makefile_checkmake/Dockerfile b/linters/makefile_checkmake/Dockerfile index 2c041439841..010bdd1dd77 100644 --- a/linters/makefile_checkmake/Dockerfile +++ b/linters/makefile_checkmake/Dockerfile @@ -132,8 +132,6 @@ COPY --link --from=checkmake /checkmake /usr/bin/checkmake ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #OTHER__START -# checkmake installation -# 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 9cd8e1bf6d7..4c5bdc89571 100644 --- a/linters/markdown_markdown_link_check/Dockerfile +++ b/linters/markdown_markdown_link_check/Dockerfile @@ -147,7 +147,7 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ ############################################################################################# #COPY__START - +COPY --link --from=node_modules /node-deps /node-deps #COPY__END ############################################################################################# diff --git a/linters/markdown_markdown_table_formatter/Dockerfile b/linters/markdown_markdown_table_formatter/Dockerfile index d9f3052797b..7375835b593 100644 --- a/linters/markdown_markdown_table_formatter/Dockerfile +++ b/linters/markdown_markdown_table_formatter/Dockerfile @@ -147,7 +147,7 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ ############################################################################################# #COPY__START - +COPY --link --from=node_modules /node-deps /node-deps #COPY__END ############################################################################################# diff --git a/linters/markdown_markdownlint/Dockerfile b/linters/markdown_markdownlint/Dockerfile index 3846194502a..8a9cb18d6dd 100644 --- a/linters/markdown_markdownlint/Dockerfile +++ b/linters/markdown_markdownlint/Dockerfile @@ -147,7 +147,7 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ ############################################################################################# #COPY__START - +COPY --link --from=node_modules /node-deps /node-deps #COPY__END ############################################################################################# diff --git a/linters/markdown_remark_lint/Dockerfile b/linters/markdown_remark_lint/Dockerfile index eff653e2d4b..b20fa7e60ba 100644 --- a/linters/markdown_remark_lint/Dockerfile +++ b/linters/markdown_remark_lint/Dockerfile @@ -148,7 +148,7 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ ############################################################################################# #COPY__START - +COPY --link --from=node_modules /node-deps /node-deps #COPY__END ############################################################################################# diff --git a/linters/openapi_spectral/Dockerfile b/linters/openapi_spectral/Dockerfile index b13778fd5c2..8329350333a 100644 --- a/linters/openapi_spectral/Dockerfile +++ b/linters/openapi_spectral/Dockerfile @@ -147,7 +147,7 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ ############################################################################################# #COPY__START - +COPY --link --from=node_modules /node-deps /node-deps #COPY__END ############################################################################################# diff --git a/linters/perl_perlcritic/Dockerfile b/linters/perl_perlcritic/Dockerfile index 0b1198cd51a..bfe7b5b1723 100644 --- a/linters/perl_perlcritic/Dockerfile +++ b/linters/perl_perlcritic/Dockerfile @@ -136,7 +136,7 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #OTHER__START # perlcritic installation RUN curl --retry 5 --retry-delay 5 -sL https://cpanmin.us/ | perl - -nq --no-wget Perl::Critic - +# #OTHER__END ################################ diff --git a/linters/php_phpcs/Dockerfile b/linters/php_phpcs/Dockerfile index 58226fe8e87..3b11951a0b8 100644 --- a/linters/php_phpcs/Dockerfile +++ b/linters/php_phpcs/Dockerfile @@ -159,11 +159,11 @@ RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GI && rm phive.phar.asc \ && update-alternatives --install /usr/bin/php php /usr/bin/php81 110 - +# # 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 - +# #OTHER__END ################################ diff --git a/linters/php_phplint/Dockerfile b/linters/php_phplint/Dockerfile index 227bb21356e..31a045cec49 100644 --- a/linters/php_phplint/Dockerfile +++ b/linters/php_phplint/Dockerfile @@ -159,11 +159,11 @@ RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GI && rm phive.phar.asc \ && update-alternatives --install /usr/bin/php php /usr/bin/php81 110 - +# # phplint installation RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GITHUB_TOKEN)" && export GITHUB_AUTH_TOKEN && phive --no-progress install overtrue/phplint --force-accept-unsigned -g - +# #OTHER__END ################################ diff --git a/linters/php_phpstan/Dockerfile b/linters/php_phpstan/Dockerfile index 335fed779b9..69d349fec92 100644 --- a/linters/php_phpstan/Dockerfile +++ b/linters/php_phpstan/Dockerfile @@ -136,7 +136,7 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ ############################################################################################# #COPY__START -COPY --link --from=phpstan /composer/vendor/phpstan/phpstan/phpstan.phar /usr/bin/phpstan +COPY --link --chmod=755 --from=phpstan /composer/vendor/phpstan/phpstan/phpstan.phar /usr/bin/phpstan #COPY__END ############################################################################################# @@ -159,11 +159,7 @@ RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GI && rm phive.phar.asc \ && update-alternatives --install /usr/bin/php php /usr/bin/php81 110 - -# phpstan installation -# Managed with COPY --link --from=phpstan /composer/vendor/phpstan/phpstan/phpstan.phar /usr/bin/phpstan -RUN chmod +x /usr/bin/phpstan - +# #OTHER__END ################################ diff --git a/linters/php_psalm/Dockerfile b/linters/php_psalm/Dockerfile index 1b301614680..62d31508032 100644 --- a/linters/php_psalm/Dockerfile +++ b/linters/php_psalm/Dockerfile @@ -159,11 +159,11 @@ RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GI && rm phive.phar.asc \ && update-alternatives --install /usr/bin/php php /usr/bin/php81 110 - +# # psalm installation RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GITHUB_TOKEN)" && export GITHUB_AUTH_TOKEN && phive --no-progress install psalm -g --trust-gpg-keys 8A03EA3B385DBAA1,12CE0F1D262429A5 - +# #OTHER__END ################################ diff --git a/linters/powershell_powershell/Dockerfile b/linters/powershell_powershell/Dockerfile index bb4bdf5599c..90965ec7a46 100644 --- a/linters/powershell_powershell/Dockerfile +++ b/linters/powershell_powershell/Dockerfile @@ -154,10 +154,10 @@ RUN --mount=type=secret,id=GITHUB_TOKEN case ${TARGETPLATFORM} in \ && ln -sf ${PWSH_DIRECTORY}/pwsh /usr/bin/pwsh \ && chmod +x /usr/bin/pwsh - +# # powershell installation RUN pwsh -c 'Install-Module -Name PSScriptAnalyzer -RequiredVersion ${PSSA_VERSION} -Scope AllUsers -Force' - +# #OTHER__END ################################ diff --git a/linters/powershell_powershell_formatter/Dockerfile b/linters/powershell_powershell_formatter/Dockerfile index db2e004edce..6580a936833 100644 --- a/linters/powershell_powershell_formatter/Dockerfile +++ b/linters/powershell_powershell_formatter/Dockerfile @@ -154,10 +154,10 @@ RUN --mount=type=secret,id=GITHUB_TOKEN case ${TARGETPLATFORM} in \ && ln -sf ${PWSH_DIRECTORY}/pwsh /usr/bin/pwsh \ && chmod +x /usr/bin/pwsh - +# # powershell_formatter installation RUN pwsh -c 'Install-Module -Name PSScriptAnalyzer -RequiredVersion ${PSSA_VERSION} -Scope AllUsers -Force' - +# #OTHER__END ################################ diff --git a/linters/protobuf_protolint/Dockerfile b/linters/protobuf_protolint/Dockerfile index 39f5c1c88b9..e8ac8661ecd 100644 --- a/linters/protobuf_protolint/Dockerfile +++ b/linters/protobuf_protolint/Dockerfile @@ -132,8 +132,6 @@ COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #OTHER__START -# protolint installation -# Managed with COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ #OTHER__END diff --git a/linters/python_bandit/Dockerfile b/linters/python_bandit/Dockerfile index 394e6be9b37..690d3190ba3 100644 --- a/linters/python_bandit/Dockerfile +++ b/linters/python_bandit/Dockerfile @@ -79,10 +79,13 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END #PIPVENV__START -RUN PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir --upgrade pip virtualenv \ - && mkdir -p "/venvs/bandit" && cd "/venvs/bandit" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir bandit bandit_sarif_formatter bandit[toml] && deactivate && cd ./../.. \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf && rm -rf /root/.cache -ENV PATH="${PATH}":/venvs/bandit/bin +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/bandit" \ + && cd "/venvs/bandit" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip bandit bandit_sarif_formatter bandit[toml] + #PIPVENV__END ############################ diff --git a/linters/python_black/Dockerfile b/linters/python_black/Dockerfile index aeb01f614cc..4ce399c1a0a 100644 --- a/linters/python_black/Dockerfile +++ b/linters/python_black/Dockerfile @@ -79,10 +79,13 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END #PIPVENV__START -RUN PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir --upgrade pip virtualenv \ - && mkdir -p "/venvs/black" && cd "/venvs/black" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir black && deactivate && cd ./../.. \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf && rm -rf /root/.cache -ENV PATH="${PATH}":/venvs/black/bin +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/black" \ + && cd "/venvs/black" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip black + #PIPVENV__END ############################ diff --git a/linters/python_flake8/Dockerfile b/linters/python_flake8/Dockerfile index 8e38b3c95ea..50275a91874 100644 --- a/linters/python_flake8/Dockerfile +++ b/linters/python_flake8/Dockerfile @@ -79,10 +79,13 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END #PIPVENV__START -RUN PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir --upgrade pip virtualenv \ - && mkdir -p "/venvs/flake8" && cd "/venvs/flake8" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir flake8 && deactivate && cd ./../.. \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf && rm -rf /root/.cache -ENV PATH="${PATH}":/venvs/flake8/bin +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/flake8" \ + && cd "/venvs/flake8" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip flake8 + #PIPVENV__END ############################ diff --git a/linters/python_isort/Dockerfile b/linters/python_isort/Dockerfile index 0df4fe99efe..693b9380e33 100644 --- a/linters/python_isort/Dockerfile +++ b/linters/python_isort/Dockerfile @@ -79,10 +79,13 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END #PIPVENV__START -RUN PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir --upgrade pip virtualenv \ - && mkdir -p "/venvs/isort" && cd "/venvs/isort" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir isort black && deactivate && cd ./../.. \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf && rm -rf /root/.cache -ENV PATH="${PATH}":/venvs/isort/bin +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/isort" \ + && cd "/venvs/isort" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip isort black + #PIPVENV__END ############################ diff --git a/linters/python_mypy/Dockerfile b/linters/python_mypy/Dockerfile index e42aecfadbf..400ba3ae0ed 100644 --- a/linters/python_mypy/Dockerfile +++ b/linters/python_mypy/Dockerfile @@ -79,10 +79,13 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END #PIPVENV__START -RUN PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir --upgrade pip virtualenv \ - && mkdir -p "/venvs/mypy" && cd "/venvs/mypy" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir mypy && deactivate && cd ./../.. \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf && rm -rf /root/.cache -ENV PATH="${PATH}":/venvs/mypy/bin +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/mypy" \ + && cd "/venvs/mypy" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip mypy + #PIPVENV__END ############################ @@ -137,7 +140,7 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #OTHER__START # mypy installation ENV MYPY_CACHE_DIR=/tmp - +# #OTHER__END ################################ diff --git a/linters/python_pylint/Dockerfile b/linters/python_pylint/Dockerfile index 8c11410e5af..f861a80b05a 100644 --- a/linters/python_pylint/Dockerfile +++ b/linters/python_pylint/Dockerfile @@ -79,10 +79,13 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END #PIPVENV__START -RUN PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir --upgrade pip virtualenv \ - && mkdir -p "/venvs/pylint" && cd "/venvs/pylint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir pylint typing-extensions && deactivate && cd ./../.. \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf && rm -rf /root/.cache -ENV PATH="${PATH}":/venvs/pylint/bin +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/pylint" \ + && cd "/venvs/pylint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip pylint typing-extensions + #PIPVENV__END ############################ diff --git a/linters/python_pyright/Dockerfile b/linters/python_pyright/Dockerfile index 7c29c82252f..156e050d06c 100644 --- a/linters/python_pyright/Dockerfile +++ b/linters/python_pyright/Dockerfile @@ -80,10 +80,13 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END #PIPVENV__START -RUN PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir --upgrade pip virtualenv \ - && mkdir -p "/venvs/pyright" && cd "/venvs/pyright" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir pyright && deactivate && cd ./../.. \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf && rm -rf /root/.cache -ENV PATH="${PATH}":/venvs/pyright/bin +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/pyright" \ + && cd "/venvs/pyright" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip pyright + #PIPVENV__END ############################ diff --git a/linters/python_ruff/Dockerfile b/linters/python_ruff/Dockerfile index f75516cc1b6..5fdac1fd8bc 100644 --- a/linters/python_ruff/Dockerfile +++ b/linters/python_ruff/Dockerfile @@ -11,7 +11,15 @@ ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #FROM__START - +FROM --platform=$BUILDPLATFORM alpine:3 AS fetch-ruff +ARG BUILDARCH +RUN --mount=type=cache,target=/var/cache/apk,id=apk-${BUILDARCH},sharing=locked \ + apk add --update curl +WORKDIR / +ARG TARGETARCH +RUN export DL_LOCATION="https://github.com/charliermarsh/ruff/releases/latest/download/ruff-$([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64" || echo "aarch64")-unknown-linux-musl.tar.gz" \ + && echo "Downloading from ${DL_LOCATION}" \ + && curl --location "${DL_LOCATION}" | tar -xzv #FROM__END ################## @@ -79,10 +87,7 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END #PIPVENV__START -RUN PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir --upgrade pip virtualenv \ - && mkdir -p "/venvs/ruff" && cd "/venvs/ruff" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir ruff && deactivate && cd ./../.. \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf && rm -rf /root/.cache -ENV PATH="${PATH}":/venvs/ruff/bin + #PIPVENV__END ############################ @@ -128,7 +133,7 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ ############################################################################################# #COPY__START - +COPY --link --from=fetch-ruff /ruff /usr/bin/ruff #COPY__END ############################################################################################# diff --git a/linters/r_lintr/Dockerfile b/linters/r_lintr/Dockerfile index 10a8c023b4a..4f849378943 100644 --- a/linters/r_lintr/Dockerfile +++ b/linters/r_lintr/Dockerfile @@ -148,7 +148,7 @@ RUN mkdir -p /home/r-library \ && Rscript -e "install.packages(c('lintr','purrr'), repos = 'https://cloud.r-project.org/')" \ && R -e "install.packages(list.dirs('/home/r-library',recursive = FALSE), repos = NULL, type = 'source')" - +# #OTHER__END ################################ diff --git a/linters/raku_raku/Dockerfile b/linters/raku_raku/Dockerfile index 1ad96b12b8d..710d93e684e 100644 --- a/linters/raku_raku/Dockerfile +++ b/linters/raku_raku/Dockerfile @@ -141,7 +141,7 @@ RUN curl -L https://github.com/nxadm/rakudo-pkg/releases/download/v2020.10-02/ra && /opt/rakudo-pkg/bin/install-zef-as-user ENV PATH="~/.raku/bin:/opt/rakudo-pkg/bin:/opt/rakudo-pkg/share/perl6/site/bin:$PATH" - +# #OTHER__END ################################ diff --git a/linters/repository_checkov/Dockerfile b/linters/repository_checkov/Dockerfile index c16e077b912..5b71853af96 100644 --- a/linters/repository_checkov/Dockerfile +++ b/linters/repository_checkov/Dockerfile @@ -79,10 +79,13 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END #PIPVENV__START -RUN PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir --upgrade pip virtualenv \ - && mkdir -p "/venvs/checkov" && cd "/venvs/checkov" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir packaging checkov && deactivate && cd ./../.. \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf && rm -rf /root/.cache -ENV PATH="${PATH}":/venvs/checkov/bin +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/checkov" \ + && cd "/venvs/checkov" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip packaging checkov + #PIPVENV__END ############################ diff --git a/linters/repository_devskim/Dockerfile b/linters/repository_devskim/Dockerfile index 2997090257d..0847ea8f202 100644 --- a/linters/repository_devskim/Dockerfile +++ b/linters/repository_devskim/Dockerfile @@ -147,7 +147,7 @@ RUN wget --tries=5 -q -O dotnet-install.sh https://dot.net/v1/dotnet-install.sh ENV PATH="${PATH}:/root/.dotnet/tools:/usr/share/dotnet" RUN dotnet tool install --global Microsoft.CST.DevSkim.CLI - +# #OTHER__END ################################ diff --git a/linters/repository_dustilock/Dockerfile b/linters/repository_dustilock/Dockerfile index b688c90e69a..a2f758a4bd1 100644 --- a/linters/repository_dustilock/Dockerfile +++ b/linters/repository_dustilock/Dockerfile @@ -134,8 +134,6 @@ COPY --link --from=dustilock /usr/bin/dustilock /usr/bin/dustilock ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #OTHER__START -# dustilock installation -# Managed with COPY --link --from=dustilock /usr/bin/dustilock /usr/bin/dustilock #OTHER__END diff --git a/linters/repository_gitleaks/Dockerfile b/linters/repository_gitleaks/Dockerfile index 90953ca49f7..eb59cd7b63e 100644 --- a/linters/repository_gitleaks/Dockerfile +++ b/linters/repository_gitleaks/Dockerfile @@ -132,8 +132,6 @@ COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #OTHER__START -# gitleaks installation -# Managed with COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ #OTHER__END diff --git a/linters/repository_grype/Dockerfile b/linters/repository_grype/Dockerfile index 26ec163249d..42555c29a45 100644 --- a/linters/repository_grype/Dockerfile +++ b/linters/repository_grype/Dockerfile @@ -134,7 +134,7 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #OTHER__START # grype installation RUN curl -sSfL https://raw.githubusercontent.com/anchore/grype/main/install.sh | sh -s -- -b /usr/local/bin v0.63.1 - +# #OTHER__END ################################ diff --git a/linters/repository_kics/Dockerfile b/linters/repository_kics/Dockerfile index 13b1c8037ea..9e46534355f 100644 --- a/linters/repository_kics/Dockerfile +++ b/linters/repository_kics/Dockerfile @@ -134,11 +134,9 @@ COPY --from=kics /app/bin/assets /opt/kics/assets/ ############################################################################################# #OTHER__START # kics installation -# 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/ - +# #OTHER__END ################################ diff --git a/linters/repository_secretlint/Dockerfile b/linters/repository_secretlint/Dockerfile index 066fd6ce341..7d296e75c36 100644 --- a/linters/repository_secretlint/Dockerfile +++ b/linters/repository_secretlint/Dockerfile @@ -149,7 +149,7 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ ############################################################################################# #COPY__START - +COPY --link --from=node_modules /node-deps /node-deps #COPY__END ############################################################################################# diff --git a/linters/repository_semgrep/Dockerfile b/linters/repository_semgrep/Dockerfile index 4ca1dfaf9b3..a9a7beb3627 100644 --- a/linters/repository_semgrep/Dockerfile +++ b/linters/repository_semgrep/Dockerfile @@ -79,10 +79,13 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END #PIPVENV__START -RUN PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir --upgrade pip virtualenv \ - && mkdir -p "/venvs/semgrep" && cd "/venvs/semgrep" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir semgrep && deactivate && cd ./../.. \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf && rm -rf /root/.cache -ENV PATH="${PATH}":/venvs/semgrep/bin +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/semgrep" \ + && cd "/venvs/semgrep" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip semgrep + #PIPVENV__END ############################ diff --git a/linters/repository_syft/Dockerfile b/linters/repository_syft/Dockerfile index 0dfbfb5e32f..59028ac8c5b 100644 --- a/linters/repository_syft/Dockerfile +++ b/linters/repository_syft/Dockerfile @@ -134,7 +134,7 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #OTHER__START # syft installation RUN curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b /usr/local/bin - +# #OTHER__END ################################ diff --git a/linters/repository_trivy/Dockerfile b/linters/repository_trivy/Dockerfile index bb28e568a3d..0b8733043bc 100644 --- a/linters/repository_trivy/Dockerfile +++ b/linters/repository_trivy/Dockerfile @@ -135,7 +135,7 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ # trivy installation RUN wget --tries=5 -q -O - https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin - +# #OTHER__END ################################ diff --git a/linters/repository_trivy_sbom/Dockerfile b/linters/repository_trivy_sbom/Dockerfile index 7b0a1fabab1..a92a94fc486 100644 --- a/linters/repository_trivy_sbom/Dockerfile +++ b/linters/repository_trivy_sbom/Dockerfile @@ -135,7 +135,7 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ # trivy-sbom installation RUN wget --tries=5 -q -O - https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin - +# #OTHER__END ################################ diff --git a/linters/repository_trufflehog/Dockerfile b/linters/repository_trufflehog/Dockerfile index 628ac9522ab..4f288e47340 100644 --- a/linters/repository_trufflehog/Dockerfile +++ b/linters/repository_trufflehog/Dockerfile @@ -132,8 +132,6 @@ COPY --link --from=trufflehog /usr/bin/trufflehog /usr/bin/ ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #OTHER__START -# trufflehog installation -# Managed with COPY --link --from=trufflehog /usr/bin/trufflehog /usr/bin/ #OTHER__END diff --git a/linters/rst_rst_lint/Dockerfile b/linters/rst_rst_lint/Dockerfile index d68ef83b5e6..8a565576b8f 100644 --- a/linters/rst_rst_lint/Dockerfile +++ b/linters/rst_rst_lint/Dockerfile @@ -79,10 +79,13 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END #PIPVENV__START -RUN PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir --upgrade pip virtualenv \ - && mkdir -p "/venvs/rst-lint" && cd "/venvs/rst-lint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir restructuredtext_lint && deactivate && cd ./../.. \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf && rm -rf /root/.cache -ENV PATH="${PATH}":/venvs/rst-lint/bin +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/rst-lint" \ + && cd "/venvs/rst-lint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip restructuredtext_lint + #PIPVENV__END ############################ diff --git a/linters/rst_rstcheck/Dockerfile b/linters/rst_rstcheck/Dockerfile index 31eda4153dc..42a5129fbeb 100644 --- a/linters/rst_rstcheck/Dockerfile +++ b/linters/rst_rstcheck/Dockerfile @@ -79,10 +79,13 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END #PIPVENV__START -RUN PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir --upgrade pip virtualenv \ - && mkdir -p "/venvs/rstcheck" && cd "/venvs/rstcheck" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir rstcheck && deactivate && cd ./../.. \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf && rm -rf /root/.cache -ENV PATH="${PATH}":/venvs/rstcheck/bin +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/rstcheck" \ + && cd "/venvs/rstcheck" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip rstcheck + #PIPVENV__END ############################ diff --git a/linters/rst_rstfmt/Dockerfile b/linters/rst_rstfmt/Dockerfile index b9426ed193d..7c0cce494c7 100644 --- a/linters/rst_rstfmt/Dockerfile +++ b/linters/rst_rstfmt/Dockerfile @@ -79,10 +79,13 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END #PIPVENV__START -RUN PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir --upgrade pip virtualenv \ - && mkdir -p "/venvs/rstfmt" && cd "/venvs/rstfmt" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir rstfmt && deactivate && cd ./../.. \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf && rm -rf /root/.cache -ENV PATH="${PATH}":/venvs/rstfmt/bin +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/rstfmt" \ + && cd "/venvs/rstfmt" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip rstfmt + #PIPVENV__END ############################ diff --git a/linters/rust_clippy/Dockerfile b/linters/rust_clippy/Dockerfile index 61ca586dac4..64a05926222 100644 --- a/linters/rust_clippy/Dockerfile +++ b/linters/rust_clippy/Dockerfile @@ -11,6 +11,41 @@ ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #FROM__START +FROM --platform=$BUILDPLATFORM alpine:3 AS cargo-build +WORKDIR /cargo +ENV HOME=/cargo +USER 0 +RUN --mount=type=cache,target=/var/cache/apk,id=apk-${BUILDARCH},sharing=locked \ + apk add --update \ + gcc \ + rustup \ + bash \ + git \ + musl-dev \ + llvm \ + clang \ + curl +RUN curl --location "https://github.com/cargo-bins/cargo-binstall/releases/latest/download/cargo-binstall-$([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64" || echo "aarch64")-unknown-linux-musl.tgz" | tar -xzv \ + && mkdir -p /cargo/.cargo/bin \ + && mv cargo-binstall /cargo/.cargo/bin \ + && chown -R 63425:63425 /cargo +USER 63425 +ENV CC_aarch64_unknown_linux_musl=clang \ + AR_aarch64_unknown_linux_musl=llvm-ar \ + CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_RUSTFLAGS="-Clink-self-contained=yes -Clinker=rust-lld" \ + CC_x86_64_unknown_linux_musl=clang \ + AR_x86_64_unknown_linux_musl=llvm-ar \ + CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_RUSTFLAGS="-Clink-self-contained=yes -Clinker=rust-lld" +ARG TARGETARCH +RUN rustup-init -y --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") + +RUN --mount=type=cache,id=cargo-${TARGETARCH},sharing=locked,target=/cargo/.cargo/registry/,uid=63425 \ + . /cargo/.cargo/env \ + && cargo binstall --no-confirm --no-symlinks --root /tmp --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") + +FROM scratch AS cargo +COPY --link --from=cargo-build /tmp/bin/* /bin/ +RUN ["/bin/", "--help"] #FROM__END @@ -129,7 +164,7 @@ ENV PATH="/root/.cargo/bin:${PATH}" ############################################################################################# #COPY__START - +COPY --link --from=cargo /bin/* /usr/bin/ #COPY__END ############################################################################################# diff --git a/linters/salesforce_sfdx_scanner_apex/Dockerfile b/linters/salesforce_sfdx_scanner_apex/Dockerfile index b84d3d075ad..2858f4ee9d3 100644 --- a/linters/salesforce_sfdx_scanner_apex/Dockerfile +++ b/linters/salesforce_sfdx_scanner_apex/Dockerfile @@ -148,7 +148,7 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ ############################################################################################# #COPY__START - +COPY --link --from=node_modules /node-deps /node-deps #COPY__END ############################################################################################# @@ -161,13 +161,13 @@ ENV PATH="$JAVA_HOME/bin:${PATH}" RUN echo y|sfdx plugins:install sfdx-hardis \ && npm cache clean --force || true \ && rm -rf /root/.npm/_cacache \ - +# # sfdx-scanner-apex installation && sfdx plugins:install @salesforce/sfdx-scanner \ && npm cache clean --force || true \ && rm -rf /root/.npm/_cacache - +# #OTHER__END ################################ diff --git a/linters/salesforce_sfdx_scanner_aura/Dockerfile b/linters/salesforce_sfdx_scanner_aura/Dockerfile index a5fc5e4da93..eaa7a086e62 100644 --- a/linters/salesforce_sfdx_scanner_aura/Dockerfile +++ b/linters/salesforce_sfdx_scanner_aura/Dockerfile @@ -148,7 +148,7 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ ############################################################################################# #COPY__START - +COPY --link --from=node_modules /node-deps /node-deps #COPY__END ############################################################################################# @@ -161,13 +161,13 @@ ENV PATH="$JAVA_HOME/bin:${PATH}" RUN echo y|sfdx plugins:install sfdx-hardis \ && npm cache clean --force || true \ && rm -rf /root/.npm/_cacache \ - +# # sfdx-scanner-aura installation && sfdx plugins:install @salesforce/sfdx-scanner \ && npm cache clean --force || true \ && rm -rf /root/.npm/_cacache - +# #OTHER__END ################################ diff --git a/linters/salesforce_sfdx_scanner_lwc/Dockerfile b/linters/salesforce_sfdx_scanner_lwc/Dockerfile index 686b729d30f..45b669dc694 100644 --- a/linters/salesforce_sfdx_scanner_lwc/Dockerfile +++ b/linters/salesforce_sfdx_scanner_lwc/Dockerfile @@ -148,7 +148,7 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ ############################################################################################# #COPY__START - +COPY --link --from=node_modules /node-deps /node-deps #COPY__END ############################################################################################# @@ -161,13 +161,13 @@ ENV PATH="$JAVA_HOME/bin:${PATH}" RUN echo y|sfdx plugins:install sfdx-hardis \ && npm cache clean --force || true \ && rm -rf /root/.npm/_cacache \ - +# # sfdx-scanner-lwc installation && sfdx plugins:install @salesforce/sfdx-scanner \ && npm cache clean --force || true \ && rm -rf /root/.npm/_cacache - +# #OTHER__END ################################ diff --git a/linters/scala_scalafix/Dockerfile b/linters/scala_scalafix/Dockerfile index fef913b0cf6..b9fc35b6ca5 100644 --- a/linters/scala_scalafix/Dockerfile +++ b/linters/scala_scalafix/Dockerfile @@ -126,19 +126,13 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ ############################################################################################# #COPY__START - +COPY --link --from=build-platform /usr/bin/scalafix /usr/bin/ #COPY__END ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #OTHER__START -# SCALA installation -RUN curl --retry-all-errors --retry 10 -fLo coursier https://git.io/coursier-cli && \ - chmod +x coursier \ - -# scalafix installation - && ./coursier install scalafix --quiet --install-dir /usr/bin && rm -rf /root/.cache #OTHER__END diff --git a/linters/snakemake_lint/Dockerfile b/linters/snakemake_lint/Dockerfile index 980d9fc2c30..ebd51ef2169 100644 --- a/linters/snakemake_lint/Dockerfile +++ b/linters/snakemake_lint/Dockerfile @@ -79,10 +79,13 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END #PIPVENV__START -RUN PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir --upgrade pip virtualenv \ - && mkdir -p "/venvs/snakemake" && cd "/venvs/snakemake" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir snakemake && deactivate && cd ./../.. \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf && rm -rf /root/.cache -ENV PATH="${PATH}":/venvs/snakemake/bin +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/snakemake" \ + && cd "/venvs/snakemake" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakemake + #PIPVENV__END ############################ diff --git a/linters/snakemake_snakefmt/Dockerfile b/linters/snakemake_snakefmt/Dockerfile index 87d4191b499..c4f471f3820 100644 --- a/linters/snakemake_snakefmt/Dockerfile +++ b/linters/snakemake_snakefmt/Dockerfile @@ -79,10 +79,13 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END #PIPVENV__START -RUN PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir --upgrade pip virtualenv \ - && mkdir -p "/venvs/snakefmt" && cd "/venvs/snakefmt" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir snakefmt && deactivate && cd ./../.. \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf && rm -rf /root/.cache -ENV PATH="${PATH}":/venvs/snakefmt/bin +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/snakefmt" \ + && cd "/venvs/snakefmt" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakefmt + #PIPVENV__END ############################ diff --git a/linters/spell_cspell/Dockerfile b/linters/spell_cspell/Dockerfile index c57ce66be68..9cccb56c6ed 100644 --- a/linters/spell_cspell/Dockerfile +++ b/linters/spell_cspell/Dockerfile @@ -147,7 +147,7 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ ############################################################################################# #COPY__START - +COPY --link --from=node_modules /node-deps /node-deps #COPY__END ############################################################################################# diff --git a/linters/spell_lychee/Dockerfile b/linters/spell_lychee/Dockerfile index 62c0f8a5c1f..a5cc011a991 100644 --- a/linters/spell_lychee/Dockerfile +++ b/linters/spell_lychee/Dockerfile @@ -132,8 +132,6 @@ COPY --link --from=lychee /usr/local/bin/lychee /usr/bin/ ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #OTHER__START -# lychee installation -# Managed with COPY --link --from=lychee /usr/local/bin/lychee /usr/bin/ #OTHER__END diff --git a/linters/spell_proselint/Dockerfile b/linters/spell_proselint/Dockerfile index d48a1335f06..7becc499dc6 100644 --- a/linters/spell_proselint/Dockerfile +++ b/linters/spell_proselint/Dockerfile @@ -79,10 +79,13 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END #PIPVENV__START -RUN PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir --upgrade pip virtualenv \ - && mkdir -p "/venvs/proselint" && cd "/venvs/proselint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir proselint && deactivate && cd ./../.. \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf && rm -rf /root/.cache -ENV PATH="${PATH}":/venvs/proselint/bin +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/proselint" \ + && cd "/venvs/proselint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip proselint + #PIPVENV__END ############################ diff --git a/linters/spell_vale/Dockerfile b/linters/spell_vale/Dockerfile index faef38fa7b6..127756ed210 100644 --- a/linters/spell_vale/Dockerfile +++ b/linters/spell_vale/Dockerfile @@ -132,8 +132,6 @@ COPY --link --from=vale /bin/vale /bin/vale ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #OTHER__START -# vale installation -# Managed with COPY --link --from=vale /bin/vale /bin/vale #OTHER__END diff --git a/linters/sql_sql_lint/Dockerfile b/linters/sql_sql_lint/Dockerfile index 1bf55ac443a..17c5d5cf431 100644 --- a/linters/sql_sql_lint/Dockerfile +++ b/linters/sql_sql_lint/Dockerfile @@ -147,7 +147,7 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ ############################################################################################# #COPY__START - +COPY --link --from=node_modules /node-deps /node-deps #COPY__END ############################################################################################# diff --git a/linters/sql_sqlfluff/Dockerfile b/linters/sql_sqlfluff/Dockerfile index 1b7c9324899..0aa8c0b064a 100644 --- a/linters/sql_sqlfluff/Dockerfile +++ b/linters/sql_sqlfluff/Dockerfile @@ -79,10 +79,13 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END #PIPVENV__START -RUN PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir --upgrade pip virtualenv \ - && mkdir -p "/venvs/sqlfluff" && cd "/venvs/sqlfluff" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir sqlfluff && deactivate && cd ./../.. \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf && rm -rf /root/.cache -ENV PATH="${PATH}":/venvs/sqlfluff/bin +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/sqlfluff" \ + && cd "/venvs/sqlfluff" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip sqlfluff + #PIPVENV__END ############################ diff --git a/linters/sql_tsqllint/Dockerfile b/linters/sql_tsqllint/Dockerfile index 0cebda59390..6175ab06176 100644 --- a/linters/sql_tsqllint/Dockerfile +++ b/linters/sql_tsqllint/Dockerfile @@ -147,7 +147,7 @@ RUN wget --tries=5 -q -O dotnet-install.sh https://dot.net/v1/dotnet-install.sh ENV PATH="${PATH}:/root/.dotnet/tools:/usr/share/dotnet" RUN dotnet tool install --global TSQLLint - +# #OTHER__END ################################ diff --git a/linters/tekton_tekton_lint/Dockerfile b/linters/tekton_tekton_lint/Dockerfile index 484ad27c8cb..ae7f9be498f 100644 --- a/linters/tekton_tekton_lint/Dockerfile +++ b/linters/tekton_tekton_lint/Dockerfile @@ -147,7 +147,7 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ ############################################################################################# #COPY__START - +COPY --link --from=node_modules /node-deps /node-deps #COPY__END ############################################################################################# diff --git a/linters/terraform_terraform_fmt/Dockerfile b/linters/terraform_terraform_fmt/Dockerfile index f8febcad668..f2b693279b7 100644 --- a/linters/terraform_terraform_fmt/Dockerfile +++ b/linters/terraform_terraform_fmt/Dockerfile @@ -132,8 +132,6 @@ COPY --link --from=terragrunt /bin/terraform /usr/bin/ ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #OTHER__START -# terraform-fmt installation -# 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 261d0a74e0d..a3fa6e848f2 100644 --- a/linters/terraform_terragrunt/Dockerfile +++ b/linters/terraform_terragrunt/Dockerfile @@ -132,8 +132,6 @@ COPY --link --from=terragrunt /usr/local/bin/terragrunt /usr/bin/ ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #OTHER__START -# terragrunt installation -# 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 4cd0b8f69a9..6d767a52043 100644 --- a/linters/terraform_terrascan/Dockerfile +++ b/linters/terraform_terrascan/Dockerfile @@ -132,8 +132,6 @@ COPY --link --from=terrascan /go/bin/terrascan /usr/bin/ ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #OTHER__START -# terrascan installation -# 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 1cb8bd221fc..b2cf2dd52f6 100644 --- a/linters/terraform_tflint/Dockerfile +++ b/linters/terraform_tflint/Dockerfile @@ -132,8 +132,6 @@ COPY --link --from=tflint /usr/local/bin/tflint /usr/bin/ ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #OTHER__START -# tflint installation -# 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 c69c8d70f10..68d6f02a720 100644 --- a/linters/tsx_eslint/Dockerfile +++ b/linters/tsx_eslint/Dockerfile @@ -159,7 +159,7 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ ############################################################################################# #COPY__START - +COPY --link --from=node_modules /node-deps /node-deps #COPY__END ############################################################################################# diff --git a/linters/typescript_es/Dockerfile b/linters/typescript_es/Dockerfile index 7e353d1c420..8443a8507db 100644 --- a/linters/typescript_es/Dockerfile +++ b/linters/typescript_es/Dockerfile @@ -162,7 +162,7 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ ############################################################################################# #COPY__START - +COPY --link --from=node_modules /node-deps /node-deps #COPY__END ############################################################################################# diff --git a/linters/typescript_prettier/Dockerfile b/linters/typescript_prettier/Dockerfile index 8b3e5649980..b2c203d648b 100644 --- a/linters/typescript_prettier/Dockerfile +++ b/linters/typescript_prettier/Dockerfile @@ -148,7 +148,7 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ ############################################################################################# #COPY__START - +COPY --link --from=node_modules /node-deps /node-deps #COPY__END ############################################################################################# diff --git a/linters/typescript_standard/Dockerfile b/linters/typescript_standard/Dockerfile index 5c3e9b47c95..5be39aad961 100644 --- a/linters/typescript_standard/Dockerfile +++ b/linters/typescript_standard/Dockerfile @@ -148,7 +148,7 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ ############################################################################################# #COPY__START - +COPY --link --from=node_modules /node-deps /node-deps #COPY__END ############################################################################################# diff --git a/linters/vbdotnet_dotnet_format/Dockerfile b/linters/vbdotnet_dotnet_format/Dockerfile index c43c7ff5811..c2151240ed8 100644 --- a/linters/vbdotnet_dotnet_format/Dockerfile +++ b/linters/vbdotnet_dotnet_format/Dockerfile @@ -146,7 +146,7 @@ RUN wget --tries=5 -q -O dotnet-install.sh https://dot.net/v1/dotnet-install.sh && ./dotnet-install.sh --install-dir /usr/share/dotnet -channel 6.0 -version latest ENV PATH="${PATH}:/root/.dotnet/tools:/usr/share/dotnet" - +# #OTHER__END ################################ diff --git a/linters/yaml_prettier/Dockerfile b/linters/yaml_prettier/Dockerfile index 78448c9048d..de30c4f9f8b 100644 --- a/linters/yaml_prettier/Dockerfile +++ b/linters/yaml_prettier/Dockerfile @@ -147,7 +147,7 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ ############################################################################################# #COPY__START - +COPY --link --from=node_modules /node-deps /node-deps #COPY__END ############################################################################################# diff --git a/linters/yaml_v8r/Dockerfile b/linters/yaml_v8r/Dockerfile index 72e9b78d9ec..b86a13fbcda 100644 --- a/linters/yaml_v8r/Dockerfile +++ b/linters/yaml_v8r/Dockerfile @@ -147,7 +147,7 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ ############################################################################################# #COPY__START - +COPY --link --from=node_modules /node-deps /node-deps #COPY__END ############################################################################################# diff --git a/linters/yaml_yamllint/Dockerfile b/linters/yaml_yamllint/Dockerfile index 6445adb9da5..396138c42a9 100644 --- a/linters/yaml_yamllint/Dockerfile +++ b/linters/yaml_yamllint/Dockerfile @@ -79,10 +79,13 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END #PIPVENV__START -RUN PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir --upgrade pip virtualenv \ - && mkdir -p "/venvs/yamllint" && cd "/venvs/yamllint" && virtualenv . && source bin/activate && PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir yamllint && deactivate && cd ./../.. \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf && rm -rf /root/.cache -ENV PATH="${PATH}":/venvs/yamllint/bin +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/yamllint" \ + && cd "/venvs/yamllint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip yamllint + #PIPVENV__END ############################ From e19e90ce9b4db7540d9dd18581b8484de7548b49 Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Wed, 19 Jul 2023 11:37:13 -0500 Subject: [PATCH 074/105] Reverting some changes broken by rebase --- .github/workflows/deploy-DEV.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy-DEV.yml b/.github/workflows/deploy-DEV.yml index f63f99fe50b..6a6c3171335 100644 --- a/.github/workflows/deploy-DEV.yml +++ b/.github/workflows/deploy-DEV.yml @@ -49,7 +49,12 @@ jobs: build: name: Tests + Deploy Docker Image - DEV # Prevent duplicate run from happening when a forked push is committed - if: (github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository) && !contains(github.event.head_commit.message, 'skip deploy') + if: | + contains(github.event.head_commit.message, 'quick build') || + ( + (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository) || + (github.event_name == 'push' && github.repository != 'oxsecurity/megalinter') + ) uses: ./.github/workflows/-build-docker.yml with: tagTemplate: "test-${{ github.actor }}-${BRANCH_NAME}" @@ -113,8 +118,8 @@ jobs: TEST_KEYWORDS_TO_USE="" fi fi - - docker run $CI_ENV -e TEST_CASE_RUN=true -e OUTPUT_FORMAT=text -e OUTPUT_FOLDER=${{ github.sha }} -e OUTPUT_DETAIL=detailed -e GITHUB_SHA=${{ github.sha }} -e GITHUB_REPOSITORY=${GITHUB_REPOSITORY} -e GITHUB_BRANCH=${GITHUB_BRANCH} -e PAT="${{ secrets.PAT }}" -e TEST_KEYWORDS="${TEST_KEYWORDS_TO_USE}" -e MEGALINTER_VOLUME_ROOT="${GITHUB_WORKSPACE}" -v "/var/run/docker.sock:/var/run/docker.sock:rw" -v ${GITHUB_WORKSPACE}:/tmp/lint oxsecurity/megalinter:${{ steps.image_tag.outputs.tag }} + docker image ls + docker run $CI_ENV -e TEST_CASE_RUN=true -e OUTPUT_FORMAT=text -e OUTPUT_FOLDER=${{ github.sha }} -e OUTPUT_DETAIL=detailed -e GITHUB_SHA=${{ github.sha }} -e GITHUB_REPOSITORY=${GITHUB_REPOSITORY} -e GITHUB_BRANCH=${GITHUB_BRANCH} -e GITHUB_TOKEN="${{ secrets.GITHUB_TOKEN }}" -e TEST_KEYWORDS="${TEST_KEYWORDS_TO_USE}" -e MEGALINTER_VOLUME_ROOT="${GITHUB_WORKSPACE}" -v "/var/run/docker.sock:/var/run/docker.sock:rw" -v ${GITHUB_WORKSPACE}:/tmp/lint oxsecurity/megalinter:${{ steps.image_tag.outputs.tag }} timeout-minutes: 90 ##################################### From c547732311f83ea0f6800fa2d6b29a903ba49aef Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Wed, 19 Jul 2023 11:38:04 -0500 Subject: [PATCH 075/105] Reverting some changes broken by rebase --- .github/workflows/deploy-DEV.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/deploy-DEV.yml b/.github/workflows/deploy-DEV.yml index 6a6c3171335..ea959bf7660 100644 --- a/.github/workflows/deploy-DEV.yml +++ b/.github/workflows/deploy-DEV.yml @@ -50,11 +50,7 @@ jobs: name: Tests + Deploy Docker Image - DEV # Prevent duplicate run from happening when a forked push is committed if: | - contains(github.event.head_commit.message, 'quick build') || - ( - (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository) || - (github.event_name == 'push' && github.repository != 'oxsecurity/megalinter') - ) + (github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository) && !contains(github.event.head_commit.message, 'skip deploy') uses: ./.github/workflows/-build-docker.yml with: tagTemplate: "test-${{ github.actor }}-${BRANCH_NAME}" From 35eb8c944ca9843f4744c2c13273fc4c0cbd672c Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Wed, 19 Jul 2023 11:38:10 -0500 Subject: [PATCH 076/105] Reverting some changes broken by rebase --- .github/workflows/deploy-DEV.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/deploy-DEV.yml b/.github/workflows/deploy-DEV.yml index ea959bf7660..b2e4c87d49c 100644 --- a/.github/workflows/deploy-DEV.yml +++ b/.github/workflows/deploy-DEV.yml @@ -49,8 +49,7 @@ jobs: build: name: Tests + Deploy Docker Image - DEV # Prevent duplicate run from happening when a forked push is committed - if: | - (github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository) && !contains(github.event.head_commit.message, 'skip deploy') + if: (github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository) && !contains(github.event.head_commit.message, 'skip deploy') uses: ./.github/workflows/-build-docker.yml with: tagTemplate: "test-${{ github.actor }}-${BRANCH_NAME}" From 1aa3fa84c8fa3df0b631ec081cd4d1914a19e2fa Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Wed, 19 Jul 2023 11:42:46 -0500 Subject: [PATCH 077/105] Fixing CI --- .github/workflows/-build-docker.yml | 4 ++-- .github/workflows/deploy-DEV.yml | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/-build-docker.yml b/.github/workflows/-build-docker.yml index 628d2d49f24..37bd0d8c415 100644 --- a/.github/workflows/-build-docker.yml +++ b/.github/workflows/-build-docker.yml @@ -115,8 +115,8 @@ jobs: BUILD_DATE=${{ env.BUILD_DATE }} BUILD_REVISION=${{ github.sha }} BUILD_VERSION=alpha - load: false - push: true + load: ${{ inputs.load }} + push: ${{ inputs.push }} secrets: | GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/deploy-DEV.yml b/.github/workflows/deploy-DEV.yml index b2e4c87d49c..33b69bc4a44 100644 --- a/.github/workflows/deploy-DEV.yml +++ b/.github/workflows/deploy-DEV.yml @@ -56,6 +56,7 @@ jobs: shouldLoginDockerHub: ${{ (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) || (github.event_name == 'push' && github.repository == 'oxsecurity/megalinter') }} shouldLoginGithub: false dockerfile: ${{ (contains(github.event.head_commit.message, 'quick build') && 'Dockerfile-quick') || 'Dockerfile' }} + load: false push: ${{ (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) || (github.event_name == 'push' && github.repository == 'oxsecurity/megalinter') }} imageName: megalinter test: From c329665da36585587f2ab99fe8b4a7c89254f098 Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Wed, 19 Jul 2023 11:43:43 -0500 Subject: [PATCH 078/105] Fixing CI --- .github/workflows/deploy-DEV.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-DEV.yml b/.github/workflows/deploy-DEV.yml index 33b69bc4a44..8d8d051c597 100644 --- a/.github/workflows/deploy-DEV.yml +++ b/.github/workflows/deploy-DEV.yml @@ -56,8 +56,8 @@ jobs: shouldLoginDockerHub: ${{ (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) || (github.event_name == 'push' && github.repository == 'oxsecurity/megalinter') }} shouldLoginGithub: false dockerfile: ${{ (contains(github.event.head_commit.message, 'quick build') && 'Dockerfile-quick') || 'Dockerfile' }} - load: false - push: ${{ (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) || (github.event_name == 'push' && github.repository == 'oxsecurity/megalinter') }} + load: true + push: false imageName: megalinter test: name: Test From 43c6cd38efd76e6b06c23550a5c9bb750bf83f85 Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Wed, 19 Jul 2023 11:44:08 -0500 Subject: [PATCH 079/105] Fixing CI --- .github/workflows/deploy-DEV.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/deploy-DEV.yml b/.github/workflows/deploy-DEV.yml index 8d8d051c597..dd36a23d6b2 100644 --- a/.github/workflows/deploy-DEV.yml +++ b/.github/workflows/deploy-DEV.yml @@ -59,6 +59,7 @@ jobs: load: true push: false imageName: megalinter + workerImageName: megalinter-worker test: name: Test runs-on: ubuntu-latest From bc06bddef902f5df0a594340f0ae22b560e8763a Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Wed, 19 Jul 2023 11:49:02 -0500 Subject: [PATCH 080/105] Fixing CI --- .github/workflows/-build-docker.yml | 7 ++----- .github/workflows/deploy-DEV.yml | 1 - 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/-build-docker.yml b/.github/workflows/-build-docker.yml index 37bd0d8c415..5e7ebeaca6a 100644 --- a/.github/workflows/-build-docker.yml +++ b/.github/workflows/-build-docker.yml @@ -15,9 +15,6 @@ on: dockerfile: required: true type: string - load: - required: true - type: boolean push: required: true type: boolean @@ -96,7 +93,7 @@ jobs: BUILD_DATE=${{ env.BUILD_DATE }} BUILD_REVISION=${{ github.sha }} BUILD_VERSION=alpha - load: ${{ inputs.load }} + load: false push: ${{ inputs.push }} outputs: ${{ (!inputs.push && 'type=oci,dest=image.tar') || '' }} @@ -115,7 +112,7 @@ jobs: BUILD_DATE=${{ env.BUILD_DATE }} BUILD_REVISION=${{ github.sha }} BUILD_VERSION=alpha - load: ${{ inputs.load }} + load: false push: ${{ inputs.push }} secrets: | diff --git a/.github/workflows/deploy-DEV.yml b/.github/workflows/deploy-DEV.yml index dd36a23d6b2..9c94b0cc64a 100644 --- a/.github/workflows/deploy-DEV.yml +++ b/.github/workflows/deploy-DEV.yml @@ -56,7 +56,6 @@ jobs: shouldLoginDockerHub: ${{ (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) || (github.event_name == 'push' && github.repository == 'oxsecurity/megalinter') }} shouldLoginGithub: false dockerfile: ${{ (contains(github.event.head_commit.message, 'quick build') && 'Dockerfile-quick') || 'Dockerfile' }} - load: true push: false imageName: megalinter workerImageName: megalinter-worker From ab071fce203dab64f38df53aff2aae4441e41ea5 Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Wed, 19 Jul 2023 12:02:50 -0500 Subject: [PATCH 081/105] Pull in dockerfile changes lost in rebase --- Dockerfile | 574 +++++++++++------- flavors/ci_light/Dockerfile | 243 +++++--- flavors/cupcake/Dockerfile | 491 +++++++++------ flavors/documentation/Dockerfile | 392 +++++++----- flavors/dotnet/Dockerfile | 423 ++++++++----- flavors/dotnetweb/Dockerfile | 463 ++++++++------ flavors/go/Dockerfile | 396 +++++++----- flavors/java/Dockerfile | 394 +++++++----- flavors/javascript/Dockerfile | 432 +++++++------ flavors/php/Dockerfile | 404 +++++++----- flavors/python/Dockerfile | 408 ++++++++----- flavors/ruby/Dockerfile | 390 +++++++----- flavors/rust/Dockerfile | 396 +++++++----- flavors/salesforce/Dockerfile | 396 +++++++----- flavors/security/Dockerfile | 298 +++++---- flavors/swift/Dockerfile | 394 +++++++----- flavors/terraform/Dockerfile | 402 +++++++----- linters/action_actionlint/Dockerfile | 157 +++-- linters/ansible_ansible_lint/Dockerfile | 170 ++++-- linters/arm_arm_ttk/Dockerfile | 151 +++-- linters/bash_exec/Dockerfile | 155 +++-- linters/bash_shellcheck/Dockerfile | 151 +++-- linters/bash_shfmt/Dockerfile | 151 +++-- linters/bicep_bicep_linter/Dockerfile | 151 +++-- linters/c_cpplint/Dockerfile | 170 ++++-- linters/clojure_clj_kondo/Dockerfile | 151 +++-- linters/clojure_cljstyle/Dockerfile | 151 +++-- linters/cloudformation_cfn_lint/Dockerfile | 170 ++++-- linters/coffee_coffeelint/Dockerfile | 190 ++++-- linters/copypaste_jscpd/Dockerfile | 190 ++++-- linters/cpp_cpplint/Dockerfile | 170 ++++-- linters/csharp_csharpier/Dockerfile | 151 +++-- linters/csharp_dotnet_format/Dockerfile | 151 +++-- linters/css_scss_lint/Dockerfile | 151 +++-- linters/css_stylelint/Dockerfile | 196 ++++-- linters/dart_dartanalyzer/Dockerfile | 151 +++-- linters/dockerfile_hadolint/Dockerfile | 151 +++-- .../Dockerfile | 151 +++-- linters/env_dotenv_linter/Dockerfile | 151 +++-- linters/gherkin_gherkin_lint/Dockerfile | 190 ++++-- linters/go_golangci_lint/Dockerfile | 151 +++-- linters/go_revive/Dockerfile | 151 +++-- .../graphql_graphql_schema_linter/Dockerfile | 192 ++++-- linters/groovy_npm_groovy_lint/Dockerfile | 190 ++++-- linters/html_djlint/Dockerfile | 170 ++++-- linters/html_htmlhint/Dockerfile | 190 ++++-- linters/java_checkstyle/Dockerfile | 151 +++-- linters/java_pmd/Dockerfile | 151 +++-- linters/javascript_es/Dockerfile | 214 ++++--- linters/javascript_prettier/Dockerfile | 190 ++++-- linters/javascript_standard/Dockerfile | 190 ++++-- linters/json_eslint_plugin_jsonc/Dockerfile | 194 ++++-- linters/json_jsonlint/Dockerfile | 190 ++++-- linters/json_npm_package_json_lint/Dockerfile | 192 ++++-- linters/json_prettier/Dockerfile | 190 ++++-- linters/json_v8r/Dockerfile | 190 ++++-- linters/jsx_eslint/Dockerfile | 196 ++++-- linters/kotlin_ktlint/Dockerfile | 151 +++-- linters/kubernetes_helm/Dockerfile | 151 +++-- linters/kubernetes_kubeconform/Dockerfile | 151 +++-- linters/kubernetes_kubescape/Dockerfile | 151 +++-- linters/latex_chktex/Dockerfile | 151 +++-- linters/lua_luacheck/Dockerfile | 151 +++-- linters/makefile_checkmake/Dockerfile | 151 +++-- .../markdown_markdown_link_check/Dockerfile | 190 ++++-- .../Dockerfile | 190 ++++-- linters/markdown_markdownlint/Dockerfile | 190 ++++-- linters/markdown_remark_lint/Dockerfile | 192 ++++-- linters/openapi_spectral/Dockerfile | 190 ++++-- linters/perl_perlcritic/Dockerfile | 151 +++-- linters/php_phpcs/Dockerfile | 151 +++-- linters/php_phplint/Dockerfile | 151 +++-- linters/php_phpstan/Dockerfile | 151 +++-- linters/php_psalm/Dockerfile | 151 +++-- linters/powershell_powershell/Dockerfile | 151 +++-- .../Dockerfile | 151 +++-- linters/protobuf_protolint/Dockerfile | 151 +++-- linters/puppet_puppet_lint/Dockerfile | 151 +++-- linters/python_bandit/Dockerfile | 172 ++++-- linters/python_black/Dockerfile | 170 ++++-- linters/python_flake8/Dockerfile | 170 ++++-- linters/python_isort/Dockerfile | 171 ++++-- linters/python_mypy/Dockerfile | 170 ++++-- linters/python_pylint/Dockerfile | 171 ++++-- linters/python_pyright/Dockerfile | 170 ++++-- linters/python_ruff/Dockerfile | 151 +++-- linters/r_lintr/Dockerfile | 151 +++-- linters/raku_raku/Dockerfile | 151 +++-- linters/repository_checkov/Dockerfile | 173 ++++-- linters/repository_devskim/Dockerfile | 151 +++-- linters/repository_dustilock/Dockerfile | 151 +++-- linters/repository_git_diff/Dockerfile | 151 +++-- linters/repository_gitleaks/Dockerfile | 151 +++-- linters/repository_grype/Dockerfile | 151 +++-- linters/repository_kics/Dockerfile | 153 +++-- linters/repository_secretlint/Dockerfile | 194 ++++-- linters/repository_semgrep/Dockerfile | 172 ++++-- linters/repository_syft/Dockerfile | 151 +++-- linters/repository_trivy/Dockerfile | 151 +++-- linters/repository_trivy_sbom/Dockerfile | 151 +++-- linters/repository_trufflehog/Dockerfile | 151 +++-- linters/rst_rst_lint/Dockerfile | 170 ++++-- linters/rst_rstcheck/Dockerfile | 170 ++++-- linters/rst_rstfmt/Dockerfile | 170 ++++-- linters/ruby_rubocop/Dockerfile | 151 +++-- linters/rust_clippy/Dockerfile | 151 +++-- .../salesforce_sfdx_scanner_apex/Dockerfile | 190 ++++-- .../salesforce_sfdx_scanner_aura/Dockerfile | 190 ++++-- .../salesforce_sfdx_scanner_lwc/Dockerfile | 190 ++++-- linters/scala_scalafix/Dockerfile | 159 +++-- linters/snakemake_lint/Dockerfile | 170 ++++-- linters/snakemake_snakefmt/Dockerfile | 170 ++++-- linters/spell_cspell/Dockerfile | 190 ++++-- linters/spell_lychee/Dockerfile | 151 +++-- linters/spell_proselint/Dockerfile | 170 ++++-- linters/spell_vale/Dockerfile | 151 +++-- linters/sql_sql_lint/Dockerfile | 190 ++++-- linters/sql_sqlfluff/Dockerfile | 170 ++++-- linters/sql_tsqllint/Dockerfile | 151 +++-- linters/swift_swiftlint/Dockerfile | 151 +++-- linters/tekton_tekton_lint/Dockerfile | 190 ++++-- linters/terraform_terraform_fmt/Dockerfile | 151 +++-- linters/terraform_terragrunt/Dockerfile | 151 +++-- linters/terraform_terrascan/Dockerfile | 151 +++-- linters/terraform_tflint/Dockerfile | 151 +++-- linters/tsx_eslint/Dockerfile | 214 ++++--- linters/typescript_es/Dockerfile | 220 ++++--- linters/typescript_prettier/Dockerfile | 192 ++++-- linters/typescript_standard/Dockerfile | 192 ++++-- linters/vbdotnet_dotnet_format/Dockerfile | 151 +++-- linters/xml_xmllint/Dockerfile | 151 +++-- linters/yaml_prettier/Dockerfile | 190 ++++-- linters/yaml_v8r/Dockerfile | 190 ++++-- linters/yaml_yamllint/Dockerfile | 170 ++++-- 134 files changed, 17855 insertions(+), 8589 deletions(-) diff --git a/Dockerfile b/Dockerfile index d864e54fbe7..64f95017149 100644 --- a/Dockerfile +++ b/Dockerfile @@ -84,136 +84,251 @@ RUN rustup-init -y --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-u RUN --mount=type=cache,id=cargo-${TARGETARCH},sharing=locked,target=/cargo/.cargo/registry/,uid=63425 \ . /cargo/.cargo/env \ - && cargo binstall --no-confirm --no-symlinks sarif-fmt shellcheck-sarif --root /tmp --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") + && cargo binstall --no-confirm --no-symlinks shellcheck-sarif sarif-fmt --root /tmp --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") FROM scratch AS cargo COPY --link --from=cargo-build /tmp/bin/* /bin/ -RUN ["/bin/sarif-fmt", "--help"] RUN ["/bin/shellcheck-sarif", "--help"] +RUN ["/bin/sarif-fmt", "--help"] #FROM__END -################## -# Get base image # -################## -# https://stackoverflow.com/a/73711302/699056 -FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform -FROM python:3.11.4-alpine3.17 -ARG GITHUB_TOKEN +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START +RUN apk add --update --no-cache \ + curl \ + openjdk11 +#BUILD_PLATFORM_APK__END -# https://stackoverflow.com/a/73711302/699056 -COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ -# https://stackoverflow.com/a/73711302/699056 -RUN apk add --update --no-cache libc6-compat \ - gcompat \ - qemu-x86_64 +#BUILD_PLATFORM_OTHER__START +# SCALA installation +RUN curl --retry-all-errors --retry 10 -fLo coursier https://git.io/coursier-cli && \ + chmod +x coursier \ +# +# 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 \ +# +# scalafix installation + && ./coursier install scalafix --quiet --install-dir /usr/bin && rm -rf /root/.cache +# +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START +RUN apk add --update --no-cache \ + npm +#NPM_APK__END +############################ +# Install NPM dependencies # ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# -#ARG__START -ARG TARGETPLATFORM -ARG PWSH_VERSION='latest' -ARG PWSH_DIRECTORY='/opt/microsoft/powershell' -ARG ARM_TTK_NAME='master.zip' -ARG ARM_TTK_URI='https://github.com/Azure/arm-ttk/archive/master.zip' -ARG ARM_TTK_DIRECTORY='/opt/microsoft' -ARG BICEP_EXE='bicep' -ARG BICEP_DIR='/usr/local/bin' -ARG DART_VERSION='2.8.4' -ARG PMD_VERSION=6.55.0 -ARG PSSA_VERSION='latest' -#ARG__END - -#################### -# Run APK installs # -#################### +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START +WORKDIR /node-deps +RUN npm --no-cache install --ignore-scripts --omit=dev \ + sfdx-cli \ + typescript \ + @coffeelint/cli \ + jscpd \ + stylelint \ + stylelint-config-standard \ + stylelint-config-sass-guidelines \ + stylelint-scss \ + gherkin-lint \ + graphql \ + graphql-schema-linter \ + npm-groovy-lint \ + htmlhint \ + eslint \ + eslint-config-airbnb \ + eslint-config-prettier \ + eslint-config-standard \ + eslint-plugin-import \ + eslint-plugin-jest \ + eslint-plugin-node \ + eslint-plugin-prettier \ + eslint-plugin-promise \ + eslint-plugin-vue \ + @babel/core \ + @babel/eslint-parser \ + @microsoft/eslint-formatter-sarif \ + standard \ + prettier \ + @prantlf/jsonlint \ + eslint-plugin-jsonc \ + v8r \ + npm-package-json-lint \ + npm-package-json-lint-config-default \ + eslint-plugin-react \ + eslint-plugin-jsx-a11y \ + markdownlint-cli \ + markdown-link-check \ + markdown-table-formatter \ + @stoplight/spectral-cli \ + secretlint \ + @secretlint/secretlint-rule-preset-recommend \ + @secretlint/secretlint-formatter-sarif \ + cspell \ + sql-lint \ + tekton-lint \ + prettyjson \ + @typescript-eslint/eslint-plugin \ + @typescript-eslint/parser \ + ts-standard && \ + echo "Cleaning npm cache…" \ + && npm cache clean --force || true \ + && echo "Changing owner of node_modules files…" \ + && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ + && echo "Removing extra node_module files…" \ + && rm -rf /root/.npm/_cacache \ + && find . -name "*.d.ts" -delete \ + && find . -name "*.map" -delete \ + && find . -name "*.npmignore" -delete \ + && find . -name "*.travis.yml" -delete \ + && find . -name "CHANGELOG.md" -delete \ + && find . -name "README.md" -delete \ + && find . -name ".package-lock.json" -delete \ + && find . -name "package-lock.json" -delete \ + && find . -name "README.md" -delete WORKDIR / +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# -#APK__START -RUN apk add --no-cache \ - bash \ - ca-certificates \ - curl \ + +#COPY__START +COPY --link --from=node_modules /node-deps /node-deps +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 --link --from=build-platform /usr/bin/bash-exec /usr/bin/bash-exec +# 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=dotenvlinter /dotenv-linter /usr/bin/dotenv-linter +COPY --link --from=revive /usr/bin/revive /usr/bin/revive +COPY --link --from=kubeconform /kubeconform /usr/bin/ +COPY --link --from=chktex /usr/bin/chktex /usr/bin/ +COPY --link --from=checkmake /checkmake /usr/bin/checkmake +COPY --link --chmod=755 --from=phpstan /composer/vendor/phpstan/phpstan/phpstan.phar /usr/bin/phpstan +COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ +COPY --link --from=fetch-ruff /ruff /usr/bin/ruff +COPY --link --from=dustilock /usr/bin/dustilock /usr/bin/dustilock +COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ +COPY --link --from=kics /app/bin/kics /usr/bin/ +COPY --from=kics /app/bin/assets /opt/kics/assets/ +COPY --link --from=trufflehog /usr/bin/trufflehog /usr/bin/ +COPY --link --from=build-platform /usr/bin/scalafix /usr/bin/ +COPY --link --from=vale /bin/vale /bin/vale +COPY --link --from=lychee /usr/local/bin/lychee /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=cargo /bin/* /usr/bin/ +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ gcc \ - git \ - git-lfs \ libffi-dev \ - make \ musl-dev \ - openssh \ - docker \ - openrc \ - icu-libs \ - libcurl \ - libintl \ - libssl1.1 \ - libstdc++ \ - lttng-ust-dev \ - zlib \ - zlib-dev \ - openjdk11 \ - perl \ - perl-dev \ - gnupg \ - php81 \ - php81-phar \ - php81-mbstring \ - php81-xmlwriter \ - php81-tokenizer \ - php81-ctype \ - php81-curl \ - php81-dom \ - php81-simplexml \ - dpkg \ - py3-pyflakes \ - nodejs \ - npm \ - yarn \ - go \ - helm \ - gcompat \ - libc6-compat \ - openssl \ - readline-dev \ + make \ + curl \ + openssl-dev \ g++ \ - libc-dev \ - libgcc \ - libxml2-dev \ - libxml2-utils \ - linux-headers \ - R \ - R-dev \ - R-doc \ - nodejs-current \ - ruby \ - ruby-dev \ - ruby-bundler \ - ruby-rdoc \ - && git config --global core.autocrlf true -#APK__END + cmake +#PIPVENV_BUILDDEPS__END -# PATH for golang & python -ENV GOROOT=/usr/lib/go \ - GOPATH=/go - # PYTHONPYCACHEPREFIX="$HOME/.cache/cpython/" NV: not working for all packages :/ -# hadolint ignore=DL3044 -ENV PATH="$PATH":"$GOROOT"/bin:"$GOPATH"/bin -RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ - # Ignore npm package issues - yarn config set ignore-engines true || true +#PIPVENV_DOWNLOAD__START +RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ + mkdir /download \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ +&& pip download --cache-dir=/var/cache/pip --dest "/download" \ + ansible-lint \ + cpplint \ + cfn-lint \ + djlint \ + pylint \ + typing-extensions \ + black \ + flake8 \ + isort \ + black \ + bandit \ + bandit_sarif_formatter \ + bandit[toml] \ + mypy \ + pyright \ + packaging \ + checkov \ + semgrep \ + restructuredtext_lint \ + rstcheck \ + rstfmt \ + snakemake \ + snakefmt \ + proselint \ + sqlfluff \ + yamllint + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# -#PIP__START - -#PIP__END #PIPVENV__START RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ @@ -345,84 +460,135 @@ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ #PIPVENV__END -############################ -# Install NPM dependencies # +################## +# Get base image # +################## + # https://stackoverflow.com/a/73711302/699056 +FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu + +FROM python:3.11.3-alpine3.17 AS final +ARG GITHUB_TOKEN + +# https://stackoverflow.com/a/73711302/699056 +COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ +# https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 +RUN apk add --update --no-cache libc6-compat \ + gcompat \ + qemu-x86_64 + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# +#ARG__START +ARG TARGETPLATFORM +ARG PWSH_VERSION='latest' +ARG PWSH_DIRECTORY='/opt/microsoft/powershell' +ARG ARM_TTK_NAME='master.zip' +ARG ARM_TTK_URI='https://github.com/Azure/arm-ttk/archive/master.zip' +ARG ARM_TTK_DIRECTORY='/opt/microsoft' +ARG BICEP_EXE='bicep' +ARG BICEP_DIR='/usr/local/bin' +ARG DART_VERSION='2.8.4' +ARG PMD_VERSION=6.55.0 +ARG PSSA_VERSION='latest' +#ARG__END + +#################### +# Run APK installs # +#################### -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START -WORKDIR /node-deps -RUN npm --no-cache install --ignore-scripts --omit=dev \ - sfdx-cli \ - typescript \ - @coffeelint/cli \ - jscpd \ - stylelint \ - stylelint-config-standard \ - stylelint-config-sass-guidelines \ - stylelint-scss \ - gherkin-lint \ - graphql \ - graphql-schema-linter \ - npm-groovy-lint \ - htmlhint \ - eslint \ - eslint-config-airbnb \ - eslint-config-prettier \ - eslint-config-standard \ - eslint-plugin-import \ - eslint-plugin-jest \ - eslint-plugin-node \ - eslint-plugin-prettier \ - eslint-plugin-promise \ - eslint-plugin-vue \ - @babel/core \ - @babel/eslint-parser \ - @microsoft/eslint-formatter-sarif \ - standard \ - prettier \ - @prantlf/jsonlint \ - eslint-plugin-jsonc \ - v8r \ - npm-package-json-lint \ - npm-package-json-lint-config-default \ - eslint-plugin-react \ - eslint-plugin-jsx-a11y \ - markdownlint-cli \ - markdown-link-check \ - markdown-table-formatter \ - @stoplight/spectral-cli \ - secretlint \ - @secretlint/secretlint-rule-preset-recommend \ - @secretlint/secretlint-formatter-sarif \ - cspell \ - sql-lint \ - tekton-lint \ - prettyjson \ - @typescript-eslint/eslint-plugin \ - @typescript-eslint/parser \ - ts-standard && \ - echo "Cleaning npm cache…" \ - && npm cache clean --force || true \ - && echo "Changing owner of node_modules files…" \ - && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ - && echo "Removing extra node_module files…" \ - && rm -rf /root/.npm/_cacache \ - && find . -name "*.d.ts" -delete \ - && find . -name "*.map" -delete \ - && find . -name "*.npmignore" -delete \ - && find . -name "*.travis.yml" -delete \ - && find . -name "CHANGELOG.md" -delete \ - && find . -name "README.md" -delete \ - && find . -name ".package-lock.json" -delete \ - && find . -name "package-lock.json" -delete \ - && find . -name "README.md" -delete WORKDIR / -#NPM__END +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#APK__START +RUN apk add --no-cache \ + bash \ + ca-certificates \ + curl \ + gcc \ + git \ + git-lfs \ + libffi-dev \ + make \ + musl-dev \ + openssh \ + docker \ + openrc \ + icu-libs \ + libcurl \ + libintl \ + libssl1.1 \ + libstdc++ \ + lttng-ust-dev \ + zlib \ + zlib-dev \ + openjdk11 \ + perl \ + perl-dev \ + gnupg \ + php81 \ + php81-phar \ + php81-mbstring \ + php81-xmlwriter \ + php81-tokenizer \ + php81-ctype \ + php81-curl \ + php81-dom \ + php81-simplexml \ + dpkg \ + py3-pyflakes \ + nodejs \ + npm \ + yarn \ + go \ + helm \ + gcompat \ + libc6-compat \ + openssl \ + readline-dev \ + g++ \ + libc-dev \ + libgcc \ + libxml2-dev \ + libxml2-utils \ + linux-headers \ + R \ + R-dev \ + R-doc \ + nodejs-current \ + ruby \ + ruby-dev \ + ruby-bundler \ + ruby-rdoc \ + && git config --global core.autocrlf true +#APK__END + +# PATH for golang & python +ENV GOROOT=/usr/lib/go \ + GOPATH=/go + # PYTHONPYCACHEPREFIX="$HOME/.cache/cpython/" NV: not working for all packages :/ +# hadolint ignore=DL3044 +ENV PATH="$PATH":"$GOROOT"/bin:"$GOPATH"/bin +RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ + # Ignore npm package issues + yarn config set ignore-engines true || true + +COPY --link --from=python-venv /venvs /venvs + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#PIP__START + +#PIP__END + +#PIPVENV_PATH__START +ENV PATH="${PATH}":/venvs/ansible-lint/cross/bin:/venvs/cpplint/cross/bin:/venvs/cfn-lint/cross/bin:/venvs/djlint/cross/bin:/venvs/pylint/cross/bin:/venvs/black/cross/bin:/venvs/flake8/cross/bin:/venvs/isort/cross/bin:/venvs/bandit/cross/bin:/venvs/mypy/cross/bin:/venvs/pyright/cross/bin:/venvs/checkov/cross/bin:/venvs/semgrep/cross/bin:/venvs/rst-lint/cross/bin:/venvs/rstcheck/cross/bin:/venvs/rstfmt/cross/bin:/venvs/snakemake/cross/bin:/venvs/snakefmt/cross/bin:/venvs/proselint/cross/bin:/venvs/sqlfluff/cross/bin:/venvs/yamllint/cross/bin +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -461,46 +627,8 @@ RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-too ENV PATH="/root/.cargo/bin:${PATH}" #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START -COPY --link --from=node_modules /node-deps /node-deps -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 --link --from=build-platform /usr/bin/bash-exec /usr/bin/bash-exec -# 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=dotenvlinter /dotenv-linter /usr/bin/dotenv-linter -COPY --link --from=revive /usr/bin/revive /usr/bin/revive -COPY --link --from=kubeconform /kubeconform /usr/bin/ -COPY --link --from=chktex /usr/bin/chktex /usr/bin/ -COPY --link --from=checkmake /checkmake /usr/bin/checkmake -COPY --link --chmod=755 --from=phpstan /composer/vendor/phpstan/phpstan/phpstan.phar /usr/bin/phpstan -COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ -COPY --link --from=fetch-ruff /ruff /usr/bin/ruff -COPY --link --from=dustilock /usr/bin/dustilock /usr/bin/dustilock -COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ -COPY --link --from=kics /app/bin/kics /usr/bin/ -COPY --from=kics /app/bin/assets /opt/kics/assets/ -COPY --link --from=trufflehog /usr/bin/trufflehog /usr/bin/ -COPY --link --from=build-platform /usr/bin/scalafix /usr/bin/ -COPY --link --from=vale /bin/vale /bin/vale -COPY --link --from=lychee /usr/local/bin/lychee /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=cargo /bin/* /usr/bin/ -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -862,24 +990,6 @@ RUN curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | # #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/flavors/ci_light/Dockerfile b/flavors/ci_light/Dockerfile index e77dd37530f..9e5b27fc207 100644 --- a/flavors/ci_light/Dockerfile +++ b/flavors/ci_light/Dockerfile @@ -21,18 +21,166 @@ FROM zricethezav/gitleaks:v8.17.0 as gitleaks FROM trufflesecurity/trufflehog:latest as trufflehog #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START +RUN apk add --update --no-cache \ + npm +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START +WORKDIR /node-deps +RUN npm --no-cache install --ignore-scripts --omit=dev \ + jscpd \ + npm-groovy-lint \ + @prantlf/jsonlint \ + eslint \ + eslint-plugin-jsonc \ + @microsoft/eslint-formatter-sarif \ + v8r \ + prettier \ + secretlint \ + @secretlint/secretlint-rule-preset-recommend \ + @secretlint/secretlint-formatter-sarif && \ + echo "Cleaning npm cache…" \ + && npm cache clean --force || true \ + && echo "Changing owner of node_modules files…" \ + && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ + && echo "Removing extra node_module files…" \ + && rm -rf /root/.npm/_cacache \ + && find . -name "*.d.ts" -delete \ + && find . -name "*.map" -delete \ + && find . -name "*.npmignore" -delete \ + && find . -name "*.travis.yml" -delete \ + && find . -name "CHANGELOG.md" -delete \ + && find . -name "README.md" -delete \ + && find . -name ".package-lock.json" -delete \ + && find . -name "package-lock.json" -delete \ + && find . -name "README.md" -delete +WORKDIR / + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START +COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck +COPY --link --from=shfmt /bin/shfmt /usr/bin/ +COPY --link --from=node_modules /node-deps /node-deps +COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint +COPY --link --from=dotenvlinter /dotenv-linter /usr/bin/dotenv-linter +COPY --link --from=checkmake /checkmake /usr/bin/checkmake +COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ +COPY --link --from=trufflehog /usr/bin/trufflehog /usr/bin/ +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START +RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ + mkdir /download \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ +&& pip download --cache-dir=/var/cache/pip --dest "/download" \ + yamllint + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/yamllint" \ + && cd "/venvs/yamllint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip yamllint + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -87,6 +235,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -94,56 +244,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START -RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ - mkdir -p "/venvs/yamllint" \ - && cd "/venvs/yamllint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip yamllint - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START -WORKDIR /node-deps -RUN npm --no-cache install --ignore-scripts --omit=dev \ - jscpd \ - npm-groovy-lint \ - @prantlf/jsonlint \ - eslint \ - eslint-plugin-jsonc \ - @microsoft/eslint-formatter-sarif \ - v8r \ - prettier \ - secretlint \ - @secretlint/secretlint-rule-preset-recommend \ - @secretlint/secretlint-formatter-sarif && \ - echo "Cleaning npm cache…" \ - && npm cache clean --force || true \ - && echo "Changing owner of node_modules files…" \ - && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ - && echo "Removing extra node_module files…" \ - && rm -rf /root/.npm/_cacache \ - && find . -name "*.d.ts" -delete \ - && find . -name "*.map" -delete \ - && find . -name "*.npmignore" -delete \ - && find . -name "*.travis.yml" -delete \ - && find . -name "CHANGELOG.md" -delete \ - && find . -name "README.md" -delete \ - && find . -name ".package-lock.json" -delete \ - && find . -name "package-lock.json" -delete \ - && find . -name "README.md" -delete -WORKDIR / - -#NPM__END +#PIPVENV_PATH__START +ENV PATH="${PATH}":/venvs/yamllint/cross/bin +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -169,22 +272,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START -COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck -COPY --link --from=shfmt /bin/shfmt /usr/bin/ -COPY --link --from=node_modules /node-deps /node-deps -COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint -COPY --link --from=dotenvlinter /dotenv-linter /usr/bin/dotenv-linter -COPY --link --from=checkmake /checkmake /usr/bin/checkmake -COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ -COPY --link --from=trufflehog /usr/bin/trufflehog /usr/bin/ -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -203,24 +292,6 @@ RUN curl -sSfL https://raw.githubusercontent.com/anchore/grype/main/install.sh | # #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/flavors/cupcake/Dockerfile b/flavors/cupcake/Dockerfile index e86a81111c1..537d20ca36c 100644 --- a/flavors/cupcake/Dockerfile +++ b/flavors/cupcake/Dockerfile @@ -79,110 +79,228 @@ RUN rustup-init -y --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-u RUN --mount=type=cache,id=cargo-${TARGETARCH},sharing=locked,target=/cargo/.cargo/registry/,uid=63425 \ . /cargo/.cargo/env \ - && cargo binstall --no-confirm --no-symlinks sarif-fmt shellcheck-sarif --root /tmp --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") + && cargo binstall --no-confirm --no-symlinks shellcheck-sarif sarif-fmt --root /tmp --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") FROM scratch AS cargo COPY --link --from=cargo-build /tmp/bin/* /bin/ -RUN ["/bin/sarif-fmt", "--help"] RUN ["/bin/shellcheck-sarif", "--help"] +RUN ["/bin/sarif-fmt", "--help"] #FROM__END -################## -# Get base image # -################## -# https://stackoverflow.com/a/73711302/699056 -FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform -FROM python:3.11.4-alpine3.17 -ARG GITHUB_TOKEN +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START -# https://stackoverflow.com/a/73711302/699056 -COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ -# https://stackoverflow.com/a/73711302/699056 -RUN apk add --update --no-cache libc6-compat \ - gcompat \ - qemu-x86_64 +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START +# bash-exec installation +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 + +# +#BUILD_PLATFORM_OTHER__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START +RUN apk add --update --no-cache \ + npm +#NPM_APK__END + +############################ +# Install NPM dependencies # ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# -#ARG__START -ARG PMD_VERSION=6.55.0 -#ARG__END - -#################### -# Run APK installs # -#################### +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START +WORKDIR /node-deps +RUN npm --no-cache install --ignore-scripts --omit=dev \ + typescript \ + jscpd \ + stylelint \ + stylelint-config-standard \ + stylelint-config-sass-guidelines \ + stylelint-scss \ + graphql \ + graphql-schema-linter \ + npm-groovy-lint \ + htmlhint \ + eslint \ + eslint-config-airbnb \ + eslint-config-prettier \ + eslint-config-standard \ + eslint-plugin-import \ + eslint-plugin-jest \ + eslint-plugin-node \ + eslint-plugin-prettier \ + eslint-plugin-promise \ + eslint-plugin-vue \ + @babel/core \ + @babel/eslint-parser \ + @microsoft/eslint-formatter-sarif \ + standard \ + prettier \ + @prantlf/jsonlint \ + eslint-plugin-jsonc \ + v8r \ + npm-package-json-lint \ + npm-package-json-lint-config-default \ + eslint-plugin-react \ + eslint-plugin-jsx-a11y \ + markdownlint-cli \ + markdown-link-check \ + markdown-table-formatter \ + secretlint \ + @secretlint/secretlint-rule-preset-recommend \ + @secretlint/secretlint-formatter-sarif \ + cspell \ + sql-lint \ + prettyjson \ + @typescript-eslint/eslint-plugin \ + @typescript-eslint/parser \ + ts-standard && \ + echo "Cleaning npm cache…" \ + && npm cache clean --force || true \ + && echo "Changing owner of node_modules files…" \ + && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ + && echo "Removing extra node_module files…" \ + && rm -rf /root/.npm/_cacache \ + && find . -name "*.d.ts" -delete \ + && find . -name "*.map" -delete \ + && find . -name "*.npmignore" -delete \ + && find . -name "*.travis.yml" -delete \ + && find . -name "CHANGELOG.md" -delete \ + && find . -name "README.md" -delete \ + && find . -name ".package-lock.json" -delete \ + && find . -name "package-lock.json" -delete \ + && find . -name "README.md" -delete WORKDIR / +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# -#APK__START -RUN apk add --no-cache \ - bash \ - ca-certificates \ - curl \ + +#COPY__START +COPY --link --from=node_modules /node-deps /node-deps +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 --link --from=build-platform /usr/bin/bash-exec /usr/bin/bash-exec +# 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=dotenvlinter /dotenv-linter /usr/bin/dotenv-linter +COPY --link --from=revive /usr/bin/revive /usr/bin/revive +COPY --link --from=kubeconform /kubeconform /usr/bin/ +COPY --link --from=checkmake /checkmake /usr/bin/checkmake +COPY --link --chmod=755 --from=phpstan /composer/vendor/phpstan/phpstan/phpstan.phar /usr/bin/phpstan +COPY --link --from=fetch-ruff /ruff /usr/bin/ruff +COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ +COPY --link --from=kics /app/bin/kics /usr/bin/ +COPY --from=kics /app/bin/assets /opt/kics/assets/ +COPY --link --from=trufflehog /usr/bin/trufflehog /usr/bin/ +COPY --link --from=lychee /usr/local/bin/lychee /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=cargo /bin/* /usr/bin/ +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ gcc \ - git \ - git-lfs \ libffi-dev \ - make \ musl-dev \ - openssh \ - docker \ - openrc \ - openjdk11 \ - gnupg \ - php81 \ - php81-phar \ - php81-mbstring \ - php81-xmlwriter \ - php81-tokenizer \ - php81-ctype \ - php81-curl \ - php81-dom \ - php81-simplexml \ - dpkg \ - py3-pyflakes \ - nodejs \ - npm \ - yarn \ - go \ - helm \ - gcompat \ - libc6-compat \ - libstdc++ \ - libc-dev \ - libxml2-dev \ - libxml2-utils \ - libgcc \ - nodejs-current \ - ruby \ - ruby-dev \ - ruby-bundler \ - ruby-rdoc \ - && git config --global core.autocrlf true -#APK__END + make \ + curl \ + openssl-dev \ + g++ \ + cmake +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START +RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ + mkdir /download \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ +&& pip download --cache-dir=/var/cache/pip --dest "/download" \ + ansible-lint \ + cpplint \ + cfn-lint \ + djlint \ + pylint \ + typing-extensions \ + black \ + flake8 \ + isort \ + black \ + mypy \ + pyright \ + packaging \ + checkov \ + semgrep \ + restructuredtext_lint \ + rstcheck \ + rstfmt \ + proselint \ + sqlfluff \ + yamllint + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 -# PATH for golang & python -ENV GOROOT=/usr/lib/go \ - GOPATH=/go - # PYTHONPYCACHEPREFIX="$HOME/.cache/cpython/" NV: not working for all packages :/ -# hadolint ignore=DL3044 -ENV PATH="$PATH":"$GOROOT"/bin:"$GOPATH"/bin -RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ - # Ignore npm package issues - yarn config set ignore-engines true || true +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# -#PIP__START - -#PIP__END #PIPVENV__START RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ @@ -296,79 +414,109 @@ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ #PIPVENV__END -############################ -# Install NPM dependencies # +################## +# Get base image # +################## + # https://stackoverflow.com/a/73711302/699056 +FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu + +FROM python:3.11.3-alpine3.17 AS final +ARG GITHUB_TOKEN + +# https://stackoverflow.com/a/73711302/699056 +COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ +# https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 +RUN apk add --update --no-cache libc6-compat \ + gcompat \ + qemu-x86_64 + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# +#ARG__START +ARG PMD_VERSION=6.55.0 +#ARG__END + +#################### +# Run APK installs # +#################### -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START -WORKDIR /node-deps -RUN npm --no-cache install --ignore-scripts --omit=dev \ - typescript \ - jscpd \ - stylelint \ - stylelint-config-standard \ - stylelint-config-sass-guidelines \ - stylelint-scss \ - graphql \ - graphql-schema-linter \ - npm-groovy-lint \ - htmlhint \ - eslint \ - eslint-config-airbnb \ - eslint-config-prettier \ - eslint-config-standard \ - eslint-plugin-import \ - eslint-plugin-jest \ - eslint-plugin-node \ - eslint-plugin-prettier \ - eslint-plugin-promise \ - eslint-plugin-vue \ - @babel/core \ - @babel/eslint-parser \ - @microsoft/eslint-formatter-sarif \ - standard \ - prettier \ - @prantlf/jsonlint \ - eslint-plugin-jsonc \ - v8r \ - npm-package-json-lint \ - npm-package-json-lint-config-default \ - eslint-plugin-react \ - eslint-plugin-jsx-a11y \ - markdownlint-cli \ - markdown-link-check \ - markdown-table-formatter \ - secretlint \ - @secretlint/secretlint-rule-preset-recommend \ - @secretlint/secretlint-formatter-sarif \ - cspell \ - sql-lint \ - prettyjson \ - @typescript-eslint/eslint-plugin \ - @typescript-eslint/parser \ - ts-standard && \ - echo "Cleaning npm cache…" \ - && npm cache clean --force || true \ - && echo "Changing owner of node_modules files…" \ - && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ - && echo "Removing extra node_module files…" \ - && rm -rf /root/.npm/_cacache \ - && find . -name "*.d.ts" -delete \ - && find . -name "*.map" -delete \ - && find . -name "*.npmignore" -delete \ - && find . -name "*.travis.yml" -delete \ - && find . -name "CHANGELOG.md" -delete \ - && find . -name "README.md" -delete \ - && find . -name ".package-lock.json" -delete \ - && find . -name "package-lock.json" -delete \ - && find . -name "README.md" -delete WORKDIR / -#NPM__END +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#APK__START +RUN apk add --no-cache \ + bash \ + ca-certificates \ + curl \ + gcc \ + git \ + git-lfs \ + libffi-dev \ + make \ + musl-dev \ + openssh \ + docker \ + openrc \ + openjdk11 \ + gnupg \ + php81 \ + php81-phar \ + php81-mbstring \ + php81-xmlwriter \ + php81-tokenizer \ + php81-ctype \ + php81-curl \ + php81-dom \ + php81-simplexml \ + dpkg \ + py3-pyflakes \ + nodejs \ + npm \ + yarn \ + go \ + helm \ + gcompat \ + libc6-compat \ + libstdc++ \ + libc-dev \ + libxml2-dev \ + libxml2-utils \ + libgcc \ + nodejs-current \ + ruby \ + ruby-dev \ + ruby-bundler \ + ruby-rdoc \ + && git config --global core.autocrlf true +#APK__END + +# PATH for golang & python +ENV GOROOT=/usr/lib/go \ + GOPATH=/go + # PYTHONPYCACHEPREFIX="$HOME/.cache/cpython/" NV: not working for all packages :/ +# hadolint ignore=DL3044 +ENV PATH="$PATH":"$GOROOT"/bin:"$GOPATH"/bin +RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ + # Ignore npm package issues + yarn config set ignore-engines true || true + +COPY --link --from=python-venv /venvs /venvs + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#PIP__START + +#PIP__END + +#PIPVENV_PATH__START +ENV PATH="${PATH}":/venvs/ansible-lint/cross/bin:/venvs/cpplint/cross/bin:/venvs/cfn-lint/cross/bin:/venvs/djlint/cross/bin:/venvs/pylint/cross/bin:/venvs/black/cross/bin:/venvs/flake8/cross/bin:/venvs/isort/cross/bin:/venvs/mypy/cross/bin:/venvs/pyright/cross/bin:/venvs/checkov/cross/bin:/venvs/semgrep/cross/bin:/venvs/rst-lint/cross/bin:/venvs/rstcheck/cross/bin:/venvs/rstfmt/cross/bin:/venvs/proselint/cross/bin:/venvs/sqlfluff/cross/bin:/venvs/yamllint/cross/bin +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -406,41 +554,8 @@ RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-too ENV PATH="/root/.cargo/bin:${PATH}" #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START -COPY --link --from=node_modules /node-deps /node-deps -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 --link --from=build-platform /usr/bin/bash-exec /usr/bin/bash-exec -# 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=dotenvlinter /dotenv-linter /usr/bin/dotenv-linter -COPY --link --from=revive /usr/bin/revive /usr/bin/revive -COPY --link --from=kubeconform /kubeconform /usr/bin/ -COPY --link --from=checkmake /checkmake /usr/bin/checkmake -COPY --link --chmod=755 --from=phpstan /composer/vendor/phpstan/phpstan/phpstan.phar /usr/bin/phpstan -COPY --link --from=fetch-ruff /ruff /usr/bin/ruff -COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ -COPY --link --from=kics /app/bin/kics /usr/bin/ -COPY --from=kics /app/bin/assets /opt/kics/assets/ -COPY --link --from=trufflehog /usr/bin/trufflehog /usr/bin/ -COPY --link --from=lychee /usr/local/bin/lychee /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=cargo /bin/* /usr/bin/ -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -587,24 +702,6 @@ RUN wget --tries=5 -q -O - https://raw.githubusercontent.com/aquasecurity/trivy/ # #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/flavors/documentation/Dockerfile b/flavors/documentation/Dockerfile index 8de56abbe4c..bfe2c7c50a4 100644 --- a/flavors/documentation/Dockerfile +++ b/flavors/documentation/Dockerfile @@ -31,87 +31,181 @@ FROM jdkato/vale:latest as vale FROM lycheeverse/lychee:latest-alpine as lychee #FROM__END -################## -# Get base image # -################## -# https://stackoverflow.com/a/73711302/699056 -FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform -FROM python:3.11.4-alpine3.17 -ARG GITHUB_TOKEN +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START -# https://stackoverflow.com/a/73711302/699056 -COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ -# https://stackoverflow.com/a/73711302/699056 -RUN apk add --update --no-cache libc6-compat \ - gcompat \ - qemu-x86_64 +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START +# bash-exec installation +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 + +# +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START +RUN apk add --update --no-cache \ + npm +#NPM_APK__END +############################ +# Install NPM dependencies # ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# -#ARG__START -#ARG__END +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START +WORKDIR /node-deps +RUN npm --no-cache install --ignore-scripts --omit=dev \ + jscpd \ + stylelint \ + stylelint-config-standard \ + stylelint-config-sass-guidelines \ + stylelint-scss \ + graphql \ + graphql-schema-linter \ + npm-groovy-lint \ + htmlhint \ + @prantlf/jsonlint \ + eslint \ + eslint-plugin-jsonc \ + @microsoft/eslint-formatter-sarif \ + v8r \ + prettier \ + markdownlint-cli \ + markdown-link-check \ + markdown-table-formatter \ + @stoplight/spectral-cli \ + secretlint \ + @secretlint/secretlint-rule-preset-recommend \ + @secretlint/secretlint-formatter-sarif \ + cspell \ + sql-lint \ + tekton-lint && \ + echo "Cleaning npm cache…" \ + && npm cache clean --force || true \ + && echo "Changing owner of node_modules files…" \ + && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ + && echo "Removing extra node_module files…" \ + && rm -rf /root/.npm/_cacache \ + && find . -name "*.d.ts" -delete \ + && find . -name "*.map" -delete \ + && find . -name "*.npmignore" -delete \ + && find . -name "*.travis.yml" -delete \ + && find . -name "CHANGELOG.md" -delete \ + && find . -name "README.md" -delete \ + && find . -name ".package-lock.json" -delete \ + && find . -name "package-lock.json" -delete \ + && find . -name "README.md" -delete +WORKDIR / -#################### -# Run APK installs # -#################### +#NPM__END -WORKDIR / +FROM busybox AS copy-collector +############################## +# COPY instructions # ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# -#APK__START -RUN apk add --no-cache \ - bash \ - ca-certificates \ - curl \ + +#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 --link --from=build-platform /usr/bin/bash-exec /usr/bin/bash-exec +# 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=node_modules /node-deps /node-deps +COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint +COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker +COPY --link --from=dotenvlinter /dotenv-linter /usr/bin/dotenv-linter +COPY --link --from=kubeconform /kubeconform /usr/bin/ +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 --link --from=trufflehog /usr/bin/trufflehog /usr/bin/ +COPY --link --from=vale /bin/vale /bin/vale +COPY --link --from=lychee /usr/local/bin/lychee /usr/bin/ +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ gcc \ - git \ - git-lfs \ libffi-dev \ - make \ musl-dev \ - openssh \ - openjdk11 \ - py3-pyflakes \ - nodejs \ - npm \ - yarn \ - helm \ - gcompat \ - libc6-compat \ - libstdc++ \ - libc-dev \ - libxml2-dev \ - libxml2-utils \ - libgcc \ - nodejs-current \ - ruby \ - ruby-dev \ - ruby-bundler \ - ruby-rdoc \ - && git config --global core.autocrlf true -#APK__END + make \ + curl \ + openssl-dev \ + g++ \ + cmake +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START +RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ + mkdir /download \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ +&& pip download --cache-dir=/var/cache/pip --dest "/download" \ + ansible-lint \ + djlint \ + packaging \ + checkov \ + semgrep \ + snakemake \ + snakefmt \ + proselint \ + sqlfluff \ + yamllint + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 -# PATH for golang & python -ENV GOROOT=/usr/lib/go \ - GOPATH=/go - # PYTHONPYCACHEPREFIX="$HOME/.cache/cpython/" NV: not working for all packages :/ -# hadolint ignore=DL3044 -ENV PATH="$PATH":"$GOROOT"/bin:"$GOPATH"/bin -RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ - # Ignore npm package issues - yarn config set ignore-engines true || true +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# -#PIP__START - -#PIP__END #PIPVENV__START RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ @@ -171,60 +265,95 @@ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ #PIPVENV__END -############################ -# Install NPM dependencies # +################## +# Get base image # +################## + # https://stackoverflow.com/a/73711302/699056 +FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu + +FROM python:3.11.3-alpine3.17 AS final +ARG GITHUB_TOKEN + +# https://stackoverflow.com/a/73711302/699056 +COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ +# https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 +RUN apk add --update --no-cache libc6-compat \ + gcompat \ + qemu-x86_64 + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# +#ARG__START + +#ARG__END + +#################### +# Run APK installs # +#################### -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START -WORKDIR /node-deps -RUN npm --no-cache install --ignore-scripts --omit=dev \ - jscpd \ - stylelint \ - stylelint-config-standard \ - stylelint-config-sass-guidelines \ - stylelint-scss \ - graphql \ - graphql-schema-linter \ - npm-groovy-lint \ - htmlhint \ - @prantlf/jsonlint \ - eslint \ - eslint-plugin-jsonc \ - @microsoft/eslint-formatter-sarif \ - v8r \ - prettier \ - markdownlint-cli \ - markdown-link-check \ - markdown-table-formatter \ - @stoplight/spectral-cli \ - secretlint \ - @secretlint/secretlint-rule-preset-recommend \ - @secretlint/secretlint-formatter-sarif \ - cspell \ - sql-lint \ - tekton-lint && \ - echo "Cleaning npm cache…" \ - && npm cache clean --force || true \ - && echo "Changing owner of node_modules files…" \ - && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ - && echo "Removing extra node_module files…" \ - && rm -rf /root/.npm/_cacache \ - && find . -name "*.d.ts" -delete \ - && find . -name "*.map" -delete \ - && find . -name "*.npmignore" -delete \ - && find . -name "*.travis.yml" -delete \ - && find . -name "CHANGELOG.md" -delete \ - && find . -name "README.md" -delete \ - && find . -name ".package-lock.json" -delete \ - && find . -name "package-lock.json" -delete \ - && find . -name "README.md" -delete WORKDIR / -#NPM__END +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#APK__START +RUN apk add --no-cache \ + bash \ + ca-certificates \ + curl \ + gcc \ + git \ + git-lfs \ + libffi-dev \ + make \ + musl-dev \ + openssh \ + openjdk11 \ + py3-pyflakes \ + nodejs \ + npm \ + yarn \ + helm \ + gcompat \ + libc6-compat \ + libstdc++ \ + libc-dev \ + libxml2-dev \ + libxml2-utils \ + libgcc \ + nodejs-current \ + ruby \ + ruby-dev \ + ruby-bundler \ + ruby-rdoc \ + && git config --global core.autocrlf true +#APK__END + +# PATH for golang & python +ENV GOROOT=/usr/lib/go \ + GOPATH=/go + # PYTHONPYCACHEPREFIX="$HOME/.cache/cpython/" NV: not working for all packages :/ +# hadolint ignore=DL3044 +ENV PATH="$PATH":"$GOROOT"/bin:"$GOPATH"/bin +RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ + # Ignore npm package issues + yarn config set ignore-engines true || true + +COPY --link --from=python-venv /venvs /venvs + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#PIP__START + +#PIP__END + +#PIPVENV_PATH__START +ENV PATH="${PATH}":/venvs/ansible-lint/cross/bin:/venvs/djlint/cross/bin:/venvs/checkov/cross/bin:/venvs/semgrep/cross/bin:/venvs/snakemake/cross/bin:/venvs/snakefmt/cross/bin:/venvs/proselint/cross/bin:/venvs/sqlfluff/cross/bin:/venvs/yamllint/cross/bin +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -252,33 +381,8 @@ RUN echo 'gem: --no-document' >> ~/.gemrc && \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#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 --link --from=build-platform /usr/bin/bash-exec /usr/bin/bash-exec -# 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=node_modules /node-deps /node-deps -COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint -COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker -COPY --link --from=dotenvlinter /dotenv-linter /usr/bin/dotenv-linter -COPY --link --from=kubeconform /kubeconform /usr/bin/ -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 --link --from=trufflehog /usr/bin/trufflehog /usr/bin/ -COPY --link --from=vale /bin/vale /bin/vale -COPY --link --from=lychee /usr/local/bin/lychee /usr/bin/ -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -306,24 +410,6 @@ RUN curl --retry 5 --retry-delay 5 -sSLO https://github.com/pinterest/ktlint/rel # #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/flavors/dotnet/Dockerfile b/flavors/dotnet/Dockerfile index eeeda2f2067..734da455f93 100644 --- a/flavors/dotnet/Dockerfile +++ b/flavors/dotnet/Dockerfile @@ -31,18 +31,264 @@ FROM jdkato/vale:latest as vale FROM lycheeverse/lychee:latest-alpine as lychee #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START +# bash-exec installation +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 + +# +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START +RUN apk add --update --no-cache \ + npm +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START +WORKDIR /node-deps +RUN npm --no-cache install --ignore-scripts --omit=dev \ + jscpd \ + stylelint \ + stylelint-config-standard \ + stylelint-config-sass-guidelines \ + stylelint-scss \ + gherkin-lint \ + graphql \ + graphql-schema-linter \ + npm-groovy-lint \ + htmlhint \ + @prantlf/jsonlint \ + eslint \ + eslint-plugin-jsonc \ + @microsoft/eslint-formatter-sarif \ + v8r \ + prettier \ + npm-package-json-lint \ + npm-package-json-lint-config-default \ + markdownlint-cli \ + markdown-link-check \ + markdown-table-formatter \ + @stoplight/spectral-cli \ + secretlint \ + @secretlint/secretlint-rule-preset-recommend \ + @secretlint/secretlint-formatter-sarif \ + cspell \ + sql-lint \ + tekton-lint && \ + echo "Cleaning npm cache…" \ + && npm cache clean --force || true \ + && echo "Changing owner of node_modules files…" \ + && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ + && echo "Removing extra node_module files…" \ + && rm -rf /root/.npm/_cacache \ + && find . -name "*.d.ts" -delete \ + && find . -name "*.map" -delete \ + && find . -name "*.npmignore" -delete \ + && find . -name "*.travis.yml" -delete \ + && find . -name "CHANGELOG.md" -delete \ + && find . -name "README.md" -delete \ + && find . -name ".package-lock.json" -delete \ + && find . -name "package-lock.json" -delete \ + && find . -name "README.md" -delete +WORKDIR / + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#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 --link --from=build-platform /usr/bin/bash-exec /usr/bin/bash-exec +# 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=node_modules /node-deps /node-deps +COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint +COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker +COPY --link --from=dotenvlinter /dotenv-linter /usr/bin/dotenv-linter +COPY --link --from=kubeconform /kubeconform /usr/bin/ +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 --link --from=trufflehog /usr/bin/trufflehog /usr/bin/ +COPY --link --from=vale /bin/vale /bin/vale +COPY --link --from=lychee /usr/local/bin/lychee /usr/bin/ +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev \ + g++ \ + cmake +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START +RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ + mkdir /download \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ +&& pip download --cache-dir=/var/cache/pip --dest "/download" \ + ansible-lint \ + cpplint \ + djlint \ + packaging \ + checkov \ + semgrep \ + snakemake \ + snakefmt \ + proselint \ + sqlfluff \ + yamllint + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/ansible-lint" \ + && cd "/venvs/ansible-lint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip ansible-lint +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/cpplint" \ + && cd "/venvs/cpplint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip cpplint +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/djlint" \ + && cd "/venvs/djlint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip djlint +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/checkov" \ + && cd "/venvs/checkov" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip packaging checkov +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/semgrep" \ + && cd "/venvs/semgrep" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip semgrep +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/snakemake" \ + && cd "/venvs/snakemake" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakemake +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/snakefmt" \ + && cd "/venvs/snakefmt" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakefmt +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/proselint" \ + && cd "/venvs/proselint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip proselint +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/sqlfluff" \ + && cd "/venvs/sqlfluff" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip sqlfluff +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/yamllint" \ + && cd "/venvs/yamllint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip yamllint + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -121,6 +367,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -128,127 +376,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START -RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ - mkdir -p "/venvs/ansible-lint" \ - && cd "/venvs/ansible-lint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip ansible-lint -RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ - mkdir -p "/venvs/cpplint" \ - && cd "/venvs/cpplint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip cpplint -RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ - mkdir -p "/venvs/djlint" \ - && cd "/venvs/djlint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip djlint -RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ - mkdir -p "/venvs/checkov" \ - && cd "/venvs/checkov" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip packaging checkov -RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ - mkdir -p "/venvs/semgrep" \ - && cd "/venvs/semgrep" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip semgrep -RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ - mkdir -p "/venvs/snakemake" \ - && cd "/venvs/snakemake" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakemake -RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ - mkdir -p "/venvs/snakefmt" \ - && cd "/venvs/snakefmt" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakefmt -RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ - mkdir -p "/venvs/proselint" \ - && cd "/venvs/proselint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip proselint -RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ - mkdir -p "/venvs/sqlfluff" \ - && cd "/venvs/sqlfluff" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip sqlfluff -RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ - mkdir -p "/venvs/yamllint" \ - && cd "/venvs/yamllint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip yamllint - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START -WORKDIR /node-deps -RUN npm --no-cache install --ignore-scripts --omit=dev \ - jscpd \ - stylelint \ - stylelint-config-standard \ - stylelint-config-sass-guidelines \ - stylelint-scss \ - gherkin-lint \ - graphql \ - graphql-schema-linter \ - npm-groovy-lint \ - htmlhint \ - @prantlf/jsonlint \ - eslint \ - eslint-plugin-jsonc \ - @microsoft/eslint-formatter-sarif \ - v8r \ - prettier \ - npm-package-json-lint \ - npm-package-json-lint-config-default \ - markdownlint-cli \ - markdown-link-check \ - markdown-table-formatter \ - @stoplight/spectral-cli \ - secretlint \ - @secretlint/secretlint-rule-preset-recommend \ - @secretlint/secretlint-formatter-sarif \ - cspell \ - sql-lint \ - tekton-lint && \ - echo "Cleaning npm cache…" \ - && npm cache clean --force || true \ - && echo "Changing owner of node_modules files…" \ - && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ - && echo "Removing extra node_module files…" \ - && rm -rf /root/.npm/_cacache \ - && find . -name "*.d.ts" -delete \ - && find . -name "*.map" -delete \ - && find . -name "*.npmignore" -delete \ - && find . -name "*.travis.yml" -delete \ - && find . -name "CHANGELOG.md" -delete \ - && find . -name "README.md" -delete \ - && find . -name ".package-lock.json" -delete \ - && find . -name "package-lock.json" -delete \ - && find . -name "README.md" -delete -WORKDIR / - -#NPM__END +#PIPVENV_PATH__START +ENV PATH="${PATH}":/venvs/ansible-lint/cross/bin:/venvs/cpplint/cross/bin:/venvs/djlint/cross/bin:/venvs/checkov/cross/bin:/venvs/semgrep/cross/bin:/venvs/snakemake/cross/bin:/venvs/snakefmt/cross/bin:/venvs/proselint/cross/bin:/venvs/sqlfluff/cross/bin:/venvs/yamllint/cross/bin +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -276,33 +406,8 @@ RUN echo 'gem: --no-document' >> ~/.gemrc && \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#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 --link --from=build-platform /usr/bin/bash-exec /usr/bin/bash-exec -# 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=node_modules /node-deps /node-deps -COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint -COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker -COPY --link --from=dotenvlinter /dotenv-linter /usr/bin/dotenv-linter -COPY --link --from=kubeconform /kubeconform /usr/bin/ -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 --link --from=trufflehog /usr/bin/trufflehog /usr/bin/ -COPY --link --from=vale /bin/vale /bin/vale -COPY --link --from=lychee /usr/local/bin/lychee /usr/bin/ -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -417,24 +522,6 @@ esac \ # #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/flavors/dotnetweb/Dockerfile b/flavors/dotnetweb/Dockerfile index 83a6eb57290..2f07acde5c9 100644 --- a/flavors/dotnetweb/Dockerfile +++ b/flavors/dotnetweb/Dockerfile @@ -31,18 +31,284 @@ FROM jdkato/vale:latest as vale FROM lycheeverse/lychee:latest-alpine as lychee #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START +# bash-exec installation +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 + +# +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START +RUN apk add --update --no-cache \ + npm +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START +WORKDIR /node-deps +RUN npm --no-cache install --ignore-scripts --omit=dev \ + typescript \ + @coffeelint/cli \ + jscpd \ + stylelint \ + stylelint-config-standard \ + stylelint-config-sass-guidelines \ + stylelint-scss \ + gherkin-lint \ + graphql \ + graphql-schema-linter \ + npm-groovy-lint \ + htmlhint \ + eslint \ + eslint-config-airbnb \ + eslint-config-prettier \ + eslint-config-standard \ + eslint-plugin-import \ + eslint-plugin-jest \ + eslint-plugin-node \ + eslint-plugin-prettier \ + eslint-plugin-promise \ + eslint-plugin-vue \ + @babel/core \ + @babel/eslint-parser \ + @microsoft/eslint-formatter-sarif \ + standard \ + prettier \ + @prantlf/jsonlint \ + eslint-plugin-jsonc \ + v8r \ + npm-package-json-lint \ + npm-package-json-lint-config-default \ + eslint-plugin-react \ + eslint-plugin-jsx-a11y \ + markdownlint-cli \ + markdown-link-check \ + markdown-table-formatter \ + @stoplight/spectral-cli \ + secretlint \ + @secretlint/secretlint-rule-preset-recommend \ + @secretlint/secretlint-formatter-sarif \ + cspell \ + sql-lint \ + tekton-lint \ + prettyjson \ + @typescript-eslint/eslint-plugin \ + @typescript-eslint/parser \ + ts-standard && \ + echo "Cleaning npm cache…" \ + && npm cache clean --force || true \ + && echo "Changing owner of node_modules files…" \ + && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ + && echo "Removing extra node_module files…" \ + && rm -rf /root/.npm/_cacache \ + && find . -name "*.d.ts" -delete \ + && find . -name "*.map" -delete \ + && find . -name "*.npmignore" -delete \ + && find . -name "*.travis.yml" -delete \ + && find . -name "CHANGELOG.md" -delete \ + && find . -name "README.md" -delete \ + && find . -name ".package-lock.json" -delete \ + && find . -name "package-lock.json" -delete \ + && find . -name "README.md" -delete +WORKDIR / + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START +COPY --link --from=node_modules /node-deps /node-deps +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 --link --from=build-platform /usr/bin/bash-exec /usr/bin/bash-exec +# 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=dotenvlinter /dotenv-linter /usr/bin/dotenv-linter +COPY --link --from=kubeconform /kubeconform /usr/bin/ +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 --link --from=trufflehog /usr/bin/trufflehog /usr/bin/ +COPY --link --from=vale /bin/vale /bin/vale +COPY --link --from=lychee /usr/local/bin/lychee /usr/bin/ +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev \ + g++ \ + cmake +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START +RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ + mkdir /download \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ +&& pip download --cache-dir=/var/cache/pip --dest "/download" \ + ansible-lint \ + cpplint \ + djlint \ + packaging \ + checkov \ + semgrep \ + snakemake \ + snakefmt \ + proselint \ + sqlfluff \ + yamllint + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/ansible-lint" \ + && cd "/venvs/ansible-lint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip ansible-lint +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/cpplint" \ + && cd "/venvs/cpplint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip cpplint +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/djlint" \ + && cd "/venvs/djlint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip djlint +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/checkov" \ + && cd "/venvs/checkov" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip packaging checkov +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/semgrep" \ + && cd "/venvs/semgrep" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip semgrep +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/snakemake" \ + && cd "/venvs/snakemake" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakemake +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/snakefmt" \ + && cd "/venvs/snakefmt" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakefmt +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/proselint" \ + && cd "/venvs/proselint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip proselint +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/sqlfluff" \ + && cd "/venvs/sqlfluff" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip sqlfluff +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/yamllint" \ + && cd "/venvs/yamllint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip yamllint + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -121,6 +387,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -128,147 +396,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START -RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ - mkdir -p "/venvs/ansible-lint" \ - && cd "/venvs/ansible-lint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip ansible-lint -RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ - mkdir -p "/venvs/cpplint" \ - && cd "/venvs/cpplint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip cpplint -RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ - mkdir -p "/venvs/djlint" \ - && cd "/venvs/djlint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip djlint -RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ - mkdir -p "/venvs/checkov" \ - && cd "/venvs/checkov" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip packaging checkov -RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ - mkdir -p "/venvs/semgrep" \ - && cd "/venvs/semgrep" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip semgrep -RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ - mkdir -p "/venvs/snakemake" \ - && cd "/venvs/snakemake" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakemake -RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ - mkdir -p "/venvs/snakefmt" \ - && cd "/venvs/snakefmt" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakefmt -RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ - mkdir -p "/venvs/proselint" \ - && cd "/venvs/proselint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip proselint -RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ - mkdir -p "/venvs/sqlfluff" \ - && cd "/venvs/sqlfluff" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip sqlfluff -RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ - mkdir -p "/venvs/yamllint" \ - && cd "/venvs/yamllint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip yamllint - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START -WORKDIR /node-deps -RUN npm --no-cache install --ignore-scripts --omit=dev \ - typescript \ - @coffeelint/cli \ - jscpd \ - stylelint \ - stylelint-config-standard \ - stylelint-config-sass-guidelines \ - stylelint-scss \ - gherkin-lint \ - graphql \ - graphql-schema-linter \ - npm-groovy-lint \ - htmlhint \ - eslint \ - eslint-config-airbnb \ - eslint-config-prettier \ - eslint-config-standard \ - eslint-plugin-import \ - eslint-plugin-jest \ - eslint-plugin-node \ - eslint-plugin-prettier \ - eslint-plugin-promise \ - eslint-plugin-vue \ - @babel/core \ - @babel/eslint-parser \ - @microsoft/eslint-formatter-sarif \ - standard \ - prettier \ - @prantlf/jsonlint \ - eslint-plugin-jsonc \ - v8r \ - npm-package-json-lint \ - npm-package-json-lint-config-default \ - eslint-plugin-react \ - eslint-plugin-jsx-a11y \ - markdownlint-cli \ - markdown-link-check \ - markdown-table-formatter \ - @stoplight/spectral-cli \ - secretlint \ - @secretlint/secretlint-rule-preset-recommend \ - @secretlint/secretlint-formatter-sarif \ - cspell \ - sql-lint \ - tekton-lint \ - prettyjson \ - @typescript-eslint/eslint-plugin \ - @typescript-eslint/parser \ - ts-standard && \ - echo "Cleaning npm cache…" \ - && npm cache clean --force || true \ - && echo "Changing owner of node_modules files…" \ - && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ - && echo "Removing extra node_module files…" \ - && rm -rf /root/.npm/_cacache \ - && find . -name "*.d.ts" -delete \ - && find . -name "*.map" -delete \ - && find . -name "*.npmignore" -delete \ - && find . -name "*.travis.yml" -delete \ - && find . -name "CHANGELOG.md" -delete \ - && find . -name "README.md" -delete \ - && find . -name ".package-lock.json" -delete \ - && find . -name "package-lock.json" -delete \ - && find . -name "README.md" -delete -WORKDIR / - -#NPM__END +#PIPVENV_PATH__START +ENV PATH="${PATH}":/venvs/ansible-lint/cross/bin:/venvs/cpplint/cross/bin:/venvs/djlint/cross/bin:/venvs/checkov/cross/bin:/venvs/semgrep/cross/bin:/venvs/snakemake/cross/bin:/venvs/snakefmt/cross/bin:/venvs/proselint/cross/bin:/venvs/sqlfluff/cross/bin:/venvs/yamllint/cross/bin +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -296,33 +426,8 @@ RUN echo 'gem: --no-document' >> ~/.gemrc && \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START -COPY --link --from=node_modules /node-deps /node-deps -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 --link --from=build-platform /usr/bin/bash-exec /usr/bin/bash-exec -# 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=dotenvlinter /dotenv-linter /usr/bin/dotenv-linter -COPY --link --from=kubeconform /kubeconform /usr/bin/ -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 --link --from=trufflehog /usr/bin/trufflehog /usr/bin/ -COPY --link --from=vale /bin/vale /bin/vale -COPY --link --from=lychee /usr/local/bin/lychee /usr/bin/ -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -437,24 +542,6 @@ esac \ # #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/flavors/go/Dockerfile b/flavors/go/Dockerfile index 4daca4d53ef..a29a7eb9f61 100644 --- a/flavors/go/Dockerfile +++ b/flavors/go/Dockerfile @@ -37,88 +37,182 @@ FROM jdkato/vale:latest as vale FROM lycheeverse/lychee:latest-alpine as lychee #FROM__END -################## -# Get base image # -################## -# https://stackoverflow.com/a/73711302/699056 -FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform -FROM python:3.11.4-alpine3.17 -ARG GITHUB_TOKEN +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START -# https://stackoverflow.com/a/73711302/699056 -COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ -# https://stackoverflow.com/a/73711302/699056 -RUN apk add --update --no-cache libc6-compat \ - gcompat \ - qemu-x86_64 +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START +# bash-exec installation +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 + +# +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START +RUN apk add --update --no-cache \ + npm +#NPM_APK__END +############################ +# Install NPM dependencies # ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# -#ARG__START -#ARG__END +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START +WORKDIR /node-deps +RUN npm --no-cache install --ignore-scripts --omit=dev \ + jscpd \ + stylelint \ + stylelint-config-standard \ + stylelint-config-sass-guidelines \ + stylelint-scss \ + graphql \ + graphql-schema-linter \ + npm-groovy-lint \ + htmlhint \ + @prantlf/jsonlint \ + eslint \ + eslint-plugin-jsonc \ + @microsoft/eslint-formatter-sarif \ + v8r \ + prettier \ + markdownlint-cli \ + markdown-link-check \ + markdown-table-formatter \ + @stoplight/spectral-cli \ + secretlint \ + @secretlint/secretlint-rule-preset-recommend \ + @secretlint/secretlint-formatter-sarif \ + cspell \ + sql-lint \ + tekton-lint && \ + echo "Cleaning npm cache…" \ + && npm cache clean --force || true \ + && echo "Changing owner of node_modules files…" \ + && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ + && echo "Removing extra node_module files…" \ + && rm -rf /root/.npm/_cacache \ + && find . -name "*.d.ts" -delete \ + && find . -name "*.map" -delete \ + && find . -name "*.npmignore" -delete \ + && find . -name "*.travis.yml" -delete \ + && find . -name "CHANGELOG.md" -delete \ + && find . -name "README.md" -delete \ + && find . -name ".package-lock.json" -delete \ + && find . -name "package-lock.json" -delete \ + && find . -name "README.md" -delete +WORKDIR / -#################### -# Run APK installs # -#################### +#NPM__END -WORKDIR / +FROM busybox AS copy-collector +############################## +# COPY instructions # ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# -#APK__START -RUN apk add --no-cache \ - bash \ - ca-certificates \ - curl \ + +#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 --link --from=build-platform /usr/bin/bash-exec /usr/bin/bash-exec +# 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=node_modules /node-deps /node-deps +COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint +COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker +COPY --link --from=dotenvlinter /dotenv-linter /usr/bin/dotenv-linter +COPY --link --from=revive /usr/bin/revive /usr/bin/revive +COPY --link --from=kubeconform /kubeconform /usr/bin/ +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 --link --from=trufflehog /usr/bin/trufflehog /usr/bin/ +COPY --link --from=vale /bin/vale /bin/vale +COPY --link --from=lychee /usr/local/bin/lychee /usr/bin/ +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ gcc \ - git \ - git-lfs \ libffi-dev \ - make \ musl-dev \ - openssh \ - openjdk11 \ - py3-pyflakes \ - nodejs \ - npm \ - yarn \ - go \ - helm \ - gcompat \ - libc6-compat \ - libstdc++ \ - libc-dev \ - libxml2-dev \ - libxml2-utils \ - libgcc \ - nodejs-current \ - ruby \ - ruby-dev \ - ruby-bundler \ - ruby-rdoc \ - && git config --global core.autocrlf true -#APK__END + make \ + curl \ + openssl-dev \ + g++ \ + cmake +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START +RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ + mkdir /download \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ +&& pip download --cache-dir=/var/cache/pip --dest "/download" \ + ansible-lint \ + djlint \ + packaging \ + checkov \ + semgrep \ + snakemake \ + snakefmt \ + proselint \ + sqlfluff \ + yamllint + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 -# PATH for golang & python -ENV GOROOT=/usr/lib/go \ - GOPATH=/go - # PYTHONPYCACHEPREFIX="$HOME/.cache/cpython/" NV: not working for all packages :/ -# hadolint ignore=DL3044 -ENV PATH="$PATH":"$GOROOT"/bin:"$GOPATH"/bin -RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ - # Ignore npm package issues - yarn config set ignore-engines true || true +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# -#PIP__START - -#PIP__END #PIPVENV__START RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ @@ -178,60 +272,96 @@ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ #PIPVENV__END -############################ -# Install NPM dependencies # +################## +# Get base image # +################## + # https://stackoverflow.com/a/73711302/699056 +FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu + +FROM python:3.11.3-alpine3.17 AS final +ARG GITHUB_TOKEN + +# https://stackoverflow.com/a/73711302/699056 +COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ +# https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 +RUN apk add --update --no-cache libc6-compat \ + gcompat \ + qemu-x86_64 + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# +#ARG__START + +#ARG__END + +#################### +# Run APK installs # +#################### -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START -WORKDIR /node-deps -RUN npm --no-cache install --ignore-scripts --omit=dev \ - jscpd \ - stylelint \ - stylelint-config-standard \ - stylelint-config-sass-guidelines \ - stylelint-scss \ - graphql \ - graphql-schema-linter \ - npm-groovy-lint \ - htmlhint \ - @prantlf/jsonlint \ - eslint \ - eslint-plugin-jsonc \ - @microsoft/eslint-formatter-sarif \ - v8r \ - prettier \ - markdownlint-cli \ - markdown-link-check \ - markdown-table-formatter \ - @stoplight/spectral-cli \ - secretlint \ - @secretlint/secretlint-rule-preset-recommend \ - @secretlint/secretlint-formatter-sarif \ - cspell \ - sql-lint \ - tekton-lint && \ - echo "Cleaning npm cache…" \ - && npm cache clean --force || true \ - && echo "Changing owner of node_modules files…" \ - && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ - && echo "Removing extra node_module files…" \ - && rm -rf /root/.npm/_cacache \ - && find . -name "*.d.ts" -delete \ - && find . -name "*.map" -delete \ - && find . -name "*.npmignore" -delete \ - && find . -name "*.travis.yml" -delete \ - && find . -name "CHANGELOG.md" -delete \ - && find . -name "README.md" -delete \ - && find . -name ".package-lock.json" -delete \ - && find . -name "package-lock.json" -delete \ - && find . -name "README.md" -delete WORKDIR / -#NPM__END +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#APK__START +RUN apk add --no-cache \ + bash \ + ca-certificates \ + curl \ + gcc \ + git \ + git-lfs \ + libffi-dev \ + make \ + musl-dev \ + openssh \ + openjdk11 \ + py3-pyflakes \ + nodejs \ + npm \ + yarn \ + go \ + helm \ + gcompat \ + libc6-compat \ + libstdc++ \ + libc-dev \ + libxml2-dev \ + libxml2-utils \ + libgcc \ + nodejs-current \ + ruby \ + ruby-dev \ + ruby-bundler \ + ruby-rdoc \ + && git config --global core.autocrlf true +#APK__END + +# PATH for golang & python +ENV GOROOT=/usr/lib/go \ + GOPATH=/go + # PYTHONPYCACHEPREFIX="$HOME/.cache/cpython/" NV: not working for all packages :/ +# hadolint ignore=DL3044 +ENV PATH="$PATH":"$GOROOT"/bin:"$GOPATH"/bin +RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ + # Ignore npm package issues + yarn config set ignore-engines true || true + +COPY --link --from=python-venv /venvs /venvs + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#PIP__START + +#PIP__END + +#PIPVENV_PATH__START +ENV PATH="${PATH}":/venvs/ansible-lint/cross/bin:/venvs/djlint/cross/bin:/venvs/checkov/cross/bin:/venvs/semgrep/cross/bin:/venvs/snakemake/cross/bin:/venvs/snakefmt/cross/bin:/venvs/proselint/cross/bin:/venvs/sqlfluff/cross/bin:/venvs/yamllint/cross/bin +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -259,34 +389,8 @@ RUN echo 'gem: --no-document' >> ~/.gemrc && \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#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 --link --from=build-platform /usr/bin/bash-exec /usr/bin/bash-exec -# 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=node_modules /node-deps /node-deps -COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint -COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker -COPY --link --from=dotenvlinter /dotenv-linter /usr/bin/dotenv-linter -COPY --link --from=revive /usr/bin/revive /usr/bin/revive -COPY --link --from=kubeconform /kubeconform /usr/bin/ -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 --link --from=trufflehog /usr/bin/trufflehog /usr/bin/ -COPY --link --from=vale /bin/vale /bin/vale -COPY --link --from=lychee /usr/local/bin/lychee /usr/bin/ -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -318,24 +422,6 @@ RUN wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/master # #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/flavors/java/Dockerfile b/flavors/java/Dockerfile index 1a3ab88d6f7..019d74a8ae2 100644 --- a/flavors/java/Dockerfile +++ b/flavors/java/Dockerfile @@ -31,87 +31,181 @@ FROM jdkato/vale:latest as vale FROM lycheeverse/lychee:latest-alpine as lychee #FROM__END -################## -# Get base image # -################## -# https://stackoverflow.com/a/73711302/699056 -FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform -FROM python:3.11.4-alpine3.17 -ARG GITHUB_TOKEN +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START -# https://stackoverflow.com/a/73711302/699056 -COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ -# https://stackoverflow.com/a/73711302/699056 -RUN apk add --update --no-cache libc6-compat \ - gcompat \ - qemu-x86_64 +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START +# bash-exec installation +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 + +# +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START +RUN apk add --update --no-cache \ + npm +#NPM_APK__END +############################ +# Install NPM dependencies # ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# -#ARG__START -ARG PMD_VERSION=6.55.0 -#ARG__END - -#################### -# Run APK installs # -#################### +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START +WORKDIR /node-deps +RUN npm --no-cache install --ignore-scripts --omit=dev \ + jscpd \ + stylelint \ + stylelint-config-standard \ + stylelint-config-sass-guidelines \ + stylelint-scss \ + graphql \ + graphql-schema-linter \ + npm-groovy-lint \ + htmlhint \ + @prantlf/jsonlint \ + eslint \ + eslint-plugin-jsonc \ + @microsoft/eslint-formatter-sarif \ + v8r \ + prettier \ + markdownlint-cli \ + markdown-link-check \ + markdown-table-formatter \ + @stoplight/spectral-cli \ + secretlint \ + @secretlint/secretlint-rule-preset-recommend \ + @secretlint/secretlint-formatter-sarif \ + cspell \ + sql-lint \ + tekton-lint && \ + echo "Cleaning npm cache…" \ + && npm cache clean --force || true \ + && echo "Changing owner of node_modules files…" \ + && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ + && echo "Removing extra node_module files…" \ + && rm -rf /root/.npm/_cacache \ + && find . -name "*.d.ts" -delete \ + && find . -name "*.map" -delete \ + && find . -name "*.npmignore" -delete \ + && find . -name "*.travis.yml" -delete \ + && find . -name "CHANGELOG.md" -delete \ + && find . -name "README.md" -delete \ + && find . -name ".package-lock.json" -delete \ + && find . -name "package-lock.json" -delete \ + && find . -name "README.md" -delete WORKDIR / +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# -#APK__START -RUN apk add --no-cache \ - bash \ - ca-certificates \ - curl \ + +#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 --link --from=build-platform /usr/bin/bash-exec /usr/bin/bash-exec +# 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=node_modules /node-deps /node-deps +COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint +COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker +COPY --link --from=dotenvlinter /dotenv-linter /usr/bin/dotenv-linter +COPY --link --from=kubeconform /kubeconform /usr/bin/ +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 --link --from=trufflehog /usr/bin/trufflehog /usr/bin/ +COPY --link --from=vale /bin/vale /bin/vale +COPY --link --from=lychee /usr/local/bin/lychee /usr/bin/ +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ gcc \ - git \ - git-lfs \ libffi-dev \ - make \ musl-dev \ - openssh \ - openjdk11 \ - py3-pyflakes \ - nodejs \ - npm \ - yarn \ - helm \ - gcompat \ - libc6-compat \ - libstdc++ \ - libc-dev \ - libxml2-dev \ - libxml2-utils \ - libgcc \ - nodejs-current \ - ruby \ - ruby-dev \ - ruby-bundler \ - ruby-rdoc \ - && git config --global core.autocrlf true -#APK__END + make \ + curl \ + openssl-dev \ + g++ \ + cmake +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START +RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ + mkdir /download \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ +&& pip download --cache-dir=/var/cache/pip --dest "/download" \ + ansible-lint \ + djlint \ + packaging \ + checkov \ + semgrep \ + snakemake \ + snakefmt \ + proselint \ + sqlfluff \ + yamllint + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 -# PATH for golang & python -ENV GOROOT=/usr/lib/go \ - GOPATH=/go - # PYTHONPYCACHEPREFIX="$HOME/.cache/cpython/" NV: not working for all packages :/ -# hadolint ignore=DL3044 -ENV PATH="$PATH":"$GOROOT"/bin:"$GOPATH"/bin -RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ - # Ignore npm package issues - yarn config set ignore-engines true || true +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# -#PIP__START - -#PIP__END #PIPVENV__START RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ @@ -171,60 +265,95 @@ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ #PIPVENV__END -############################ -# Install NPM dependencies # +################## +# Get base image # +################## + # https://stackoverflow.com/a/73711302/699056 +FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu + +FROM python:3.11.3-alpine3.17 AS final +ARG GITHUB_TOKEN + +# https://stackoverflow.com/a/73711302/699056 +COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ +# https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 +RUN apk add --update --no-cache libc6-compat \ + gcompat \ + qemu-x86_64 + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# +#ARG__START +ARG PMD_VERSION=6.55.0 +#ARG__END + +#################### +# Run APK installs # +#################### -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START -WORKDIR /node-deps -RUN npm --no-cache install --ignore-scripts --omit=dev \ - jscpd \ - stylelint \ - stylelint-config-standard \ - stylelint-config-sass-guidelines \ - stylelint-scss \ - graphql \ - graphql-schema-linter \ - npm-groovy-lint \ - htmlhint \ - @prantlf/jsonlint \ - eslint \ - eslint-plugin-jsonc \ - @microsoft/eslint-formatter-sarif \ - v8r \ - prettier \ - markdownlint-cli \ - markdown-link-check \ - markdown-table-formatter \ - @stoplight/spectral-cli \ - secretlint \ - @secretlint/secretlint-rule-preset-recommend \ - @secretlint/secretlint-formatter-sarif \ - cspell \ - sql-lint \ - tekton-lint && \ - echo "Cleaning npm cache…" \ - && npm cache clean --force || true \ - && echo "Changing owner of node_modules files…" \ - && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ - && echo "Removing extra node_module files…" \ - && rm -rf /root/.npm/_cacache \ - && find . -name "*.d.ts" -delete \ - && find . -name "*.map" -delete \ - && find . -name "*.npmignore" -delete \ - && find . -name "*.travis.yml" -delete \ - && find . -name "CHANGELOG.md" -delete \ - && find . -name "README.md" -delete \ - && find . -name ".package-lock.json" -delete \ - && find . -name "package-lock.json" -delete \ - && find . -name "README.md" -delete WORKDIR / -#NPM__END +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#APK__START +RUN apk add --no-cache \ + bash \ + ca-certificates \ + curl \ + gcc \ + git \ + git-lfs \ + libffi-dev \ + make \ + musl-dev \ + openssh \ + openjdk11 \ + py3-pyflakes \ + nodejs \ + npm \ + yarn \ + helm \ + gcompat \ + libc6-compat \ + libstdc++ \ + libc-dev \ + libxml2-dev \ + libxml2-utils \ + libgcc \ + nodejs-current \ + ruby \ + ruby-dev \ + ruby-bundler \ + ruby-rdoc \ + && git config --global core.autocrlf true +#APK__END + +# PATH for golang & python +ENV GOROOT=/usr/lib/go \ + GOPATH=/go + # PYTHONPYCACHEPREFIX="$HOME/.cache/cpython/" NV: not working for all packages :/ +# hadolint ignore=DL3044 +ENV PATH="$PATH":"$GOROOT"/bin:"$GOPATH"/bin +RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ + # Ignore npm package issues + yarn config set ignore-engines true || true + +COPY --link --from=python-venv /venvs /venvs + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#PIP__START + +#PIP__END + +#PIPVENV_PATH__START +ENV PATH="${PATH}":/venvs/ansible-lint/cross/bin:/venvs/djlint/cross/bin:/venvs/checkov/cross/bin:/venvs/semgrep/cross/bin:/venvs/snakemake/cross/bin:/venvs/snakefmt/cross/bin:/venvs/proselint/cross/bin:/venvs/sqlfluff/cross/bin:/venvs/yamllint/cross/bin +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -252,33 +381,8 @@ RUN echo 'gem: --no-document' >> ~/.gemrc && \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#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 --link --from=build-platform /usr/bin/bash-exec /usr/bin/bash-exec -# 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=node_modules /node-deps /node-deps -COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint -COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker -COPY --link --from=dotenvlinter /dotenv-linter /usr/bin/dotenv-linter -COPY --link --from=kubeconform /kubeconform /usr/bin/ -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 --link --from=trufflehog /usr/bin/trufflehog /usr/bin/ -COPY --link --from=vale /bin/vale /bin/vale -COPY --link --from=lychee /usr/local/bin/lychee /usr/bin/ -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -383,24 +487,6 @@ RUN wget --quiet https://github.com/pmd/pmd/releases/download/pmd_releases%2F${P # #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/flavors/javascript/Dockerfile b/flavors/javascript/Dockerfile index 0095b48025d..7d1268ffedf 100644 --- a/flavors/javascript/Dockerfile +++ b/flavors/javascript/Dockerfile @@ -30,145 +30,29 @@ FROM jdkato/vale:latest as vale FROM lycheeverse/lychee:latest-alpine as lychee #FROM__END -################## -# Get base image # -################## -# https://stackoverflow.com/a/73711302/699056 -FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu - -FROM python:3.11.4-alpine3.17 -ARG GITHUB_TOKEN - -# https://stackoverflow.com/a/73711302/699056 -COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ -# https://stackoverflow.com/a/73711302/699056 -RUN apk add --update --no-cache libc6-compat \ - gcompat \ - qemu-x86_64 +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# -#ARG__START +#BUILD_PLATFORM_APK__START -#ARG__END +#BUILD_PLATFORM_APK__END -#################### -# Run APK installs # -#################### - -WORKDIR / +#BUILD_PLATFORM_OTHER__START +# bash-exec installation +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 -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# -#APK__START -RUN apk add --no-cache \ - bash \ - ca-certificates \ - curl \ - gcc \ - git \ - git-lfs \ - libffi-dev \ - make \ - musl-dev \ - openssh \ - openjdk11 \ - py3-pyflakes \ - nodejs \ - npm \ - yarn \ - helm \ - gcompat \ - libc6-compat \ - libstdc++ \ - libc-dev \ - libxml2-dev \ - libxml2-utils \ - libgcc \ - nodejs-current \ - ruby \ - ruby-dev \ - ruby-bundler \ - ruby-rdoc \ - && git config --global core.autocrlf true -#APK__END - -# PATH for golang & python -ENV GOROOT=/usr/lib/go \ - GOPATH=/go - # PYTHONPYCACHEPREFIX="$HOME/.cache/cpython/" NV: not working for all packages :/ -# hadolint ignore=DL3044 -ENV PATH="$PATH":"$GOROOT"/bin:"$GOPATH"/bin -RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ - # Ignore npm package issues - yarn config set ignore-engines true || true - -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# -#PIP__START - -#PIP__END +# +#BUILD_PLATFORM_OTHER__END -#PIPVENV__START -RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ - mkdir -p "/venvs/ansible-lint" \ - && cd "/venvs/ansible-lint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip ansible-lint -RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ - mkdir -p "/venvs/djlint" \ - && cd "/venvs/djlint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip djlint -RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ - mkdir -p "/venvs/checkov" \ - && cd "/venvs/checkov" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip packaging checkov -RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ - mkdir -p "/venvs/semgrep" \ - && cd "/venvs/semgrep" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip semgrep -RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ - mkdir -p "/venvs/snakemake" \ - && cd "/venvs/snakemake" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakemake -RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ - mkdir -p "/venvs/snakefmt" \ - && cd "/venvs/snakefmt" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakefmt -RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ - mkdir -p "/venvs/proselint" \ - && cd "/venvs/proselint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip proselint -RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ - mkdir -p "/venvs/sqlfluff" \ - && cd "/venvs/sqlfluff" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip sqlfluff -RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ - mkdir -p "/venvs/yamllint" \ - && cd "/venvs/yamllint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip yamllint +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules -#PIPVENV__END +#NPM_APK__START +RUN apk add --update --no-cache \ + npm +#NPM_APK__END ############################ # Install NPM dependencies # @@ -247,31 +131,7 @@ WORKDIR / #NPM__END -# Add node packages to path # -ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ - NODE_PATH="/node-deps/node_modules" - -############################## -# Installs ruby dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#GEM__START -RUN echo 'gem: --no-document' >> ~/.gemrc && \ - gem install \ - scss_lint -#GEM__END - -############################## -# Installs rust dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#CARGO__START - -#CARGO__END +FROM busybox AS copy-collector ############################## # COPY instructions # @@ -300,6 +160,250 @@ COPY --link --from=vale /bin/vale /bin/vale COPY --link --from=lychee /usr/local/bin/lychee /usr/bin/ #COPY__END +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev \ + g++ \ + cmake +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START +RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ + mkdir /download \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ +&& pip download --cache-dir=/var/cache/pip --dest "/download" \ + ansible-lint \ + djlint \ + packaging \ + checkov \ + semgrep \ + snakemake \ + snakefmt \ + proselint \ + sqlfluff \ + yamllint + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/ansible-lint" \ + && cd "/venvs/ansible-lint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip ansible-lint +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/djlint" \ + && cd "/venvs/djlint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip djlint +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/checkov" \ + && cd "/venvs/checkov" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip packaging checkov +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/semgrep" \ + && cd "/venvs/semgrep" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip semgrep +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/snakemake" \ + && cd "/venvs/snakemake" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakemake +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/snakefmt" \ + && cd "/venvs/snakefmt" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakefmt +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/proselint" \ + && cd "/venvs/proselint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip proselint +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/sqlfluff" \ + && cd "/venvs/sqlfluff" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip sqlfluff +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/yamllint" \ + && cd "/venvs/yamllint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip yamllint + +#PIPVENV__END + +################## +# Get base image # +################## + # https://stackoverflow.com/a/73711302/699056 +FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu + +FROM python:3.11.3-alpine3.17 AS final +ARG GITHUB_TOKEN + +# https://stackoverflow.com/a/73711302/699056 +COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ +# https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 +RUN apk add --update --no-cache libc6-compat \ + gcompat \ + qemu-x86_64 + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#ARG__START + +#ARG__END + +#################### +# Run APK installs # +#################### + +WORKDIR / + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#APK__START +RUN apk add --no-cache \ + bash \ + ca-certificates \ + curl \ + gcc \ + git \ + git-lfs \ + libffi-dev \ + make \ + musl-dev \ + openssh \ + openjdk11 \ + py3-pyflakes \ + nodejs \ + npm \ + yarn \ + helm \ + gcompat \ + libc6-compat \ + libstdc++ \ + libc-dev \ + libxml2-dev \ + libxml2-utils \ + libgcc \ + nodejs-current \ + ruby \ + ruby-dev \ + ruby-bundler \ + ruby-rdoc \ + && git config --global core.autocrlf true +#APK__END + +# PATH for golang & python +ENV GOROOT=/usr/lib/go \ + GOPATH=/go + # PYTHONPYCACHEPREFIX="$HOME/.cache/cpython/" NV: not working for all packages :/ +# hadolint ignore=DL3044 +ENV PATH="$PATH":"$GOROOT"/bin:"$GOPATH"/bin +RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ + # Ignore npm package issues + yarn config set ignore-engines true || true + +COPY --link --from=python-venv /venvs /venvs + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#PIP__START + +#PIP__END + +#PIPVENV_PATH__START +ENV PATH="${PATH}":/venvs/ansible-lint/cross/bin:/venvs/djlint/cross/bin:/venvs/checkov/cross/bin:/venvs/semgrep/cross/bin:/venvs/snakemake/cross/bin:/venvs/snakefmt/cross/bin:/venvs/proselint/cross/bin:/venvs/sqlfluff/cross/bin:/venvs/yamllint/cross/bin +#PIPVENV_PATH__END + +# Add node packages to path # +ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ + NODE_PATH="/node-deps/node_modules" + +############################## +# Installs ruby dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#GEM__START +RUN echo 'gem: --no-document' >> ~/.gemrc && \ + gem install \ + scss_lint +#GEM__END + +############################## +# Installs rust dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#CARGO__START + +#CARGO__END + +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -326,24 +430,6 @@ RUN curl --retry 5 --retry-delay 5 -sSLO https://github.com/pinterest/ktlint/rel # #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/flavors/php/Dockerfile b/flavors/php/Dockerfile index 95a97860c9c..1ae8639a95f 100644 --- a/flavors/php/Dockerfile +++ b/flavors/php/Dockerfile @@ -31,18 +31,254 @@ FROM jdkato/vale:latest as vale FROM lycheeverse/lychee:latest-alpine as lychee #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START +# bash-exec installation +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 + +# +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START +RUN apk add --update --no-cache \ + npm +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START +WORKDIR /node-deps +RUN npm --no-cache install --ignore-scripts --omit=dev \ + jscpd \ + stylelint \ + stylelint-config-standard \ + stylelint-config-sass-guidelines \ + stylelint-scss \ + graphql \ + graphql-schema-linter \ + npm-groovy-lint \ + htmlhint \ + @prantlf/jsonlint \ + eslint \ + eslint-plugin-jsonc \ + @microsoft/eslint-formatter-sarif \ + v8r \ + prettier \ + markdownlint-cli \ + markdown-link-check \ + markdown-table-formatter \ + @stoplight/spectral-cli \ + secretlint \ + @secretlint/secretlint-rule-preset-recommend \ + @secretlint/secretlint-formatter-sarif \ + cspell \ + sql-lint \ + tekton-lint && \ + echo "Cleaning npm cache…" \ + && npm cache clean --force || true \ + && echo "Changing owner of node_modules files…" \ + && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ + && echo "Removing extra node_module files…" \ + && rm -rf /root/.npm/_cacache \ + && find . -name "*.d.ts" -delete \ + && find . -name "*.map" -delete \ + && find . -name "*.npmignore" -delete \ + && find . -name "*.travis.yml" -delete \ + && find . -name "CHANGELOG.md" -delete \ + && find . -name "README.md" -delete \ + && find . -name ".package-lock.json" -delete \ + && find . -name "package-lock.json" -delete \ + && find . -name "README.md" -delete +WORKDIR / + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#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 --link --from=build-platform /usr/bin/bash-exec /usr/bin/bash-exec +# 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=node_modules /node-deps /node-deps +COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint +COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker +COPY --link --from=dotenvlinter /dotenv-linter /usr/bin/dotenv-linter +COPY --link --from=kubeconform /kubeconform /usr/bin/ +COPY --link --chmod=755 --from=phpstan /composer/vendor/phpstan/phpstan/phpstan.phar /usr/bin/phpstan +COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ +COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ +COPY --link --from=trufflehog /usr/bin/trufflehog /usr/bin/ +COPY --link --from=vale /bin/vale /bin/vale +COPY --link --from=lychee /usr/local/bin/lychee /usr/bin/ +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev \ + g++ \ + cmake +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START +RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ + mkdir /download \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ +&& pip download --cache-dir=/var/cache/pip --dest "/download" \ + ansible-lint \ + djlint \ + packaging \ + checkov \ + semgrep \ + snakemake \ + snakefmt \ + proselint \ + sqlfluff \ + yamllint + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/ansible-lint" \ + && cd "/venvs/ansible-lint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip ansible-lint +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/djlint" \ + && cd "/venvs/djlint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip djlint +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/checkov" \ + && cd "/venvs/checkov" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip packaging checkov +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/semgrep" \ + && cd "/venvs/semgrep" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip semgrep +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/snakemake" \ + && cd "/venvs/snakemake" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakemake +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/snakefmt" \ + && cd "/venvs/snakefmt" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakefmt +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/proselint" \ + && cd "/venvs/proselint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip proselint +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/sqlfluff" \ + && cd "/venvs/sqlfluff" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip sqlfluff +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/yamllint" \ + && cd "/venvs/yamllint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip yamllint + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -117,6 +353,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -124,118 +362,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START -RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ - mkdir -p "/venvs/ansible-lint" \ - && cd "/venvs/ansible-lint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip ansible-lint -RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ - mkdir -p "/venvs/djlint" \ - && cd "/venvs/djlint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip djlint -RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ - mkdir -p "/venvs/checkov" \ - && cd "/venvs/checkov" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip packaging checkov -RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ - mkdir -p "/venvs/semgrep" \ - && cd "/venvs/semgrep" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip semgrep -RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ - mkdir -p "/venvs/snakemake" \ - && cd "/venvs/snakemake" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakemake -RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ - mkdir -p "/venvs/snakefmt" \ - && cd "/venvs/snakefmt" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakefmt -RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ - mkdir -p "/venvs/proselint" \ - && cd "/venvs/proselint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip proselint -RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ - mkdir -p "/venvs/sqlfluff" \ - && cd "/venvs/sqlfluff" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip sqlfluff -RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ - mkdir -p "/venvs/yamllint" \ - && cd "/venvs/yamllint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip yamllint - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START -WORKDIR /node-deps -RUN npm --no-cache install --ignore-scripts --omit=dev \ - jscpd \ - stylelint \ - stylelint-config-standard \ - stylelint-config-sass-guidelines \ - stylelint-scss \ - graphql \ - graphql-schema-linter \ - npm-groovy-lint \ - htmlhint \ - @prantlf/jsonlint \ - eslint \ - eslint-plugin-jsonc \ - @microsoft/eslint-formatter-sarif \ - v8r \ - prettier \ - markdownlint-cli \ - markdown-link-check \ - markdown-table-formatter \ - @stoplight/spectral-cli \ - secretlint \ - @secretlint/secretlint-rule-preset-recommend \ - @secretlint/secretlint-formatter-sarif \ - cspell \ - sql-lint \ - tekton-lint && \ - echo "Cleaning npm cache…" \ - && npm cache clean --force || true \ - && echo "Changing owner of node_modules files…" \ - && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ - && echo "Removing extra node_module files…" \ - && rm -rf /root/.npm/_cacache \ - && find . -name "*.d.ts" -delete \ - && find . -name "*.map" -delete \ - && find . -name "*.npmignore" -delete \ - && find . -name "*.travis.yml" -delete \ - && find . -name "CHANGELOG.md" -delete \ - && find . -name "README.md" -delete \ - && find . -name ".package-lock.json" -delete \ - && find . -name "package-lock.json" -delete \ - && find . -name "README.md" -delete -WORKDIR / - -#NPM__END +#PIPVENV_PATH__START +ENV PATH="${PATH}":/venvs/ansible-lint/cross/bin:/venvs/djlint/cross/bin:/venvs/checkov/cross/bin:/venvs/semgrep/cross/bin:/venvs/snakemake/cross/bin:/venvs/snakefmt/cross/bin:/venvs/proselint/cross/bin:/venvs/sqlfluff/cross/bin:/venvs/yamllint/cross/bin +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -263,33 +392,8 @@ RUN echo 'gem: --no-document' >> ~/.gemrc && \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#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 --link --from=build-platform /usr/bin/bash-exec /usr/bin/bash-exec -# 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=node_modules /node-deps /node-deps -COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint -COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker -COPY --link --from=dotenvlinter /dotenv-linter /usr/bin/dotenv-linter -COPY --link --from=kubeconform /kubeconform /usr/bin/ -COPY --link --chmod=755 --from=phpstan /composer/vendor/phpstan/phpstan/phpstan.phar /usr/bin/phpstan -COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ -COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ -COPY --link --from=trufflehog /usr/bin/trufflehog /usr/bin/ -COPY --link --from=vale /bin/vale /bin/vale -COPY --link --from=lychee /usr/local/bin/lychee /usr/bin/ -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -347,24 +451,6 @@ RUN curl -sSfL https://raw.githubusercontent.com/anchore/grype/main/install.sh | # #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/flavors/python/Dockerfile b/flavors/python/Dockerfile index 65137d94083..c94b664c6df 100644 --- a/flavors/python/Dockerfile +++ b/flavors/python/Dockerfile @@ -40,87 +40,196 @@ FROM jdkato/vale:latest as vale FROM lycheeverse/lychee:latest-alpine as lychee #FROM__END -################## -# Get base image # -################## -# https://stackoverflow.com/a/73711302/699056 -FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform -FROM python:3.11.4-alpine3.17 -ARG GITHUB_TOKEN +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START -# https://stackoverflow.com/a/73711302/699056 -COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ -# https://stackoverflow.com/a/73711302/699056 -RUN apk add --update --no-cache libc6-compat \ - gcompat \ - qemu-x86_64 +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START +# bash-exec installation +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 + +# +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START +RUN apk add --update --no-cache \ + npm +#NPM_APK__END +############################ +# Install NPM dependencies # ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# -#ARG__START -#ARG__END +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START +WORKDIR /node-deps +RUN npm --no-cache install --ignore-scripts --omit=dev \ + jscpd \ + stylelint \ + stylelint-config-standard \ + stylelint-config-sass-guidelines \ + stylelint-scss \ + graphql \ + graphql-schema-linter \ + npm-groovy-lint \ + htmlhint \ + @prantlf/jsonlint \ + eslint \ + eslint-plugin-jsonc \ + @microsoft/eslint-formatter-sarif \ + v8r \ + prettier \ + markdownlint-cli \ + markdown-link-check \ + markdown-table-formatter \ + @stoplight/spectral-cli \ + secretlint \ + @secretlint/secretlint-rule-preset-recommend \ + @secretlint/secretlint-formatter-sarif \ + cspell \ + sql-lint \ + tekton-lint && \ + echo "Cleaning npm cache…" \ + && npm cache clean --force || true \ + && echo "Changing owner of node_modules files…" \ + && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ + && echo "Removing extra node_module files…" \ + && rm -rf /root/.npm/_cacache \ + && find . -name "*.d.ts" -delete \ + && find . -name "*.map" -delete \ + && find . -name "*.npmignore" -delete \ + && find . -name "*.travis.yml" -delete \ + && find . -name "CHANGELOG.md" -delete \ + && find . -name "README.md" -delete \ + && find . -name ".package-lock.json" -delete \ + && find . -name "package-lock.json" -delete \ + && find . -name "README.md" -delete +WORKDIR / -#################### -# Run APK installs # -#################### +#NPM__END -WORKDIR / +FROM busybox AS copy-collector +############################## +# COPY instructions # ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# -#APK__START -RUN apk add --no-cache \ - bash \ - ca-certificates \ - curl \ + +#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 --link --from=build-platform /usr/bin/bash-exec /usr/bin/bash-exec +# 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=node_modules /node-deps /node-deps +COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint +COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker +COPY --link --from=dotenvlinter /dotenv-linter /usr/bin/dotenv-linter +COPY --link --from=kubeconform /kubeconform /usr/bin/ +COPY --link --from=checkmake /checkmake /usr/bin/checkmake +COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ +COPY --link --from=fetch-ruff /ruff /usr/bin/ruff +COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ +COPY --link --from=trufflehog /usr/bin/trufflehog /usr/bin/ +COPY --link --from=vale /bin/vale /bin/vale +COPY --link --from=lychee /usr/local/bin/lychee /usr/bin/ +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ gcc \ - git \ - git-lfs \ libffi-dev \ - make \ musl-dev \ - openssh \ - openjdk11 \ - py3-pyflakes \ - nodejs \ - npm \ - yarn \ - helm \ - gcompat \ - libc6-compat \ - libstdc++ \ - libc-dev \ - libxml2-dev \ - libxml2-utils \ - libgcc \ - nodejs-current \ - ruby \ - ruby-dev \ - ruby-bundler \ - ruby-rdoc \ - && git config --global core.autocrlf true -#APK__END + make \ + curl \ + openssl-dev \ + g++ \ + cmake +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START +RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ + mkdir /download \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ +&& pip download --cache-dir=/var/cache/pip --dest "/download" \ + ansible-lint \ + djlint \ + pylint \ + typing-extensions \ + black \ + flake8 \ + isort \ + black \ + bandit \ + bandit_sarif_formatter \ + bandit[toml] \ + mypy \ + pyright \ + packaging \ + checkov \ + semgrep \ + restructuredtext_lint \ + rstcheck \ + rstfmt \ + snakemake \ + snakefmt \ + proselint \ + sqlfluff \ + yamllint + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 -# PATH for golang & python -ENV GOROOT=/usr/lib/go \ - GOPATH=/go - # PYTHONPYCACHEPREFIX="$HOME/.cache/cpython/" NV: not working for all packages :/ -# hadolint ignore=DL3044 -ENV PATH="$PATH":"$GOROOT"/bin:"$GOPATH"/bin -RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ - # Ignore npm package issues - yarn config set ignore-engines true || true +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# -#PIP__START - -#PIP__END #PIPVENV__START RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ @@ -240,60 +349,95 @@ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ #PIPVENV__END -############################ -# Install NPM dependencies # +################## +# Get base image # +################## + # https://stackoverflow.com/a/73711302/699056 +FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu + +FROM python:3.11.3-alpine3.17 AS final +ARG GITHUB_TOKEN + +# https://stackoverflow.com/a/73711302/699056 +COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ +# https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 +RUN apk add --update --no-cache libc6-compat \ + gcompat \ + qemu-x86_64 + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# +#ARG__START + +#ARG__END + +#################### +# Run APK installs # +#################### -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START -WORKDIR /node-deps -RUN npm --no-cache install --ignore-scripts --omit=dev \ - jscpd \ - stylelint \ - stylelint-config-standard \ - stylelint-config-sass-guidelines \ - stylelint-scss \ - graphql \ - graphql-schema-linter \ - npm-groovy-lint \ - htmlhint \ - @prantlf/jsonlint \ - eslint \ - eslint-plugin-jsonc \ - @microsoft/eslint-formatter-sarif \ - v8r \ - prettier \ - markdownlint-cli \ - markdown-link-check \ - markdown-table-formatter \ - @stoplight/spectral-cli \ - secretlint \ - @secretlint/secretlint-rule-preset-recommend \ - @secretlint/secretlint-formatter-sarif \ - cspell \ - sql-lint \ - tekton-lint && \ - echo "Cleaning npm cache…" \ - && npm cache clean --force || true \ - && echo "Changing owner of node_modules files…" \ - && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ - && echo "Removing extra node_module files…" \ - && rm -rf /root/.npm/_cacache \ - && find . -name "*.d.ts" -delete \ - && find . -name "*.map" -delete \ - && find . -name "*.npmignore" -delete \ - && find . -name "*.travis.yml" -delete \ - && find . -name "CHANGELOG.md" -delete \ - && find . -name "README.md" -delete \ - && find . -name ".package-lock.json" -delete \ - && find . -name "package-lock.json" -delete \ - && find . -name "README.md" -delete WORKDIR / -#NPM__END +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#APK__START +RUN apk add --no-cache \ + bash \ + ca-certificates \ + curl \ + gcc \ + git \ + git-lfs \ + libffi-dev \ + make \ + musl-dev \ + openssh \ + openjdk11 \ + py3-pyflakes \ + nodejs \ + npm \ + yarn \ + helm \ + gcompat \ + libc6-compat \ + libstdc++ \ + libc-dev \ + libxml2-dev \ + libxml2-utils \ + libgcc \ + nodejs-current \ + ruby \ + ruby-dev \ + ruby-bundler \ + ruby-rdoc \ + && git config --global core.autocrlf true +#APK__END + +# PATH for golang & python +ENV GOROOT=/usr/lib/go \ + GOPATH=/go + # PYTHONPYCACHEPREFIX="$HOME/.cache/cpython/" NV: not working for all packages :/ +# hadolint ignore=DL3044 +ENV PATH="$PATH":"$GOROOT"/bin:"$GOPATH"/bin +RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ + # Ignore npm package issues + yarn config set ignore-engines true || true + +COPY --link --from=python-venv /venvs /venvs + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#PIP__START + +#PIP__END + +#PIPVENV_PATH__START +ENV PATH="${PATH}":/venvs/ansible-lint/cross/bin:/venvs/djlint/cross/bin:/venvs/pylint/cross/bin:/venvs/black/cross/bin:/venvs/flake8/cross/bin:/venvs/isort/cross/bin:/venvs/bandit/cross/bin:/venvs/mypy/cross/bin:/venvs/pyright/cross/bin:/venvs/checkov/cross/bin:/venvs/semgrep/cross/bin:/venvs/rst-lint/cross/bin:/venvs/rstcheck/cross/bin:/venvs/rstfmt/cross/bin:/venvs/snakemake/cross/bin:/venvs/snakefmt/cross/bin:/venvs/proselint/cross/bin:/venvs/sqlfluff/cross/bin:/venvs/yamllint/cross/bin +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -321,34 +465,8 @@ RUN echo 'gem: --no-document' >> ~/.gemrc && \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#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 --link --from=build-platform /usr/bin/bash-exec /usr/bin/bash-exec -# 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=node_modules /node-deps /node-deps -COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint -COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker -COPY --link --from=dotenvlinter /dotenv-linter /usr/bin/dotenv-linter -COPY --link --from=kubeconform /kubeconform /usr/bin/ -COPY --link --from=checkmake /checkmake /usr/bin/checkmake -COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ -COPY --link --from=fetch-ruff /ruff /usr/bin/ruff -COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ -COPY --link --from=trufflehog /usr/bin/trufflehog /usr/bin/ -COPY --link --from=vale /bin/vale /bin/vale -COPY --link --from=lychee /usr/local/bin/lychee /usr/bin/ -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -380,24 +498,6 @@ RUN curl -sSfL https://raw.githubusercontent.com/anchore/grype/main/install.sh | # #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/flavors/ruby/Dockerfile b/flavors/ruby/Dockerfile index 0d6785b52e4..eb2f2ea4792 100644 --- a/flavors/ruby/Dockerfile +++ b/flavors/ruby/Dockerfile @@ -30,87 +30,180 @@ FROM jdkato/vale:latest as vale FROM lycheeverse/lychee:latest-alpine as lychee #FROM__END -################## -# Get base image # -################## -# https://stackoverflow.com/a/73711302/699056 -FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform -FROM python:3.11.4-alpine3.17 -ARG GITHUB_TOKEN +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START -# https://stackoverflow.com/a/73711302/699056 -COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ -# https://stackoverflow.com/a/73711302/699056 -RUN apk add --update --no-cache libc6-compat \ - gcompat \ - qemu-x86_64 +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START +# bash-exec installation +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 + +# +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START +RUN apk add --update --no-cache \ + npm +#NPM_APK__END +############################ +# Install NPM dependencies # ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# -#ARG__START -#ARG__END +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START +WORKDIR /node-deps +RUN npm --no-cache install --ignore-scripts --omit=dev \ + jscpd \ + stylelint \ + stylelint-config-standard \ + stylelint-config-sass-guidelines \ + stylelint-scss \ + graphql \ + graphql-schema-linter \ + npm-groovy-lint \ + htmlhint \ + @prantlf/jsonlint \ + eslint \ + eslint-plugin-jsonc \ + @microsoft/eslint-formatter-sarif \ + v8r \ + prettier \ + markdownlint-cli \ + markdown-link-check \ + markdown-table-formatter \ + @stoplight/spectral-cli \ + secretlint \ + @secretlint/secretlint-rule-preset-recommend \ + @secretlint/secretlint-formatter-sarif \ + cspell \ + sql-lint \ + tekton-lint && \ + echo "Cleaning npm cache…" \ + && npm cache clean --force || true \ + && echo "Changing owner of node_modules files…" \ + && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ + && echo "Removing extra node_module files…" \ + && rm -rf /root/.npm/_cacache \ + && find . -name "*.d.ts" -delete \ + && find . -name "*.map" -delete \ + && find . -name "*.npmignore" -delete \ + && find . -name "*.travis.yml" -delete \ + && find . -name "CHANGELOG.md" -delete \ + && find . -name "README.md" -delete \ + && find . -name ".package-lock.json" -delete \ + && find . -name "package-lock.json" -delete \ + && find . -name "README.md" -delete +WORKDIR / -#################### -# Run APK installs # -#################### +#NPM__END -WORKDIR / +FROM busybox AS copy-collector +############################## +# COPY instructions # ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# -#APK__START -RUN apk add --no-cache \ - bash \ - ca-certificates \ - curl \ + +#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 --link --from=build-platform /usr/bin/bash-exec /usr/bin/bash-exec +# 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=node_modules /node-deps /node-deps +COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint +COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker +COPY --link --from=dotenvlinter /dotenv-linter /usr/bin/dotenv-linter +COPY --link --from=kubeconform /kubeconform /usr/bin/ +COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ +COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ +COPY --link --from=trufflehog /usr/bin/trufflehog /usr/bin/ +COPY --link --from=vale /bin/vale /bin/vale +COPY --link --from=lychee /usr/local/bin/lychee /usr/bin/ +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ gcc \ - git \ - git-lfs \ libffi-dev \ - make \ musl-dev \ - openssh \ - openjdk11 \ - py3-pyflakes \ - nodejs \ - npm \ - yarn \ - helm \ - gcompat \ - libc6-compat \ - libstdc++ \ - libc-dev \ - libxml2-dev \ - libxml2-utils \ - libgcc \ - nodejs-current \ - ruby \ - ruby-dev \ - ruby-bundler \ - ruby-rdoc \ - && git config --global core.autocrlf true -#APK__END + make \ + curl \ + openssl-dev \ + g++ \ + cmake +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START +RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ + mkdir /download \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ +&& pip download --cache-dir=/var/cache/pip --dest "/download" \ + ansible-lint \ + djlint \ + packaging \ + checkov \ + semgrep \ + snakemake \ + snakefmt \ + proselint \ + sqlfluff \ + yamllint + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 -# PATH for golang & python -ENV GOROOT=/usr/lib/go \ - GOPATH=/go - # PYTHONPYCACHEPREFIX="$HOME/.cache/cpython/" NV: not working for all packages :/ -# hadolint ignore=DL3044 -ENV PATH="$PATH":"$GOROOT"/bin:"$GOPATH"/bin -RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ - # Ignore npm package issues - yarn config set ignore-engines true || true +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# -#PIP__START - -#PIP__END #PIPVENV__START RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ @@ -170,60 +263,95 @@ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ #PIPVENV__END -############################ -# Install NPM dependencies # +################## +# Get base image # +################## + # https://stackoverflow.com/a/73711302/699056 +FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu + +FROM python:3.11.3-alpine3.17 AS final +ARG GITHUB_TOKEN + +# https://stackoverflow.com/a/73711302/699056 +COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ +# https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 +RUN apk add --update --no-cache libc6-compat \ + gcompat \ + qemu-x86_64 + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# +#ARG__START + +#ARG__END + +#################### +# Run APK installs # +#################### -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START -WORKDIR /node-deps -RUN npm --no-cache install --ignore-scripts --omit=dev \ - jscpd \ - stylelint \ - stylelint-config-standard \ - stylelint-config-sass-guidelines \ - stylelint-scss \ - graphql \ - graphql-schema-linter \ - npm-groovy-lint \ - htmlhint \ - @prantlf/jsonlint \ - eslint \ - eslint-plugin-jsonc \ - @microsoft/eslint-formatter-sarif \ - v8r \ - prettier \ - markdownlint-cli \ - markdown-link-check \ - markdown-table-formatter \ - @stoplight/spectral-cli \ - secretlint \ - @secretlint/secretlint-rule-preset-recommend \ - @secretlint/secretlint-formatter-sarif \ - cspell \ - sql-lint \ - tekton-lint && \ - echo "Cleaning npm cache…" \ - && npm cache clean --force || true \ - && echo "Changing owner of node_modules files…" \ - && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ - && echo "Removing extra node_module files…" \ - && rm -rf /root/.npm/_cacache \ - && find . -name "*.d.ts" -delete \ - && find . -name "*.map" -delete \ - && find . -name "*.npmignore" -delete \ - && find . -name "*.travis.yml" -delete \ - && find . -name "CHANGELOG.md" -delete \ - && find . -name "README.md" -delete \ - && find . -name ".package-lock.json" -delete \ - && find . -name "package-lock.json" -delete \ - && find . -name "README.md" -delete WORKDIR / -#NPM__END +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#APK__START +RUN apk add --no-cache \ + bash \ + ca-certificates \ + curl \ + gcc \ + git \ + git-lfs \ + libffi-dev \ + make \ + musl-dev \ + openssh \ + openjdk11 \ + py3-pyflakes \ + nodejs \ + npm \ + yarn \ + helm \ + gcompat \ + libc6-compat \ + libstdc++ \ + libc-dev \ + libxml2-dev \ + libxml2-utils \ + libgcc \ + nodejs-current \ + ruby \ + ruby-dev \ + ruby-bundler \ + ruby-rdoc \ + && git config --global core.autocrlf true +#APK__END + +# PATH for golang & python +ENV GOROOT=/usr/lib/go \ + GOPATH=/go + # PYTHONPYCACHEPREFIX="$HOME/.cache/cpython/" NV: not working for all packages :/ +# hadolint ignore=DL3044 +ENV PATH="$PATH":"$GOROOT"/bin:"$GOPATH"/bin +RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ + # Ignore npm package issues + yarn config set ignore-engines true || true + +COPY --link --from=python-venv /venvs /venvs + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#PIP__START + +#PIP__END + +#PIPVENV_PATH__START +ENV PATH="${PATH}":/venvs/ansible-lint/cross/bin:/venvs/djlint/cross/bin:/venvs/checkov/cross/bin:/venvs/semgrep/cross/bin:/venvs/snakemake/cross/bin:/venvs/snakefmt/cross/bin:/venvs/proselint/cross/bin:/venvs/sqlfluff/cross/bin:/venvs/yamllint/cross/bin +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -257,32 +385,8 @@ RUN echo 'gem: --no-document' >> ~/.gemrc && \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#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 --link --from=build-platform /usr/bin/bash-exec /usr/bin/bash-exec -# 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=node_modules /node-deps /node-deps -COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint -COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker -COPY --link --from=dotenvlinter /dotenv-linter /usr/bin/dotenv-linter -COPY --link --from=kubeconform /kubeconform /usr/bin/ -COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ -COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ -COPY --link --from=trufflehog /usr/bin/trufflehog /usr/bin/ -COPY --link --from=vale /bin/vale /bin/vale -COPY --link --from=lychee /usr/local/bin/lychee /usr/bin/ -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -310,24 +414,6 @@ RUN curl --retry 5 --retry-delay 5 -sSLO https://github.com/pinterest/ktlint/rel # #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/flavors/rust/Dockerfile b/flavors/rust/Dockerfile index 4514cac49dc..33448e724ce 100644 --- a/flavors/rust/Dockerfile +++ b/flavors/rust/Dockerfile @@ -58,96 +58,190 @@ RUN rustup-init -y --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-u RUN --mount=type=cache,id=cargo-${TARGETARCH},sharing=locked,target=/cargo/.cargo/registry/,uid=63425 \ . /cargo/.cargo/env \ - && cargo binstall --no-confirm --no-symlinks sarif-fmt shellcheck-sarif --root /tmp --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") + && cargo binstall --no-confirm --no-symlinks shellcheck-sarif sarif-fmt --root /tmp --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") FROM scratch AS cargo COPY --link --from=cargo-build /tmp/bin/* /bin/ -RUN ["/bin/sarif-fmt", "--help"] RUN ["/bin/shellcheck-sarif", "--help"] +RUN ["/bin/sarif-fmt", "--help"] #FROM__END -################## -# Get base image # -################## -# https://stackoverflow.com/a/73711302/699056 -FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform -FROM python:3.11.4-alpine3.17 -ARG GITHUB_TOKEN +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START -# https://stackoverflow.com/a/73711302/699056 -COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ -# https://stackoverflow.com/a/73711302/699056 -RUN apk add --update --no-cache libc6-compat \ - gcompat \ - qemu-x86_64 +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START +# bash-exec installation +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 + +# +#BUILD_PLATFORM_OTHER__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START +RUN apk add --update --no-cache \ + npm +#NPM_APK__END + +############################ +# Install NPM dependencies # ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# -#ARG__START -#ARG__END +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START +WORKDIR /node-deps +RUN npm --no-cache install --ignore-scripts --omit=dev \ + jscpd \ + stylelint \ + stylelint-config-standard \ + stylelint-config-sass-guidelines \ + stylelint-scss \ + graphql \ + graphql-schema-linter \ + npm-groovy-lint \ + htmlhint \ + @prantlf/jsonlint \ + eslint \ + eslint-plugin-jsonc \ + @microsoft/eslint-formatter-sarif \ + v8r \ + prettier \ + markdownlint-cli \ + markdown-link-check \ + markdown-table-formatter \ + @stoplight/spectral-cli \ + secretlint \ + @secretlint/secretlint-rule-preset-recommend \ + @secretlint/secretlint-formatter-sarif \ + cspell \ + sql-lint \ + tekton-lint && \ + echo "Cleaning npm cache…" \ + && npm cache clean --force || true \ + && echo "Changing owner of node_modules files…" \ + && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ + && echo "Removing extra node_module files…" \ + && rm -rf /root/.npm/_cacache \ + && find . -name "*.d.ts" -delete \ + && find . -name "*.map" -delete \ + && find . -name "*.npmignore" -delete \ + && find . -name "*.travis.yml" -delete \ + && find . -name "CHANGELOG.md" -delete \ + && find . -name "README.md" -delete \ + && find . -name ".package-lock.json" -delete \ + && find . -name "package-lock.json" -delete \ + && find . -name "README.md" -delete +WORKDIR / -#################### -# Run APK installs # -#################### +#NPM__END -WORKDIR / +FROM busybox AS copy-collector +############################## +# COPY instructions # ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# -#APK__START -RUN apk add --no-cache \ - bash \ - ca-certificates \ - curl \ + +#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 --link --from=build-platform /usr/bin/bash-exec /usr/bin/bash-exec +# 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=node_modules /node-deps /node-deps +COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint +COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker +COPY --link --from=dotenvlinter /dotenv-linter /usr/bin/dotenv-linter +COPY --link --from=kubeconform /kubeconform /usr/bin/ +COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ +COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ +COPY --link --from=trufflehog /usr/bin/trufflehog /usr/bin/ +COPY --link --from=vale /bin/vale /bin/vale +COPY --link --from=lychee /usr/local/bin/lychee /usr/bin/ +COPY --link --from=cargo /bin/* /usr/bin/ +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ gcc \ - git \ - git-lfs \ libffi-dev \ - make \ musl-dev \ - openssh \ - openjdk11 \ - py3-pyflakes \ - nodejs \ - npm \ - yarn \ - helm \ - gcompat \ - libc6-compat \ - libstdc++ \ - libc-dev \ - libxml2-dev \ - libxml2-utils \ - libgcc \ - nodejs-current \ - ruby \ - ruby-dev \ - ruby-bundler \ - ruby-rdoc \ - && git config --global core.autocrlf true -#APK__END + make \ + curl \ + openssl-dev \ + g++ \ + cmake +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START +RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ + mkdir /download \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ +&& pip download --cache-dir=/var/cache/pip --dest "/download" \ + ansible-lint \ + djlint \ + packaging \ + checkov \ + semgrep \ + snakemake \ + snakefmt \ + proselint \ + sqlfluff \ + yamllint + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 -# PATH for golang & python -ENV GOROOT=/usr/lib/go \ - GOPATH=/go - # PYTHONPYCACHEPREFIX="$HOME/.cache/cpython/" NV: not working for all packages :/ -# hadolint ignore=DL3044 -ENV PATH="$PATH":"$GOROOT"/bin:"$GOPATH"/bin -RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ - # Ignore npm package issues - yarn config set ignore-engines true || true +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# -#PIP__START - -#PIP__END #PIPVENV__START RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ @@ -207,60 +301,95 @@ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ #PIPVENV__END -############################ -# Install NPM dependencies # +################## +# Get base image # +################## + # https://stackoverflow.com/a/73711302/699056 +FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu + +FROM python:3.11.3-alpine3.17 AS final +ARG GITHUB_TOKEN + +# https://stackoverflow.com/a/73711302/699056 +COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ +# https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 +RUN apk add --update --no-cache libc6-compat \ + gcompat \ + qemu-x86_64 + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# +#ARG__START + +#ARG__END + +#################### +# Run APK installs # +#################### -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START -WORKDIR /node-deps -RUN npm --no-cache install --ignore-scripts --omit=dev \ - jscpd \ - stylelint \ - stylelint-config-standard \ - stylelint-config-sass-guidelines \ - stylelint-scss \ - graphql \ - graphql-schema-linter \ - npm-groovy-lint \ - htmlhint \ - @prantlf/jsonlint \ - eslint \ - eslint-plugin-jsonc \ - @microsoft/eslint-formatter-sarif \ - v8r \ - prettier \ - markdownlint-cli \ - markdown-link-check \ - markdown-table-formatter \ - @stoplight/spectral-cli \ - secretlint \ - @secretlint/secretlint-rule-preset-recommend \ - @secretlint/secretlint-formatter-sarif \ - cspell \ - sql-lint \ - tekton-lint && \ - echo "Cleaning npm cache…" \ - && npm cache clean --force || true \ - && echo "Changing owner of node_modules files…" \ - && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ - && echo "Removing extra node_module files…" \ - && rm -rf /root/.npm/_cacache \ - && find . -name "*.d.ts" -delete \ - && find . -name "*.map" -delete \ - && find . -name "*.npmignore" -delete \ - && find . -name "*.travis.yml" -delete \ - && find . -name "CHANGELOG.md" -delete \ - && find . -name "README.md" -delete \ - && find . -name ".package-lock.json" -delete \ - && find . -name "package-lock.json" -delete \ - && find . -name "README.md" -delete WORKDIR / -#NPM__END +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#APK__START +RUN apk add --no-cache \ + bash \ + ca-certificates \ + curl \ + gcc \ + git \ + git-lfs \ + libffi-dev \ + make \ + musl-dev \ + openssh \ + openjdk11 \ + py3-pyflakes \ + nodejs \ + npm \ + yarn \ + helm \ + gcompat \ + libc6-compat \ + libstdc++ \ + libc-dev \ + libxml2-dev \ + libxml2-utils \ + libgcc \ + nodejs-current \ + ruby \ + ruby-dev \ + ruby-bundler \ + ruby-rdoc \ + && git config --global core.autocrlf true +#APK__END + +# PATH for golang & python +ENV GOROOT=/usr/lib/go \ + GOPATH=/go + # PYTHONPYCACHEPREFIX="$HOME/.cache/cpython/" NV: not working for all packages :/ +# hadolint ignore=DL3044 +ENV PATH="$PATH":"$GOROOT"/bin:"$GOPATH"/bin +RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ + # Ignore npm package issues + yarn config set ignore-engines true || true + +COPY --link --from=python-venv /venvs /venvs + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#PIP__START + +#PIP__END + +#PIPVENV_PATH__START +ENV PATH="${PATH}":/venvs/ansible-lint/cross/bin:/venvs/djlint/cross/bin:/venvs/checkov/cross/bin:/venvs/semgrep/cross/bin:/venvs/snakemake/cross/bin:/venvs/snakefmt/cross/bin:/venvs/proselint/cross/bin:/venvs/sqlfluff/cross/bin:/venvs/yamllint/cross/bin +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -292,33 +421,8 @@ RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-too ENV PATH="/root/.cargo/bin:${PATH}" #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#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 --link --from=build-platform /usr/bin/bash-exec /usr/bin/bash-exec -# 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=node_modules /node-deps /node-deps -COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint -COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker -COPY --link --from=dotenvlinter /dotenv-linter /usr/bin/dotenv-linter -COPY --link --from=kubeconform /kubeconform /usr/bin/ -COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ -COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ -COPY --link --from=trufflehog /usr/bin/trufflehog /usr/bin/ -COPY --link --from=vale /bin/vale /bin/vale -COPY --link --from=lychee /usr/local/bin/lychee /usr/bin/ -COPY --link --from=cargo /bin/* /usr/bin/ -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -346,24 +450,6 @@ RUN curl --retry 5 --retry-delay 5 -sSLO https://github.com/pinterest/ktlint/rel # #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/flavors/salesforce/Dockerfile b/flavors/salesforce/Dockerfile index af33b000c95..fc90bdf424a 100644 --- a/flavors/salesforce/Dockerfile +++ b/flavors/salesforce/Dockerfile @@ -30,87 +30,183 @@ FROM jdkato/vale:latest as vale FROM lycheeverse/lychee:latest-alpine as lychee #FROM__END -################## -# Get base image # -################## -# https://stackoverflow.com/a/73711302/699056 -FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform -FROM python:3.11.4-alpine3.17 -ARG GITHUB_TOKEN +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START -# https://stackoverflow.com/a/73711302/699056 -COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ -# https://stackoverflow.com/a/73711302/699056 -RUN apk add --update --no-cache libc6-compat \ - gcompat \ - qemu-x86_64 +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START +# bash-exec installation +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 + +# +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START +RUN apk add --update --no-cache \ + npm +#NPM_APK__END +############################ +# Install NPM dependencies # ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# -#ARG__START -#ARG__END +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START +WORKDIR /node-deps +RUN npm --no-cache install --ignore-scripts --omit=dev \ + sfdx-cli \ + jscpd \ + stylelint \ + stylelint-config-standard \ + stylelint-config-sass-guidelines \ + stylelint-scss \ + graphql \ + graphql-schema-linter \ + npm-groovy-lint \ + htmlhint \ + @prantlf/jsonlint \ + eslint \ + eslint-plugin-jsonc \ + @microsoft/eslint-formatter-sarif \ + v8r \ + prettier \ + npm-package-json-lint \ + npm-package-json-lint-config-default \ + markdownlint-cli \ + markdown-link-check \ + markdown-table-formatter \ + @stoplight/spectral-cli \ + secretlint \ + @secretlint/secretlint-rule-preset-recommend \ + @secretlint/secretlint-formatter-sarif \ + cspell \ + sql-lint \ + tekton-lint && \ + echo "Cleaning npm cache…" \ + && npm cache clean --force || true \ + && echo "Changing owner of node_modules files…" \ + && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ + && echo "Removing extra node_module files…" \ + && rm -rf /root/.npm/_cacache \ + && find . -name "*.d.ts" -delete \ + && find . -name "*.map" -delete \ + && find . -name "*.npmignore" -delete \ + && find . -name "*.travis.yml" -delete \ + && find . -name "CHANGELOG.md" -delete \ + && find . -name "README.md" -delete \ + && find . -name ".package-lock.json" -delete \ + && find . -name "package-lock.json" -delete \ + && find . -name "README.md" -delete +WORKDIR / -#################### -# Run APK installs # -#################### +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START +COPY --link --from=node_modules /node-deps /node-deps +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 --link --from=build-platform /usr/bin/bash-exec /usr/bin/bash-exec +# 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=dotenvlinter /dotenv-linter /usr/bin/dotenv-linter +COPY --link --from=kubeconform /kubeconform /usr/bin/ +COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ +COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ +COPY --link --from=trufflehog /usr/bin/trufflehog /usr/bin/ +COPY --link --from=vale /bin/vale /bin/vale +COPY --link --from=lychee /usr/local/bin/lychee /usr/bin/ +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv -WORKDIR / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# -#APK__START -RUN apk add --no-cache \ - bash \ - ca-certificates \ - curl \ + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ gcc \ - git \ - git-lfs \ libffi-dev \ - make \ musl-dev \ - openssh \ - openjdk11 \ - py3-pyflakes \ - nodejs \ - npm \ - yarn \ - helm \ - gcompat \ - libc6-compat \ - libstdc++ \ - libc-dev \ - libxml2-dev \ - libxml2-utils \ - libgcc \ - nodejs-current \ - ruby \ - ruby-dev \ - ruby-bundler \ - ruby-rdoc \ - && git config --global core.autocrlf true -#APK__END + make \ + curl \ + openssl-dev \ + g++ \ + cmake +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START +RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ + mkdir /download \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ +&& pip download --cache-dir=/var/cache/pip --dest "/download" \ + ansible-lint \ + djlint \ + packaging \ + checkov \ + semgrep \ + snakemake \ + snakefmt \ + proselint \ + sqlfluff \ + yamllint + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 -# PATH for golang & python -ENV GOROOT=/usr/lib/go \ - GOPATH=/go - # PYTHONPYCACHEPREFIX="$HOME/.cache/cpython/" NV: not working for all packages :/ -# hadolint ignore=DL3044 -ENV PATH="$PATH":"$GOROOT"/bin:"$GOPATH"/bin -RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ - # Ignore npm package issues - yarn config set ignore-engines true || true +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# -#PIP__START - -#PIP__END #PIPVENV__START RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ @@ -170,63 +266,95 @@ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ #PIPVENV__END -############################ -# Install NPM dependencies # +################## +# Get base image # +################## + # https://stackoverflow.com/a/73711302/699056 +FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu + +FROM python:3.11.3-alpine3.17 AS final +ARG GITHUB_TOKEN + +# https://stackoverflow.com/a/73711302/699056 +COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ +# https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 +RUN apk add --update --no-cache libc6-compat \ + gcompat \ + qemu-x86_64 + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# +#ARG__START + +#ARG__END + +#################### +# Run APK installs # +#################### -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START -WORKDIR /node-deps -RUN npm --no-cache install --ignore-scripts --omit=dev \ - sfdx-cli \ - jscpd \ - stylelint \ - stylelint-config-standard \ - stylelint-config-sass-guidelines \ - stylelint-scss \ - graphql \ - graphql-schema-linter \ - npm-groovy-lint \ - htmlhint \ - @prantlf/jsonlint \ - eslint \ - eslint-plugin-jsonc \ - @microsoft/eslint-formatter-sarif \ - v8r \ - prettier \ - npm-package-json-lint \ - npm-package-json-lint-config-default \ - markdownlint-cli \ - markdown-link-check \ - markdown-table-formatter \ - @stoplight/spectral-cli \ - secretlint \ - @secretlint/secretlint-rule-preset-recommend \ - @secretlint/secretlint-formatter-sarif \ - cspell \ - sql-lint \ - tekton-lint && \ - echo "Cleaning npm cache…" \ - && npm cache clean --force || true \ - && echo "Changing owner of node_modules files…" \ - && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ - && echo "Removing extra node_module files…" \ - && rm -rf /root/.npm/_cacache \ - && find . -name "*.d.ts" -delete \ - && find . -name "*.map" -delete \ - && find . -name "*.npmignore" -delete \ - && find . -name "*.travis.yml" -delete \ - && find . -name "CHANGELOG.md" -delete \ - && find . -name "README.md" -delete \ - && find . -name ".package-lock.json" -delete \ - && find . -name "package-lock.json" -delete \ - && find . -name "README.md" -delete WORKDIR / -#NPM__END +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#APK__START +RUN apk add --no-cache \ + bash \ + ca-certificates \ + curl \ + gcc \ + git \ + git-lfs \ + libffi-dev \ + make \ + musl-dev \ + openssh \ + openjdk11 \ + py3-pyflakes \ + nodejs \ + npm \ + yarn \ + helm \ + gcompat \ + libc6-compat \ + libstdc++ \ + libc-dev \ + libxml2-dev \ + libxml2-utils \ + libgcc \ + nodejs-current \ + ruby \ + ruby-dev \ + ruby-bundler \ + ruby-rdoc \ + && git config --global core.autocrlf true +#APK__END + +# PATH for golang & python +ENV GOROOT=/usr/lib/go \ + GOPATH=/go + # PYTHONPYCACHEPREFIX="$HOME/.cache/cpython/" NV: not working for all packages :/ +# hadolint ignore=DL3044 +ENV PATH="$PATH":"$GOROOT"/bin:"$GOPATH"/bin +RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ + # Ignore npm package issues + yarn config set ignore-engines true || true + +COPY --link --from=python-venv /venvs /venvs + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#PIP__START + +#PIP__END + +#PIPVENV_PATH__START +ENV PATH="${PATH}":/venvs/ansible-lint/cross/bin:/venvs/djlint/cross/bin:/venvs/checkov/cross/bin:/venvs/semgrep/cross/bin:/venvs/snakemake/cross/bin:/venvs/snakefmt/cross/bin:/venvs/proselint/cross/bin:/venvs/sqlfluff/cross/bin:/venvs/yamllint/cross/bin +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -254,32 +382,8 @@ RUN echo 'gem: --no-document' >> ~/.gemrc && \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START -COPY --link --from=node_modules /node-deps /node-deps -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 --link --from=build-platform /usr/bin/bash-exec /usr/bin/bash-exec -# 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=dotenvlinter /dotenv-linter /usr/bin/dotenv-linter -COPY --link --from=kubeconform /kubeconform /usr/bin/ -COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ -COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ -COPY --link --from=trufflehog /usr/bin/trufflehog /usr/bin/ -COPY --link --from=vale /bin/vale /bin/vale -COPY --link --from=lychee /usr/local/bin/lychee /usr/bin/ -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -331,24 +435,6 @@ RUN echo y|sfdx plugins:install sfdx-hardis \ # #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/flavors/security/Dockerfile b/flavors/security/Dockerfile index dc9d95d1770..2bc93b5f560 100644 --- a/flavors/security/Dockerfile +++ b/flavors/security/Dockerfile @@ -26,18 +26,200 @@ FROM tenable/terrascan:1.18.1 as terrascan FROM alpine/terragrunt:latest as terragrunt #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START +# bash-exec installation +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 + +# +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START +RUN apk add --update --no-cache \ + npm +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START +WORKDIR /node-deps +RUN npm --no-cache install --ignore-scripts --omit=dev \ + secretlint \ + @secretlint/secretlint-rule-preset-recommend \ + @secretlint/secretlint-formatter-sarif && \ + echo "Cleaning npm cache…" \ + && npm cache clean --force || true \ + && echo "Changing owner of node_modules files…" \ + && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ + && echo "Removing extra node_module files…" \ + && rm -rf /root/.npm/_cacache \ + && find . -name "*.d.ts" -delete \ + && find . -name "*.map" -delete \ + && find . -name "*.npmignore" -delete \ + && find . -name "*.travis.yml" -delete \ + && find . -name "CHANGELOG.md" -delete \ + && find . -name "README.md" -delete \ + && find . -name ".package-lock.json" -delete \ + && find . -name "package-lock.json" -delete \ + && find . -name "README.md" -delete +WORKDIR / + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START +COPY --link --from=build-platform /usr/bin/bash-exec /usr/bin/bash-exec +COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck +COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint +COPY --link --from=kubeconform /kubeconform /usr/bin/ +COPY --link --from=dustilock /usr/bin/dustilock /usr/bin/dustilock +COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ +COPY --link --from=kics /app/bin/kics /usr/bin/ +COPY --from=kics /app/bin/assets /opt/kics/assets/ +COPY --link --from=node_modules /node-deps /node-deps +COPY --link --from=trufflehog /usr/bin/trufflehog /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__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev \ + g++ \ + cmake +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START +RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ + mkdir /download \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ +&& pip download --cache-dir=/var/cache/pip --dest "/download" \ + ansible-lint \ + cfn-lint \ + bandit \ + bandit_sarif_formatter \ + bandit[toml] \ + packaging \ + checkov \ + semgrep + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/ansible-lint" \ + && cd "/venvs/ansible-lint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip ansible-lint +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/cfn-lint" \ + && cd "/venvs/cfn-lint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip cfn-lint +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/bandit" \ + && cd "/venvs/bandit" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip bandit bandit_sarif_formatter bandit[toml] +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/checkov" \ + && cd "/venvs/checkov" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip packaging checkov +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/semgrep" \ + && cd "/venvs/semgrep" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip semgrep + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -97,6 +279,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -104,72 +288,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START -RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ - mkdir -p "/venvs/ansible-lint" \ - && cd "/venvs/ansible-lint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip ansible-lint -RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ - mkdir -p "/venvs/cfn-lint" \ - && cd "/venvs/cfn-lint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip cfn-lint -RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ - mkdir -p "/venvs/bandit" \ - && cd "/venvs/bandit" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip bandit bandit_sarif_formatter bandit[toml] -RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ - mkdir -p "/venvs/checkov" \ - && cd "/venvs/checkov" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip packaging checkov -RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ - mkdir -p "/venvs/semgrep" \ - && cd "/venvs/semgrep" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip semgrep - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START -WORKDIR /node-deps -RUN npm --no-cache install --ignore-scripts --omit=dev \ - secretlint \ - @secretlint/secretlint-rule-preset-recommend \ - @secretlint/secretlint-formatter-sarif && \ - echo "Cleaning npm cache…" \ - && npm cache clean --force || true \ - && echo "Changing owner of node_modules files…" \ - && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ - && echo "Removing extra node_module files…" \ - && rm -rf /root/.npm/_cacache \ - && find . -name "*.d.ts" -delete \ - && find . -name "*.map" -delete \ - && find . -name "*.npmignore" -delete \ - && find . -name "*.travis.yml" -delete \ - && find . -name "CHANGELOG.md" -delete \ - && find . -name "README.md" -delete \ - && find . -name ".package-lock.json" -delete \ - && find . -name "package-lock.json" -delete \ - && find . -name "README.md" -delete -WORKDIR / - -#NPM__END +#PIPVENV_PATH__START +ENV PATH="${PATH}":/venvs/ansible-lint/cross/bin:/venvs/cfn-lint/cross/bin:/venvs/bandit/cross/bin:/venvs/checkov/cross/bin:/venvs/semgrep/cross/bin +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -195,27 +316,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START -COPY --link --from=build-platform /usr/bin/bash-exec /usr/bin/bash-exec -COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck -COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint -COPY --link --from=kubeconform /kubeconform /usr/bin/ -COPY --link --from=dustilock /usr/bin/dustilock /usr/bin/dustilock -COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ -COPY --link --from=kics /app/bin/kics /usr/bin/ -COPY --from=kics /app/bin/assets /opt/kics/assets/ -COPY --link --from=node_modules /node-deps /node-deps -COPY --link --from=trufflehog /usr/bin/trufflehog /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__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -253,24 +355,6 @@ RUN curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | # #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/flavors/swift/Dockerfile b/flavors/swift/Dockerfile index 5a79296e2ae..bba17faf14c 100644 --- a/flavors/swift/Dockerfile +++ b/flavors/swift/Dockerfile @@ -30,89 +30,180 @@ FROM jdkato/vale:latest as vale FROM lycheeverse/lychee:latest-alpine as lychee #FROM__END -################## -# Get base image # -################## -# https://stackoverflow.com/a/73711302/699056 -FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform -FROM python:3.11.4-alpine3.17 -ARG GITHUB_TOKEN +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START -# https://stackoverflow.com/a/73711302/699056 -COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ -# https://stackoverflow.com/a/73711302/699056 -RUN apk add --update --no-cache libc6-compat \ - gcompat \ - qemu-x86_64 +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START +# bash-exec installation +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 + +# +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START +RUN apk add --update --no-cache \ + npm +#NPM_APK__END +############################ +# Install NPM dependencies # ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# -#ARG__START -#ARG__END +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START +WORKDIR /node-deps +RUN npm --no-cache install --ignore-scripts --omit=dev \ + jscpd \ + stylelint \ + stylelint-config-standard \ + stylelint-config-sass-guidelines \ + stylelint-scss \ + graphql \ + graphql-schema-linter \ + npm-groovy-lint \ + htmlhint \ + @prantlf/jsonlint \ + eslint \ + eslint-plugin-jsonc \ + @microsoft/eslint-formatter-sarif \ + v8r \ + prettier \ + markdownlint-cli \ + markdown-link-check \ + markdown-table-formatter \ + @stoplight/spectral-cli \ + secretlint \ + @secretlint/secretlint-rule-preset-recommend \ + @secretlint/secretlint-formatter-sarif \ + cspell \ + sql-lint \ + tekton-lint && \ + echo "Cleaning npm cache…" \ + && npm cache clean --force || true \ + && echo "Changing owner of node_modules files…" \ + && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ + && echo "Removing extra node_module files…" \ + && rm -rf /root/.npm/_cacache \ + && find . -name "*.d.ts" -delete \ + && find . -name "*.map" -delete \ + && find . -name "*.npmignore" -delete \ + && find . -name "*.travis.yml" -delete \ + && find . -name "CHANGELOG.md" -delete \ + && find . -name "README.md" -delete \ + && find . -name ".package-lock.json" -delete \ + && find . -name "package-lock.json" -delete \ + && find . -name "README.md" -delete +WORKDIR / -#################### -# Run APK installs # -#################### +#NPM__END -WORKDIR / +FROM busybox AS copy-collector +############################## +# COPY instructions # ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# -#APK__START -RUN apk add --no-cache \ - bash \ - ca-certificates \ - curl \ + +#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 --link --from=build-platform /usr/bin/bash-exec /usr/bin/bash-exec +# 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=node_modules /node-deps /node-deps +COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint +COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker +COPY --link --from=dotenvlinter /dotenv-linter /usr/bin/dotenv-linter +COPY --link --from=kubeconform /kubeconform /usr/bin/ +COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ +COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ +COPY --link --from=trufflehog /usr/bin/trufflehog /usr/bin/ +COPY --link --from=vale /bin/vale /bin/vale +COPY --link --from=lychee /usr/local/bin/lychee /usr/bin/ +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ gcc \ - git \ - git-lfs \ libffi-dev \ - make \ musl-dev \ - openssh \ - docker \ - openrc \ - openjdk11 \ - py3-pyflakes \ - nodejs \ - npm \ - yarn \ - helm \ - gcompat \ - libc6-compat \ - libstdc++ \ - libc-dev \ - libxml2-dev \ - libxml2-utils \ - libgcc \ - nodejs-current \ - ruby \ - ruby-dev \ - ruby-bundler \ - ruby-rdoc \ - && git config --global core.autocrlf true -#APK__END + make \ + curl \ + openssl-dev \ + g++ \ + cmake +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START +RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ + mkdir /download \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ +&& pip download --cache-dir=/var/cache/pip --dest "/download" \ + ansible-lint \ + djlint \ + packaging \ + checkov \ + semgrep \ + snakemake \ + snakefmt \ + proselint \ + sqlfluff \ + yamllint + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 -# PATH for golang & python -ENV GOROOT=/usr/lib/go \ - GOPATH=/go - # PYTHONPYCACHEPREFIX="$HOME/.cache/cpython/" NV: not working for all packages :/ -# hadolint ignore=DL3044 -ENV PATH="$PATH":"$GOROOT"/bin:"$GOPATH"/bin -RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ - # Ignore npm package issues - yarn config set ignore-engines true || true +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# -#PIP__START - -#PIP__END #PIPVENV__START RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ @@ -172,60 +263,97 @@ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ #PIPVENV__END -############################ -# Install NPM dependencies # +################## +# Get base image # +################## + # https://stackoverflow.com/a/73711302/699056 +FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu + +FROM python:3.11.3-alpine3.17 AS final +ARG GITHUB_TOKEN + +# https://stackoverflow.com/a/73711302/699056 +COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ +# https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 +RUN apk add --update --no-cache libc6-compat \ + gcompat \ + qemu-x86_64 + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# +#ARG__START + +#ARG__END + +#################### +# Run APK installs # +#################### -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START -WORKDIR /node-deps -RUN npm --no-cache install --ignore-scripts --omit=dev \ - jscpd \ - stylelint \ - stylelint-config-standard \ - stylelint-config-sass-guidelines \ - stylelint-scss \ - graphql \ - graphql-schema-linter \ - npm-groovy-lint \ - htmlhint \ - @prantlf/jsonlint \ - eslint \ - eslint-plugin-jsonc \ - @microsoft/eslint-formatter-sarif \ - v8r \ - prettier \ - markdownlint-cli \ - markdown-link-check \ - markdown-table-formatter \ - @stoplight/spectral-cli \ - secretlint \ - @secretlint/secretlint-rule-preset-recommend \ - @secretlint/secretlint-formatter-sarif \ - cspell \ - sql-lint \ - tekton-lint && \ - echo "Cleaning npm cache…" \ - && npm cache clean --force || true \ - && echo "Changing owner of node_modules files…" \ - && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ - && echo "Removing extra node_module files…" \ - && rm -rf /root/.npm/_cacache \ - && find . -name "*.d.ts" -delete \ - && find . -name "*.map" -delete \ - && find . -name "*.npmignore" -delete \ - && find . -name "*.travis.yml" -delete \ - && find . -name "CHANGELOG.md" -delete \ - && find . -name "README.md" -delete \ - && find . -name ".package-lock.json" -delete \ - && find . -name "package-lock.json" -delete \ - && find . -name "README.md" -delete WORKDIR / -#NPM__END +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#APK__START +RUN apk add --no-cache \ + bash \ + ca-certificates \ + curl \ + gcc \ + git \ + git-lfs \ + libffi-dev \ + make \ + musl-dev \ + openssh \ + docker \ + openrc \ + openjdk11 \ + py3-pyflakes \ + nodejs \ + npm \ + yarn \ + helm \ + gcompat \ + libc6-compat \ + libstdc++ \ + libc-dev \ + libxml2-dev \ + libxml2-utils \ + libgcc \ + nodejs-current \ + ruby \ + ruby-dev \ + ruby-bundler \ + ruby-rdoc \ + && git config --global core.autocrlf true +#APK__END + +# PATH for golang & python +ENV GOROOT=/usr/lib/go \ + GOPATH=/go + # PYTHONPYCACHEPREFIX="$HOME/.cache/cpython/" NV: not working for all packages :/ +# hadolint ignore=DL3044 +ENV PATH="$PATH":"$GOROOT"/bin:"$GOPATH"/bin +RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ + # Ignore npm package issues + yarn config set ignore-engines true || true + +COPY --link --from=python-venv /venvs /venvs + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#PIP__START + +#PIP__END + +#PIPVENV_PATH__START +ENV PATH="${PATH}":/venvs/ansible-lint/cross/bin:/venvs/djlint/cross/bin:/venvs/checkov/cross/bin:/venvs/semgrep/cross/bin:/venvs/snakemake/cross/bin:/venvs/snakefmt/cross/bin:/venvs/proselint/cross/bin:/venvs/sqlfluff/cross/bin:/venvs/yamllint/cross/bin +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -253,32 +381,8 @@ RUN echo 'gem: --no-document' >> ~/.gemrc && \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#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 --link --from=build-platform /usr/bin/bash-exec /usr/bin/bash-exec -# 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=node_modules /node-deps /node-deps -COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint -COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker -COPY --link --from=dotenvlinter /dotenv-linter /usr/bin/dotenv-linter -COPY --link --from=kubeconform /kubeconform /usr/bin/ -COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ -COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ -COPY --link --from=trufflehog /usr/bin/trufflehog /usr/bin/ -COPY --link --from=vale /bin/vale /bin/vale -COPY --link --from=lychee /usr/local/bin/lychee /usr/bin/ -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -307,24 +411,6 @@ RUN rc-update add docker boot && rc-service docker start || true \ # #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/flavors/terraform/Dockerfile b/flavors/terraform/Dockerfile index 127f53ddf5f..17538c3eece 100644 --- a/flavors/terraform/Dockerfile +++ b/flavors/terraform/Dockerfile @@ -36,87 +36,186 @@ FROM alpine/terragrunt:latest as terragrunt # FROM alpine/terragrunt:latest as terragrunt #FROM__END -################## -# Get base image # -################## -# https://stackoverflow.com/a/73711302/699056 -FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform -FROM python:3.11.4-alpine3.17 -ARG GITHUB_TOKEN +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START -# https://stackoverflow.com/a/73711302/699056 -COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ -# https://stackoverflow.com/a/73711302/699056 -RUN apk add --update --no-cache libc6-compat \ - gcompat \ - qemu-x86_64 +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START +# bash-exec installation +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 +# +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START +RUN apk add --update --no-cache \ + npm +#NPM_APK__END + +############################ +# Install NPM dependencies # ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# -#ARG__START -#ARG__END +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START +WORKDIR /node-deps +RUN npm --no-cache install --ignore-scripts --omit=dev \ + jscpd \ + stylelint \ + stylelint-config-standard \ + stylelint-config-sass-guidelines \ + stylelint-scss \ + graphql \ + graphql-schema-linter \ + npm-groovy-lint \ + htmlhint \ + @prantlf/jsonlint \ + eslint \ + eslint-plugin-jsonc \ + @microsoft/eslint-formatter-sarif \ + v8r \ + prettier \ + markdownlint-cli \ + markdown-link-check \ + markdown-table-formatter \ + @stoplight/spectral-cli \ + secretlint \ + @secretlint/secretlint-rule-preset-recommend \ + @secretlint/secretlint-formatter-sarif \ + cspell \ + sql-lint \ + tekton-lint && \ + echo "Cleaning npm cache…" \ + && npm cache clean --force || true \ + && echo "Changing owner of node_modules files…" \ + && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ + && echo "Removing extra node_module files…" \ + && rm -rf /root/.npm/_cacache \ + && find . -name "*.d.ts" -delete \ + && find . -name "*.map" -delete \ + && find . -name "*.npmignore" -delete \ + && find . -name "*.travis.yml" -delete \ + && find . -name "CHANGELOG.md" -delete \ + && find . -name "README.md" -delete \ + && find . -name ".package-lock.json" -delete \ + && find . -name "package-lock.json" -delete \ + && find . -name "README.md" -delete +WORKDIR / -#################### -# Run APK installs # -#################### +#NPM__END -WORKDIR / +FROM busybox AS copy-collector +############################## +# COPY instructions # ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# -#APK__START -RUN apk add --no-cache \ - bash \ - ca-certificates \ - curl \ + +#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 --link --from=build-platform /usr/bin/bash-exec /usr/bin/bash-exec +# 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=node_modules /node-deps /node-deps +COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint +COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker +COPY --link --from=dotenvlinter /dotenv-linter /usr/bin/dotenv-linter +COPY --link --from=kubeconform /kubeconform /usr/bin/ +COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ +COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ +COPY --link --from=kics /app/bin/kics /usr/bin/ +COPY --from=kics /app/bin/assets /opt/kics/assets/ +COPY --link --from=trufflehog /usr/bin/trufflehog /usr/bin/ +COPY --link --from=vale /bin/vale /bin/vale +COPY --link --from=lychee /usr/local/bin/lychee /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__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ gcc \ - git \ - git-lfs \ libffi-dev \ - make \ musl-dev \ - openssh \ - openjdk11 \ - py3-pyflakes \ - nodejs \ - npm \ - yarn \ - helm \ - gcompat \ - libc6-compat \ - libstdc++ \ - libc-dev \ - libxml2-dev \ - libxml2-utils \ - libgcc \ - nodejs-current \ - ruby \ - ruby-dev \ - ruby-bundler \ - ruby-rdoc \ - && git config --global core.autocrlf true -#APK__END + make \ + curl \ + openssl-dev \ + g++ \ + cmake +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START +RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ + mkdir /download \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ +&& pip download --cache-dir=/var/cache/pip --dest "/download" \ + ansible-lint \ + djlint \ + packaging \ + checkov \ + semgrep \ + snakemake \ + snakefmt \ + proselint \ + sqlfluff \ + yamllint + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 -# PATH for golang & python -ENV GOROOT=/usr/lib/go \ - GOPATH=/go - # PYTHONPYCACHEPREFIX="$HOME/.cache/cpython/" NV: not working for all packages :/ -# hadolint ignore=DL3044 -ENV PATH="$PATH":"$GOROOT"/bin:"$GOPATH"/bin -RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ - # Ignore npm package issues - yarn config set ignore-engines true || true +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# -#PIP__START - -#PIP__END #PIPVENV__START RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ @@ -176,60 +275,95 @@ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ #PIPVENV__END -############################ -# Install NPM dependencies # +################## +# Get base image # +################## + # https://stackoverflow.com/a/73711302/699056 +FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu + +FROM python:3.11.3-alpine3.17 AS final +ARG GITHUB_TOKEN + +# https://stackoverflow.com/a/73711302/699056 +COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ +# https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 +RUN apk add --update --no-cache libc6-compat \ + gcompat \ + qemu-x86_64 + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# +#ARG__START + +#ARG__END + +#################### +# Run APK installs # +#################### -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START -WORKDIR /node-deps -RUN npm --no-cache install --ignore-scripts --omit=dev \ - jscpd \ - stylelint \ - stylelint-config-standard \ - stylelint-config-sass-guidelines \ - stylelint-scss \ - graphql \ - graphql-schema-linter \ - npm-groovy-lint \ - htmlhint \ - @prantlf/jsonlint \ - eslint \ - eslint-plugin-jsonc \ - @microsoft/eslint-formatter-sarif \ - v8r \ - prettier \ - markdownlint-cli \ - markdown-link-check \ - markdown-table-formatter \ - @stoplight/spectral-cli \ - secretlint \ - @secretlint/secretlint-rule-preset-recommend \ - @secretlint/secretlint-formatter-sarif \ - cspell \ - sql-lint \ - tekton-lint && \ - echo "Cleaning npm cache…" \ - && npm cache clean --force || true \ - && echo "Changing owner of node_modules files…" \ - && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ - && echo "Removing extra node_module files…" \ - && rm -rf /root/.npm/_cacache \ - && find . -name "*.d.ts" -delete \ - && find . -name "*.map" -delete \ - && find . -name "*.npmignore" -delete \ - && find . -name "*.travis.yml" -delete \ - && find . -name "CHANGELOG.md" -delete \ - && find . -name "README.md" -delete \ - && find . -name ".package-lock.json" -delete \ - && find . -name "package-lock.json" -delete \ - && find . -name "README.md" -delete WORKDIR / -#NPM__END +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#APK__START +RUN apk add --no-cache \ + bash \ + ca-certificates \ + curl \ + gcc \ + git \ + git-lfs \ + libffi-dev \ + make \ + musl-dev \ + openssh \ + openjdk11 \ + py3-pyflakes \ + nodejs \ + npm \ + yarn \ + helm \ + gcompat \ + libc6-compat \ + libstdc++ \ + libc-dev \ + libxml2-dev \ + libxml2-utils \ + libgcc \ + nodejs-current \ + ruby \ + ruby-dev \ + ruby-bundler \ + ruby-rdoc \ + && git config --global core.autocrlf true +#APK__END + +# PATH for golang & python +ENV GOROOT=/usr/lib/go \ + GOPATH=/go + # PYTHONPYCACHEPREFIX="$HOME/.cache/cpython/" NV: not working for all packages :/ +# hadolint ignore=DL3044 +ENV PATH="$PATH":"$GOROOT"/bin:"$GOPATH"/bin +RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ + # Ignore npm package issues + yarn config set ignore-engines true || true + +COPY --link --from=python-venv /venvs /venvs + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#PIP__START + +#PIP__END + +#PIPVENV_PATH__START +ENV PATH="${PATH}":/venvs/ansible-lint/cross/bin:/venvs/djlint/cross/bin:/venvs/checkov/cross/bin:/venvs/semgrep/cross/bin:/venvs/snakemake/cross/bin:/venvs/snakefmt/cross/bin:/venvs/proselint/cross/bin:/venvs/sqlfluff/cross/bin:/venvs/yamllint/cross/bin +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -257,38 +391,8 @@ RUN echo 'gem: --no-document' >> ~/.gemrc && \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#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 --link --from=build-platform /usr/bin/bash-exec /usr/bin/bash-exec -# 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=node_modules /node-deps /node-deps -COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint -COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker -COPY --link --from=dotenvlinter /dotenv-linter /usr/bin/dotenv-linter -COPY --link --from=kubeconform /kubeconform /usr/bin/ -COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ -COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ -COPY --link --from=kics /app/bin/kics /usr/bin/ -COPY --from=kics /app/bin/assets /opt/kics/assets/ -COPY --link --from=trufflehog /usr/bin/trufflehog /usr/bin/ -COPY --link --from=vale /bin/vale /bin/vale -COPY --link --from=lychee /usr/local/bin/lychee /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__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -320,24 +424,6 @@ RUN wget --tries=5 -q -O - https://raw.githubusercontent.com/aquasecurity/trivy/ # #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/action_actionlint/Dockerfile b/linters/action_actionlint/Dockerfile index ef5318d3428..6e86a316827 100644 --- a/linters/action_actionlint/Dockerfile +++ b/linters/action_actionlint/Dockerfile @@ -17,18 +17,121 @@ FROM rhysd/actionlint:latest as actionlint FROM koalaman/shellcheck:stable as shellcheck #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#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 + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -75,6 +178,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -82,21 +187,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START +#PIPVENV_PATH__START -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START - -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -122,18 +215,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#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 +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -142,24 +225,6 @@ COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/ansible_ansible_lint/Dockerfile b/linters/ansible_ansible_lint/Dockerfile index 1b795df4bc1..c6d9505e197 100644 --- a/linters/ansible_ansible_lint/Dockerfile +++ b/linters/ansible_ansible_lint/Dockerfile @@ -14,18 +14,129 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START + +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START +RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ + mkdir /download \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ +&& pip download --cache-dir=/var/cache/pip --dest "/download" \ + ansible-lint + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/ansible-lint" \ + && cd "/venvs/ansible-lint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip ansible-lint + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -71,6 +182,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -78,27 +191,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START -RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ - mkdir -p "/venvs/ansible-lint" \ - && cd "/venvs/ansible-lint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip ansible-lint - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START - -#NPM__END +#PIPVENV_PATH__START +ENV PATH="${PATH}":/venvs/ansible-lint/cross/bin +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -124,15 +219,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START - -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -141,24 +229,6 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/arm_arm_ttk/Dockerfile b/linters/arm_arm_ttk/Dockerfile index 427eb372a27..284d7c7c8f4 100644 --- a/linters/arm_arm_ttk/Dockerfile +++ b/linters/arm_arm_ttk/Dockerfile @@ -14,18 +14,118 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START + +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -77,6 +177,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -84,21 +186,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START +#PIPVENV_PATH__START -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START - -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -124,15 +214,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START - -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -167,24 +250,6 @@ RUN curl --retry 5 --retry-delay 5 -sLO "${ARM_TTK_URI}" \ # #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/bash_exec/Dockerfile b/linters/bash_exec/Dockerfile index 817411757a9..8843dd3bc36 100644 --- a/linters/bash_exec/Dockerfile +++ b/linters/bash_exec/Dockerfile @@ -14,18 +14,122 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START +# bash-exec installation +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 + +# +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START +COPY --link --from=build-platform /usr/bin/bash-exec /usr/bin/bash-exec +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -71,6 +175,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -78,21 +184,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START +#PIPVENV_PATH__START -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -118,15 +212,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START -COPY --link --from=build-platform /usr/bin/bash-exec /usr/bin/bash-exec -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -135,24 +222,6 @@ COPY --link --from=build-platform /usr/bin/bash-exec /usr/bin/bash-exec #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/bash_shellcheck/Dockerfile b/linters/bash_shellcheck/Dockerfile index 74f29b42b21..47591a7dd66 100644 --- a/linters/bash_shellcheck/Dockerfile +++ b/linters/bash_shellcheck/Dockerfile @@ -14,18 +14,118 @@ FROM koalaman/shellcheck:stable as shellcheck #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START +COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -71,6 +171,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -78,21 +180,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START +#PIPVENV_PATH__START -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -118,15 +208,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START -COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -135,24 +218,6 @@ COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/bash_shfmt/Dockerfile b/linters/bash_shfmt/Dockerfile index 95caacf2721..4fe63875822 100644 --- a/linters/bash_shfmt/Dockerfile +++ b/linters/bash_shfmt/Dockerfile @@ -14,18 +14,118 @@ FROM mvdan/shfmt:latest-alpine as shfmt #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START +COPY --link --from=shfmt /bin/shfmt /usr/bin/ +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -71,6 +171,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -78,21 +180,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START +#PIPVENV_PATH__START -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -118,15 +208,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START -COPY --link --from=shfmt /bin/shfmt /usr/bin/ -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -135,24 +218,6 @@ COPY --link --from=shfmt /bin/shfmt /usr/bin/ #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/bicep_bicep_linter/Dockerfile b/linters/bicep_bicep_linter/Dockerfile index 2973088f735..6f6a38e2b4c 100644 --- a/linters/bicep_bicep_linter/Dockerfile +++ b/linters/bicep_bicep_linter/Dockerfile @@ -14,18 +14,118 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START + +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -74,6 +174,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -81,21 +183,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START +#PIPVENV_PATH__START -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START - -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -121,15 +211,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START - -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -147,24 +230,6 @@ esac \ # #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/c_cpplint/Dockerfile b/linters/c_cpplint/Dockerfile index 3f0cefd5f8e..df4916286e3 100644 --- a/linters/c_cpplint/Dockerfile +++ b/linters/c_cpplint/Dockerfile @@ -14,18 +14,129 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START + +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START +RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ + mkdir /download \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ +&& pip download --cache-dir=/var/cache/pip --dest "/download" \ + cpplint + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/cpplint" \ + && cd "/venvs/cpplint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip cpplint + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -71,6 +182,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -78,27 +191,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START -RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ - mkdir -p "/venvs/cpplint" \ - && cd "/venvs/cpplint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip cpplint - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START - -#NPM__END +#PIPVENV_PATH__START +ENV PATH="${PATH}":/venvs/cpplint/cross/bin +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -124,15 +219,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START - -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -141,24 +229,6 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/clojure_clj_kondo/Dockerfile b/linters/clojure_clj_kondo/Dockerfile index 3277ec6ad7e..3a1f2c6c33c 100644 --- a/linters/clojure_clj_kondo/Dockerfile +++ b/linters/clojure_clj_kondo/Dockerfile @@ -14,18 +14,118 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START + +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -71,6 +171,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -78,21 +180,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START +#PIPVENV_PATH__START -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -118,15 +208,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START - -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -182,24 +265,6 @@ RUN ALPINE_GLIBC_BASE_URL="https://github.com/sgerrand/alpine-pkg-glibc/releases # #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/clojure_cljstyle/Dockerfile b/linters/clojure_cljstyle/Dockerfile index 8bff8574841..df24635ecd8 100644 --- a/linters/clojure_cljstyle/Dockerfile +++ b/linters/clojure_cljstyle/Dockerfile @@ -14,18 +14,118 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START + +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -71,6 +171,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -78,21 +180,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START +#PIPVENV_PATH__START -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -118,15 +208,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START - -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -182,24 +265,6 @@ RUN ALPINE_GLIBC_BASE_URL="https://github.com/sgerrand/alpine-pkg-glibc/releases # #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/cloudformation_cfn_lint/Dockerfile b/linters/cloudformation_cfn_lint/Dockerfile index c13bb5554c5..0eaef08415c 100644 --- a/linters/cloudformation_cfn_lint/Dockerfile +++ b/linters/cloudformation_cfn_lint/Dockerfile @@ -14,18 +14,129 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START + +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START +RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ + mkdir /download \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ +&& pip download --cache-dir=/var/cache/pip --dest "/download" \ + cfn-lint + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/cfn-lint" \ + && cd "/venvs/cfn-lint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip cfn-lint + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -71,6 +182,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -78,27 +191,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START -RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ - mkdir -p "/venvs/cfn-lint" \ - && cd "/venvs/cfn-lint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip cfn-lint - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START - -#NPM__END +#PIPVENV_PATH__START +ENV PATH="${PATH}":/venvs/cfn-lint/cross/bin +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -124,15 +219,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START - -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -141,24 +229,6 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/coffee_coffeelint/Dockerfile b/linters/coffee_coffeelint/Dockerfile index bb405bf1b94..65ca7a2bbcc 100644 --- a/linters/coffee_coffeelint/Dockerfile +++ b/linters/coffee_coffeelint/Dockerfile @@ -14,18 +14,138 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START +RUN apk add --update --no-cache \ + npm +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START +WORKDIR /node-deps +RUN npm --no-cache install --ignore-scripts --omit=dev \ + @coffeelint/cli && \ + echo "Cleaning npm cache…" \ + && npm cache clean --force || true \ + && echo "Changing owner of node_modules files…" \ + && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ + && echo "Removing extra node_module files…" \ + && rm -rf /root/.npm/_cacache \ + && find . -name "*.d.ts" -delete \ + && find . -name "*.map" -delete \ + && find . -name "*.npmignore" -delete \ + && find . -name "*.travis.yml" -delete \ + && find . -name "CHANGELOG.md" -delete \ + && find . -name "README.md" -delete \ + && find . -name ".package-lock.json" -delete \ + && find . -name "package-lock.json" -delete \ + && find . -name "README.md" -delete +WORKDIR / + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START +COPY --link --from=node_modules /node-deps /node-deps +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -74,6 +194,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -81,40 +203,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START +#PIPVENV_PATH__START -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START -WORKDIR /node-deps -RUN npm --no-cache install --ignore-scripts --omit=dev \ - @coffeelint/cli && \ - echo "Cleaning npm cache…" \ - && npm cache clean --force || true \ - && echo "Changing owner of node_modules files…" \ - && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ - && echo "Removing extra node_module files…" \ - && rm -rf /root/.npm/_cacache \ - && find . -name "*.d.ts" -delete \ - && find . -name "*.map" -delete \ - && find . -name "*.npmignore" -delete \ - && find . -name "*.travis.yml" -delete \ - && find . -name "CHANGELOG.md" -delete \ - && find . -name "README.md" -delete \ - && find . -name ".package-lock.json" -delete \ - && find . -name "package-lock.json" -delete \ - && find . -name "README.md" -delete -WORKDIR / - -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -140,15 +231,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START -COPY --link --from=node_modules /node-deps /node-deps -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -157,24 +241,6 @@ COPY --link --from=node_modules /node-deps /node-deps #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/copypaste_jscpd/Dockerfile b/linters/copypaste_jscpd/Dockerfile index ee354c002c1..0030944447c 100644 --- a/linters/copypaste_jscpd/Dockerfile +++ b/linters/copypaste_jscpd/Dockerfile @@ -14,18 +14,138 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START +RUN apk add --update --no-cache \ + npm +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START +WORKDIR /node-deps +RUN npm --no-cache install --ignore-scripts --omit=dev \ + jscpd && \ + echo "Cleaning npm cache…" \ + && npm cache clean --force || true \ + && echo "Changing owner of node_modules files…" \ + && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ + && echo "Removing extra node_module files…" \ + && rm -rf /root/.npm/_cacache \ + && find . -name "*.d.ts" -delete \ + && find . -name "*.map" -delete \ + && find . -name "*.npmignore" -delete \ + && find . -name "*.travis.yml" -delete \ + && find . -name "CHANGELOG.md" -delete \ + && find . -name "README.md" -delete \ + && find . -name ".package-lock.json" -delete \ + && find . -name "package-lock.json" -delete \ + && find . -name "README.md" -delete +WORKDIR / + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START +COPY --link --from=node_modules /node-deps /node-deps +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -75,6 +195,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -82,40 +204,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START +#PIPVENV_PATH__START -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START -WORKDIR /node-deps -RUN npm --no-cache install --ignore-scripts --omit=dev \ - jscpd && \ - echo "Cleaning npm cache…" \ - && npm cache clean --force || true \ - && echo "Changing owner of node_modules files…" \ - && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ - && echo "Removing extra node_module files…" \ - && rm -rf /root/.npm/_cacache \ - && find . -name "*.d.ts" -delete \ - && find . -name "*.map" -delete \ - && find . -name "*.npmignore" -delete \ - && find . -name "*.travis.yml" -delete \ - && find . -name "CHANGELOG.md" -delete \ - && find . -name "README.md" -delete \ - && find . -name ".package-lock.json" -delete \ - && find . -name "package-lock.json" -delete \ - && find . -name "README.md" -delete -WORKDIR / - -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -141,15 +232,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START -COPY --link --from=node_modules /node-deps /node-deps -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -158,24 +242,6 @@ COPY --link --from=node_modules /node-deps /node-deps #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/cpp_cpplint/Dockerfile b/linters/cpp_cpplint/Dockerfile index 1af00fadf1d..3306ce1be18 100644 --- a/linters/cpp_cpplint/Dockerfile +++ b/linters/cpp_cpplint/Dockerfile @@ -14,18 +14,129 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START + +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START +RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ + mkdir /download \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ +&& pip download --cache-dir=/var/cache/pip --dest "/download" \ + cpplint + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/cpplint" \ + && cd "/venvs/cpplint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip cpplint + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -71,6 +182,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -78,27 +191,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START -RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ - mkdir -p "/venvs/cpplint" \ - && cd "/venvs/cpplint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip cpplint - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START - -#NPM__END +#PIPVENV_PATH__START +ENV PATH="${PATH}":/venvs/cpplint/cross/bin +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -124,15 +219,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START - -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -141,24 +229,6 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/csharp_csharpier/Dockerfile b/linters/csharp_csharpier/Dockerfile index fe906cec8f5..4014b2de95b 100644 --- a/linters/csharp_csharpier/Dockerfile +++ b/linters/csharp_csharpier/Dockerfile @@ -14,18 +14,118 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START + +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -79,6 +179,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -86,21 +188,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START +#PIPVENV_PATH__START -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -126,15 +216,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START - -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -152,24 +235,6 @@ RUN /usr/share/dotnet/dotnet tool install -g csharpier # #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/csharp_dotnet_format/Dockerfile b/linters/csharp_dotnet_format/Dockerfile index 9661d16d9d4..cb52ddde09f 100644 --- a/linters/csharp_dotnet_format/Dockerfile +++ b/linters/csharp_dotnet_format/Dockerfile @@ -14,18 +14,118 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START + +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -79,6 +179,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -86,21 +188,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START +#PIPVENV_PATH__START -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -126,15 +216,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START - -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -149,24 +232,6 @@ ENV PATH="${PATH}:/root/.dotnet/tools:/usr/share/dotnet" # #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/css_scss_lint/Dockerfile b/linters/css_scss_lint/Dockerfile index 29f042f8377..144db0ab35b 100644 --- a/linters/css_scss_lint/Dockerfile +++ b/linters/css_scss_lint/Dockerfile @@ -14,18 +14,118 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START + +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -75,6 +175,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -82,21 +184,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START +#PIPVENV_PATH__START -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -124,15 +214,8 @@ RUN echo 'gem: --no-document' >> ~/.gemrc && \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START - -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -141,24 +224,6 @@ RUN echo 'gem: --no-document' >> ~/.gemrc && \ #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/css_stylelint/Dockerfile b/linters/css_stylelint/Dockerfile index f467e4e5377..54a7e0d8177 100644 --- a/linters/css_stylelint/Dockerfile +++ b/linters/css_stylelint/Dockerfile @@ -14,18 +14,141 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START +RUN apk add --update --no-cache \ + npm +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START +WORKDIR /node-deps +RUN npm --no-cache install --ignore-scripts --omit=dev \ + stylelint \ + stylelint-config-standard \ + stylelint-config-sass-guidelines \ + stylelint-scss && \ + echo "Cleaning npm cache…" \ + && npm cache clean --force || true \ + && echo "Changing owner of node_modules files…" \ + && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ + && echo "Removing extra node_module files…" \ + && rm -rf /root/.npm/_cacache \ + && find . -name "*.d.ts" -delete \ + && find . -name "*.map" -delete \ + && find . -name "*.npmignore" -delete \ + && find . -name "*.travis.yml" -delete \ + && find . -name "CHANGELOG.md" -delete \ + && find . -name "README.md" -delete \ + && find . -name ".package-lock.json" -delete \ + && find . -name "package-lock.json" -delete \ + && find . -name "README.md" -delete +WORKDIR / + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START +COPY --link --from=node_modules /node-deps /node-deps +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -74,6 +197,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -81,43 +206,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START -WORKDIR /node-deps -RUN npm --no-cache install --ignore-scripts --omit=dev \ - stylelint \ - stylelint-config-standard \ - stylelint-config-sass-guidelines \ - stylelint-scss && \ - echo "Cleaning npm cache…" \ - && npm cache clean --force || true \ - && echo "Changing owner of node_modules files…" \ - && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ - && echo "Removing extra node_module files…" \ - && rm -rf /root/.npm/_cacache \ - && find . -name "*.d.ts" -delete \ - && find . -name "*.map" -delete \ - && find . -name "*.npmignore" -delete \ - && find . -name "*.travis.yml" -delete \ - && find . -name "CHANGELOG.md" -delete \ - && find . -name "README.md" -delete \ - && find . -name ".package-lock.json" -delete \ - && find . -name "package-lock.json" -delete \ - && find . -name "README.md" -delete -WORKDIR / +#PIPVENV_PATH__START -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -143,15 +234,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START -COPY --link --from=node_modules /node-deps /node-deps -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -160,24 +244,6 @@ COPY --link --from=node_modules /node-deps /node-deps #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/dart_dartanalyzer/Dockerfile b/linters/dart_dartanalyzer/Dockerfile index d185b773df8..26627b5865a 100644 --- a/linters/dart_dartanalyzer/Dockerfile +++ b/linters/dart_dartanalyzer/Dockerfile @@ -14,18 +14,118 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START + +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -72,6 +172,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -79,21 +181,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START +#PIPVENV_PATH__START -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START - -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -119,15 +209,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START - -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -188,24 +271,6 @@ RUN ALPINE_GLIBC_BASE_URL="https://github.com/sgerrand/alpine-pkg-glibc/releases # #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/dockerfile_hadolint/Dockerfile b/linters/dockerfile_hadolint/Dockerfile index b51c6e398d9..834ff477d8a 100644 --- a/linters/dockerfile_hadolint/Dockerfile +++ b/linters/dockerfile_hadolint/Dockerfile @@ -14,18 +14,118 @@ FROM hadolint/hadolint:v2.12.0-alpine as hadolint #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START +COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -71,6 +171,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -78,21 +180,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START +#PIPVENV_PATH__START -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -118,15 +208,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START -COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -135,24 +218,6 @@ COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/editorconfig_editorconfig_checker/Dockerfile b/linters/editorconfig_editorconfig_checker/Dockerfile index 85decd23ce0..8ab418f5c7e 100644 --- a/linters/editorconfig_editorconfig_checker/Dockerfile +++ b/linters/editorconfig_editorconfig_checker/Dockerfile @@ -14,18 +14,118 @@ FROM mstruebing/editorconfig-checker:2.7.0 as editorconfig-checker #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START +COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -71,6 +171,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -78,21 +180,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START +#PIPVENV_PATH__START -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -118,15 +208,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START -COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -135,24 +218,6 @@ COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checke #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/env_dotenv_linter/Dockerfile b/linters/env_dotenv_linter/Dockerfile index 8fac98e6b1c..c349fc8ebb0 100644 --- a/linters/env_dotenv_linter/Dockerfile +++ b/linters/env_dotenv_linter/Dockerfile @@ -14,18 +14,118 @@ FROM dotenvlinter/dotenv-linter:latest as dotenvlinter #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START +COPY --link --from=dotenvlinter /dotenv-linter /usr/bin/dotenv-linter +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -71,6 +171,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -78,21 +180,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START +#PIPVENV_PATH__START -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -118,15 +208,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START -COPY --link --from=dotenvlinter /dotenv-linter /usr/bin/dotenv-linter -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -135,24 +218,6 @@ COPY --link --from=dotenvlinter /dotenv-linter /usr/bin/dotenv-linter #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/gherkin_gherkin_lint/Dockerfile b/linters/gherkin_gherkin_lint/Dockerfile index 85e4f13c41d..903dba45df0 100644 --- a/linters/gherkin_gherkin_lint/Dockerfile +++ b/linters/gherkin_gherkin_lint/Dockerfile @@ -14,18 +14,138 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START +RUN apk add --update --no-cache \ + npm +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START +WORKDIR /node-deps +RUN npm --no-cache install --ignore-scripts --omit=dev \ + gherkin-lint && \ + echo "Cleaning npm cache…" \ + && npm cache clean --force || true \ + && echo "Changing owner of node_modules files…" \ + && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ + && echo "Removing extra node_module files…" \ + && rm -rf /root/.npm/_cacache \ + && find . -name "*.d.ts" -delete \ + && find . -name "*.map" -delete \ + && find . -name "*.npmignore" -delete \ + && find . -name "*.travis.yml" -delete \ + && find . -name "CHANGELOG.md" -delete \ + && find . -name "README.md" -delete \ + && find . -name ".package-lock.json" -delete \ + && find . -name "package-lock.json" -delete \ + && find . -name "README.md" -delete +WORKDIR / + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START +COPY --link --from=node_modules /node-deps /node-deps +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -74,6 +194,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -81,40 +203,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START +#PIPVENV_PATH__START -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START -WORKDIR /node-deps -RUN npm --no-cache install --ignore-scripts --omit=dev \ - gherkin-lint && \ - echo "Cleaning npm cache…" \ - && npm cache clean --force || true \ - && echo "Changing owner of node_modules files…" \ - && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ - && echo "Removing extra node_module files…" \ - && rm -rf /root/.npm/_cacache \ - && find . -name "*.d.ts" -delete \ - && find . -name "*.map" -delete \ - && find . -name "*.npmignore" -delete \ - && find . -name "*.travis.yml" -delete \ - && find . -name "CHANGELOG.md" -delete \ - && find . -name "README.md" -delete \ - && find . -name ".package-lock.json" -delete \ - && find . -name "package-lock.json" -delete \ - && find . -name "README.md" -delete -WORKDIR / - -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -140,15 +231,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START -COPY --link --from=node_modules /node-deps /node-deps -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -157,24 +241,6 @@ COPY --link --from=node_modules /node-deps /node-deps #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/go_golangci_lint/Dockerfile b/linters/go_golangci_lint/Dockerfile index 764c1e8d89f..63b7172fe8c 100644 --- a/linters/go_golangci_lint/Dockerfile +++ b/linters/go_golangci_lint/Dockerfile @@ -14,18 +14,118 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START + +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -72,6 +172,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -79,21 +181,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START +#PIPVENV_PATH__START -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -119,15 +209,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START - -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -140,24 +223,6 @@ RUN wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/master # #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/go_revive/Dockerfile b/linters/go_revive/Dockerfile index df2bc293b36..585a49aad91 100644 --- a/linters/go_revive/Dockerfile +++ b/linters/go_revive/Dockerfile @@ -19,18 +19,118 @@ RUN GOBIN=/usr/bin go install github.com/mgechev/revive@latest #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START +COPY --link --from=revive /usr/bin/revive /usr/bin/revive +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -76,6 +176,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -83,21 +185,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START +#PIPVENV_PATH__START -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -123,15 +213,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START -COPY --link --from=revive /usr/bin/revive /usr/bin/revive -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -140,24 +223,6 @@ COPY --link --from=revive /usr/bin/revive /usr/bin/revive #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/graphql_graphql_schema_linter/Dockerfile b/linters/graphql_graphql_schema_linter/Dockerfile index 47c9a903610..8a26f39a5c5 100644 --- a/linters/graphql_graphql_schema_linter/Dockerfile +++ b/linters/graphql_graphql_schema_linter/Dockerfile @@ -14,18 +14,139 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START +RUN apk add --update --no-cache \ + npm +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START +WORKDIR /node-deps +RUN npm --no-cache install --ignore-scripts --omit=dev \ + graphql \ + graphql-schema-linter && \ + echo "Cleaning npm cache…" \ + && npm cache clean --force || true \ + && echo "Changing owner of node_modules files…" \ + && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ + && echo "Removing extra node_module files…" \ + && rm -rf /root/.npm/_cacache \ + && find . -name "*.d.ts" -delete \ + && find . -name "*.map" -delete \ + && find . -name "*.npmignore" -delete \ + && find . -name "*.travis.yml" -delete \ + && find . -name "CHANGELOG.md" -delete \ + && find . -name "README.md" -delete \ + && find . -name ".package-lock.json" -delete \ + && find . -name "package-lock.json" -delete \ + && find . -name "README.md" -delete +WORKDIR / + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START +COPY --link --from=node_modules /node-deps /node-deps +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -74,6 +195,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -81,41 +204,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START -WORKDIR /node-deps -RUN npm --no-cache install --ignore-scripts --omit=dev \ - graphql \ - graphql-schema-linter && \ - echo "Cleaning npm cache…" \ - && npm cache clean --force || true \ - && echo "Changing owner of node_modules files…" \ - && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ - && echo "Removing extra node_module files…" \ - && rm -rf /root/.npm/_cacache \ - && find . -name "*.d.ts" -delete \ - && find . -name "*.map" -delete \ - && find . -name "*.npmignore" -delete \ - && find . -name "*.travis.yml" -delete \ - && find . -name "CHANGELOG.md" -delete \ - && find . -name "README.md" -delete \ - && find . -name ".package-lock.json" -delete \ - && find . -name "package-lock.json" -delete \ - && find . -name "README.md" -delete -WORKDIR / +#PIPVENV_PATH__START -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -141,15 +232,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START -COPY --link --from=node_modules /node-deps /node-deps -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -158,24 +242,6 @@ COPY --link --from=node_modules /node-deps /node-deps #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/groovy_npm_groovy_lint/Dockerfile b/linters/groovy_npm_groovy_lint/Dockerfile index 571f8540dc8..e46571607b4 100644 --- a/linters/groovy_npm_groovy_lint/Dockerfile +++ b/linters/groovy_npm_groovy_lint/Dockerfile @@ -14,18 +14,138 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START +RUN apk add --update --no-cache \ + npm +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START +WORKDIR /node-deps +RUN npm --no-cache install --ignore-scripts --omit=dev \ + npm-groovy-lint && \ + echo "Cleaning npm cache…" \ + && npm cache clean --force || true \ + && echo "Changing owner of node_modules files…" \ + && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ + && echo "Removing extra node_module files…" \ + && rm -rf /root/.npm/_cacache \ + && find . -name "*.d.ts" -delete \ + && find . -name "*.map" -delete \ + && find . -name "*.npmignore" -delete \ + && find . -name "*.travis.yml" -delete \ + && find . -name "CHANGELOG.md" -delete \ + && find . -name "README.md" -delete \ + && find . -name ".package-lock.json" -delete \ + && find . -name "package-lock.json" -delete \ + && find . -name "README.md" -delete +WORKDIR / + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START +COPY --link --from=node_modules /node-deps /node-deps +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -75,6 +195,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -82,40 +204,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START +#PIPVENV_PATH__START -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START -WORKDIR /node-deps -RUN npm --no-cache install --ignore-scripts --omit=dev \ - npm-groovy-lint && \ - echo "Cleaning npm cache…" \ - && npm cache clean --force || true \ - && echo "Changing owner of node_modules files…" \ - && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ - && echo "Removing extra node_module files…" \ - && rm -rf /root/.npm/_cacache \ - && find . -name "*.d.ts" -delete \ - && find . -name "*.map" -delete \ - && find . -name "*.npmignore" -delete \ - && find . -name "*.travis.yml" -delete \ - && find . -name "CHANGELOG.md" -delete \ - && find . -name "README.md" -delete \ - && find . -name ".package-lock.json" -delete \ - && find . -name "package-lock.json" -delete \ - && find . -name "README.md" -delete -WORKDIR / - -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -141,15 +232,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START -COPY --link --from=node_modules /node-deps /node-deps -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -158,24 +242,6 @@ COPY --link --from=node_modules /node-deps /node-deps #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/html_djlint/Dockerfile b/linters/html_djlint/Dockerfile index 5685e1e7070..d1f68a18c63 100644 --- a/linters/html_djlint/Dockerfile +++ b/linters/html_djlint/Dockerfile @@ -14,18 +14,129 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START + +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START +RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ + mkdir /download \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ +&& pip download --cache-dir=/var/cache/pip --dest "/download" \ + djlint + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/djlint" \ + && cd "/venvs/djlint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip djlint + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -71,6 +182,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -78,27 +191,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START -RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ - mkdir -p "/venvs/djlint" \ - && cd "/venvs/djlint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip djlint - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START - -#NPM__END +#PIPVENV_PATH__START +ENV PATH="${PATH}":/venvs/djlint/cross/bin +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -124,15 +219,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START - -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -141,24 +229,6 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/html_htmlhint/Dockerfile b/linters/html_htmlhint/Dockerfile index 8b2c3a7a466..e619683e1ae 100644 --- a/linters/html_htmlhint/Dockerfile +++ b/linters/html_htmlhint/Dockerfile @@ -14,18 +14,138 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START +RUN apk add --update --no-cache \ + npm +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START +WORKDIR /node-deps +RUN npm --no-cache install --ignore-scripts --omit=dev \ + htmlhint && \ + echo "Cleaning npm cache…" \ + && npm cache clean --force || true \ + && echo "Changing owner of node_modules files…" \ + && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ + && echo "Removing extra node_module files…" \ + && rm -rf /root/.npm/_cacache \ + && find . -name "*.d.ts" -delete \ + && find . -name "*.map" -delete \ + && find . -name "*.npmignore" -delete \ + && find . -name "*.travis.yml" -delete \ + && find . -name "CHANGELOG.md" -delete \ + && find . -name "README.md" -delete \ + && find . -name ".package-lock.json" -delete \ + && find . -name "package-lock.json" -delete \ + && find . -name "README.md" -delete +WORKDIR / + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START +COPY --link --from=node_modules /node-deps /node-deps +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -74,6 +194,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -81,40 +203,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START +#PIPVENV_PATH__START -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START -WORKDIR /node-deps -RUN npm --no-cache install --ignore-scripts --omit=dev \ - htmlhint && \ - echo "Cleaning npm cache…" \ - && npm cache clean --force || true \ - && echo "Changing owner of node_modules files…" \ - && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ - && echo "Removing extra node_module files…" \ - && rm -rf /root/.npm/_cacache \ - && find . -name "*.d.ts" -delete \ - && find . -name "*.map" -delete \ - && find . -name "*.npmignore" -delete \ - && find . -name "*.travis.yml" -delete \ - && find . -name "CHANGELOG.md" -delete \ - && find . -name "README.md" -delete \ - && find . -name ".package-lock.json" -delete \ - && find . -name "package-lock.json" -delete \ - && find . -name "README.md" -delete -WORKDIR / - -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -140,15 +231,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START -COPY --link --from=node_modules /node-deps /node-deps -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -157,24 +241,6 @@ COPY --link --from=node_modules /node-deps /node-deps #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/java_checkstyle/Dockerfile b/linters/java_checkstyle/Dockerfile index 405f76cab59..2be338561d7 100644 --- a/linters/java_checkstyle/Dockerfile +++ b/linters/java_checkstyle/Dockerfile @@ -14,18 +14,118 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START + +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -72,6 +172,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -79,21 +181,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START +#PIPVENV_PATH__START -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -119,15 +209,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START - -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -151,24 +234,6 @@ RUN --mount=type=secret,id=GITHUB_TOKEN CHECKSTYLE_LATEST=$(curl -s \ # #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/java_pmd/Dockerfile b/linters/java_pmd/Dockerfile index c8fc4a44832..fb0167dcfa3 100644 --- a/linters/java_pmd/Dockerfile +++ b/linters/java_pmd/Dockerfile @@ -14,18 +14,118 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START + +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -72,6 +172,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -79,21 +181,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START +#PIPVENV_PATH__START -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -119,15 +209,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START - -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -147,24 +230,6 @@ RUN wget --quiet https://github.com/pmd/pmd/releases/download/pmd_releases%2F${P # #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/javascript_es/Dockerfile b/linters/javascript_es/Dockerfile index 26a339baedd..5ca9d3814a5 100644 --- a/linters/javascript_es/Dockerfile +++ b/linters/javascript_es/Dockerfile @@ -14,18 +14,150 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START +RUN apk add --update --no-cache \ + npm +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START +WORKDIR /node-deps +RUN npm --no-cache install --ignore-scripts --omit=dev \ + eslint \ + eslint-config-airbnb \ + eslint-config-prettier \ + eslint-config-standard \ + eslint-plugin-import \ + eslint-plugin-jest \ + eslint-plugin-node \ + eslint-plugin-prettier \ + eslint-plugin-promise \ + eslint-plugin-vue \ + @babel/core \ + @babel/eslint-parser \ + @microsoft/eslint-formatter-sarif && \ + echo "Cleaning npm cache…" \ + && npm cache clean --force || true \ + && echo "Changing owner of node_modules files…" \ + && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ + && echo "Removing extra node_module files…" \ + && rm -rf /root/.npm/_cacache \ + && find . -name "*.d.ts" -delete \ + && find . -name "*.map" -delete \ + && find . -name "*.npmignore" -delete \ + && find . -name "*.travis.yml" -delete \ + && find . -name "CHANGELOG.md" -delete \ + && find . -name "README.md" -delete \ + && find . -name ".package-lock.json" -delete \ + && find . -name "package-lock.json" -delete \ + && find . -name "README.md" -delete +WORKDIR / + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START +COPY --link --from=node_modules /node-deps /node-deps +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -74,6 +206,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -81,52 +215,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START +#PIPVENV_PATH__START -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START -WORKDIR /node-deps -RUN npm --no-cache install --ignore-scripts --omit=dev \ - eslint \ - eslint-config-airbnb \ - eslint-config-prettier \ - eslint-config-standard \ - eslint-plugin-import \ - eslint-plugin-jest \ - eslint-plugin-node \ - eslint-plugin-prettier \ - eslint-plugin-promise \ - eslint-plugin-vue \ - @babel/core \ - @babel/eslint-parser \ - @microsoft/eslint-formatter-sarif && \ - echo "Cleaning npm cache…" \ - && npm cache clean --force || true \ - && echo "Changing owner of node_modules files…" \ - && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ - && echo "Removing extra node_module files…" \ - && rm -rf /root/.npm/_cacache \ - && find . -name "*.d.ts" -delete \ - && find . -name "*.map" -delete \ - && find . -name "*.npmignore" -delete \ - && find . -name "*.travis.yml" -delete \ - && find . -name "CHANGELOG.md" -delete \ - && find . -name "README.md" -delete \ - && find . -name ".package-lock.json" -delete \ - && find . -name "package-lock.json" -delete \ - && find . -name "README.md" -delete -WORKDIR / - -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -152,15 +243,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START -COPY --link --from=node_modules /node-deps /node-deps -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -169,24 +253,6 @@ COPY --link --from=node_modules /node-deps /node-deps #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/javascript_prettier/Dockerfile b/linters/javascript_prettier/Dockerfile index 021b69cf8c3..3150ace1de9 100644 --- a/linters/javascript_prettier/Dockerfile +++ b/linters/javascript_prettier/Dockerfile @@ -14,18 +14,138 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START +RUN apk add --update --no-cache \ + npm +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START +WORKDIR /node-deps +RUN npm --no-cache install --ignore-scripts --omit=dev \ + prettier && \ + echo "Cleaning npm cache…" \ + && npm cache clean --force || true \ + && echo "Changing owner of node_modules files…" \ + && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ + && echo "Removing extra node_module files…" \ + && rm -rf /root/.npm/_cacache \ + && find . -name "*.d.ts" -delete \ + && find . -name "*.map" -delete \ + && find . -name "*.npmignore" -delete \ + && find . -name "*.travis.yml" -delete \ + && find . -name "CHANGELOG.md" -delete \ + && find . -name "README.md" -delete \ + && find . -name ".package-lock.json" -delete \ + && find . -name "package-lock.json" -delete \ + && find . -name "README.md" -delete +WORKDIR / + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START +COPY --link --from=node_modules /node-deps /node-deps +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -74,6 +194,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -81,40 +203,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START +#PIPVENV_PATH__START -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START -WORKDIR /node-deps -RUN npm --no-cache install --ignore-scripts --omit=dev \ - prettier && \ - echo "Cleaning npm cache…" \ - && npm cache clean --force || true \ - && echo "Changing owner of node_modules files…" \ - && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ - && echo "Removing extra node_module files…" \ - && rm -rf /root/.npm/_cacache \ - && find . -name "*.d.ts" -delete \ - && find . -name "*.map" -delete \ - && find . -name "*.npmignore" -delete \ - && find . -name "*.travis.yml" -delete \ - && find . -name "CHANGELOG.md" -delete \ - && find . -name "README.md" -delete \ - && find . -name ".package-lock.json" -delete \ - && find . -name "package-lock.json" -delete \ - && find . -name "README.md" -delete -WORKDIR / - -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -140,15 +231,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START -COPY --link --from=node_modules /node-deps /node-deps -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -157,24 +241,6 @@ COPY --link --from=node_modules /node-deps /node-deps #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/javascript_standard/Dockerfile b/linters/javascript_standard/Dockerfile index 0e1d8813393..1e178806bdb 100644 --- a/linters/javascript_standard/Dockerfile +++ b/linters/javascript_standard/Dockerfile @@ -14,18 +14,138 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START +RUN apk add --update --no-cache \ + npm +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START +WORKDIR /node-deps +RUN npm --no-cache install --ignore-scripts --omit=dev \ + standard && \ + echo "Cleaning npm cache…" \ + && npm cache clean --force || true \ + && echo "Changing owner of node_modules files…" \ + && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ + && echo "Removing extra node_module files…" \ + && rm -rf /root/.npm/_cacache \ + && find . -name "*.d.ts" -delete \ + && find . -name "*.map" -delete \ + && find . -name "*.npmignore" -delete \ + && find . -name "*.travis.yml" -delete \ + && find . -name "CHANGELOG.md" -delete \ + && find . -name "README.md" -delete \ + && find . -name ".package-lock.json" -delete \ + && find . -name "package-lock.json" -delete \ + && find . -name "README.md" -delete +WORKDIR / + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START +COPY --link --from=node_modules /node-deps /node-deps +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -74,6 +194,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -81,40 +203,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START +#PIPVENV_PATH__START -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START -WORKDIR /node-deps -RUN npm --no-cache install --ignore-scripts --omit=dev \ - standard && \ - echo "Cleaning npm cache…" \ - && npm cache clean --force || true \ - && echo "Changing owner of node_modules files…" \ - && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ - && echo "Removing extra node_module files…" \ - && rm -rf /root/.npm/_cacache \ - && find . -name "*.d.ts" -delete \ - && find . -name "*.map" -delete \ - && find . -name "*.npmignore" -delete \ - && find . -name "*.travis.yml" -delete \ - && find . -name "CHANGELOG.md" -delete \ - && find . -name "README.md" -delete \ - && find . -name ".package-lock.json" -delete \ - && find . -name "package-lock.json" -delete \ - && find . -name "README.md" -delete -WORKDIR / - -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -140,15 +231,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START -COPY --link --from=node_modules /node-deps /node-deps -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -157,24 +241,6 @@ COPY --link --from=node_modules /node-deps /node-deps #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/json_eslint_plugin_jsonc/Dockerfile b/linters/json_eslint_plugin_jsonc/Dockerfile index 64d002dfaf1..bab8baf8c69 100644 --- a/linters/json_eslint_plugin_jsonc/Dockerfile +++ b/linters/json_eslint_plugin_jsonc/Dockerfile @@ -14,18 +14,140 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START +RUN apk add --update --no-cache \ + npm +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START +WORKDIR /node-deps +RUN npm --no-cache install --ignore-scripts --omit=dev \ + eslint \ + eslint-plugin-jsonc \ + @microsoft/eslint-formatter-sarif && \ + echo "Cleaning npm cache…" \ + && npm cache clean --force || true \ + && echo "Changing owner of node_modules files…" \ + && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ + && echo "Removing extra node_module files…" \ + && rm -rf /root/.npm/_cacache \ + && find . -name "*.d.ts" -delete \ + && find . -name "*.map" -delete \ + && find . -name "*.npmignore" -delete \ + && find . -name "*.travis.yml" -delete \ + && find . -name "CHANGELOG.md" -delete \ + && find . -name "README.md" -delete \ + && find . -name ".package-lock.json" -delete \ + && find . -name "package-lock.json" -delete \ + && find . -name "README.md" -delete +WORKDIR / + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START +COPY --link --from=node_modules /node-deps /node-deps +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -74,6 +196,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -81,42 +205,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START +#PIPVENV_PATH__START -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START -WORKDIR /node-deps -RUN npm --no-cache install --ignore-scripts --omit=dev \ - eslint \ - eslint-plugin-jsonc \ - @microsoft/eslint-formatter-sarif && \ - echo "Cleaning npm cache…" \ - && npm cache clean --force || true \ - && echo "Changing owner of node_modules files…" \ - && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ - && echo "Removing extra node_module files…" \ - && rm -rf /root/.npm/_cacache \ - && find . -name "*.d.ts" -delete \ - && find . -name "*.map" -delete \ - && find . -name "*.npmignore" -delete \ - && find . -name "*.travis.yml" -delete \ - && find . -name "CHANGELOG.md" -delete \ - && find . -name "README.md" -delete \ - && find . -name ".package-lock.json" -delete \ - && find . -name "package-lock.json" -delete \ - && find . -name "README.md" -delete -WORKDIR / - -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -142,15 +233,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START -COPY --link --from=node_modules /node-deps /node-deps -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -159,24 +243,6 @@ COPY --link --from=node_modules /node-deps /node-deps #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/json_jsonlint/Dockerfile b/linters/json_jsonlint/Dockerfile index 858a174f1ef..5580a0911d3 100644 --- a/linters/json_jsonlint/Dockerfile +++ b/linters/json_jsonlint/Dockerfile @@ -14,18 +14,138 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START +RUN apk add --update --no-cache \ + npm +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START +WORKDIR /node-deps +RUN npm --no-cache install --ignore-scripts --omit=dev \ + @prantlf/jsonlint && \ + echo "Cleaning npm cache…" \ + && npm cache clean --force || true \ + && echo "Changing owner of node_modules files…" \ + && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ + && echo "Removing extra node_module files…" \ + && rm -rf /root/.npm/_cacache \ + && find . -name "*.d.ts" -delete \ + && find . -name "*.map" -delete \ + && find . -name "*.npmignore" -delete \ + && find . -name "*.travis.yml" -delete \ + && find . -name "CHANGELOG.md" -delete \ + && find . -name "README.md" -delete \ + && find . -name ".package-lock.json" -delete \ + && find . -name "package-lock.json" -delete \ + && find . -name "README.md" -delete +WORKDIR / + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START +COPY --link --from=node_modules /node-deps /node-deps +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -74,6 +194,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -81,40 +203,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START +#PIPVENV_PATH__START -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START -WORKDIR /node-deps -RUN npm --no-cache install --ignore-scripts --omit=dev \ - @prantlf/jsonlint && \ - echo "Cleaning npm cache…" \ - && npm cache clean --force || true \ - && echo "Changing owner of node_modules files…" \ - && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ - && echo "Removing extra node_module files…" \ - && rm -rf /root/.npm/_cacache \ - && find . -name "*.d.ts" -delete \ - && find . -name "*.map" -delete \ - && find . -name "*.npmignore" -delete \ - && find . -name "*.travis.yml" -delete \ - && find . -name "CHANGELOG.md" -delete \ - && find . -name "README.md" -delete \ - && find . -name ".package-lock.json" -delete \ - && find . -name "package-lock.json" -delete \ - && find . -name "README.md" -delete -WORKDIR / - -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -140,15 +231,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START -COPY --link --from=node_modules /node-deps /node-deps -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -157,24 +241,6 @@ COPY --link --from=node_modules /node-deps /node-deps #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/json_npm_package_json_lint/Dockerfile b/linters/json_npm_package_json_lint/Dockerfile index bfab601a323..40cf297d5e6 100644 --- a/linters/json_npm_package_json_lint/Dockerfile +++ b/linters/json_npm_package_json_lint/Dockerfile @@ -14,18 +14,139 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START +RUN apk add --update --no-cache \ + npm +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START +WORKDIR /node-deps +RUN npm --no-cache install --ignore-scripts --omit=dev \ + npm-package-json-lint \ + npm-package-json-lint-config-default && \ + echo "Cleaning npm cache…" \ + && npm cache clean --force || true \ + && echo "Changing owner of node_modules files…" \ + && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ + && echo "Removing extra node_module files…" \ + && rm -rf /root/.npm/_cacache \ + && find . -name "*.d.ts" -delete \ + && find . -name "*.map" -delete \ + && find . -name "*.npmignore" -delete \ + && find . -name "*.travis.yml" -delete \ + && find . -name "CHANGELOG.md" -delete \ + && find . -name "README.md" -delete \ + && find . -name ".package-lock.json" -delete \ + && find . -name "package-lock.json" -delete \ + && find . -name "README.md" -delete +WORKDIR / + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START +COPY --link --from=node_modules /node-deps /node-deps +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -74,6 +195,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -81,41 +204,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START -WORKDIR /node-deps -RUN npm --no-cache install --ignore-scripts --omit=dev \ - npm-package-json-lint \ - npm-package-json-lint-config-default && \ - echo "Cleaning npm cache…" \ - && npm cache clean --force || true \ - && echo "Changing owner of node_modules files…" \ - && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ - && echo "Removing extra node_module files…" \ - && rm -rf /root/.npm/_cacache \ - && find . -name "*.d.ts" -delete \ - && find . -name "*.map" -delete \ - && find . -name "*.npmignore" -delete \ - && find . -name "*.travis.yml" -delete \ - && find . -name "CHANGELOG.md" -delete \ - && find . -name "README.md" -delete \ - && find . -name ".package-lock.json" -delete \ - && find . -name "package-lock.json" -delete \ - && find . -name "README.md" -delete -WORKDIR / +#PIPVENV_PATH__START -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -141,15 +232,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START -COPY --link --from=node_modules /node-deps /node-deps -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -158,24 +242,6 @@ COPY --link --from=node_modules /node-deps /node-deps #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/json_prettier/Dockerfile b/linters/json_prettier/Dockerfile index 78b1d941d4b..c28b43997cd 100644 --- a/linters/json_prettier/Dockerfile +++ b/linters/json_prettier/Dockerfile @@ -14,18 +14,138 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START +RUN apk add --update --no-cache \ + npm +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START +WORKDIR /node-deps +RUN npm --no-cache install --ignore-scripts --omit=dev \ + prettier && \ + echo "Cleaning npm cache…" \ + && npm cache clean --force || true \ + && echo "Changing owner of node_modules files…" \ + && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ + && echo "Removing extra node_module files…" \ + && rm -rf /root/.npm/_cacache \ + && find . -name "*.d.ts" -delete \ + && find . -name "*.map" -delete \ + && find . -name "*.npmignore" -delete \ + && find . -name "*.travis.yml" -delete \ + && find . -name "CHANGELOG.md" -delete \ + && find . -name "README.md" -delete \ + && find . -name ".package-lock.json" -delete \ + && find . -name "package-lock.json" -delete \ + && find . -name "README.md" -delete +WORKDIR / + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START +COPY --link --from=node_modules /node-deps /node-deps +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -74,6 +194,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -81,40 +203,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START +#PIPVENV_PATH__START -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START -WORKDIR /node-deps -RUN npm --no-cache install --ignore-scripts --omit=dev \ - prettier && \ - echo "Cleaning npm cache…" \ - && npm cache clean --force || true \ - && echo "Changing owner of node_modules files…" \ - && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ - && echo "Removing extra node_module files…" \ - && rm -rf /root/.npm/_cacache \ - && find . -name "*.d.ts" -delete \ - && find . -name "*.map" -delete \ - && find . -name "*.npmignore" -delete \ - && find . -name "*.travis.yml" -delete \ - && find . -name "CHANGELOG.md" -delete \ - && find . -name "README.md" -delete \ - && find . -name ".package-lock.json" -delete \ - && find . -name "package-lock.json" -delete \ - && find . -name "README.md" -delete -WORKDIR / - -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -140,15 +231,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START -COPY --link --from=node_modules /node-deps /node-deps -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -157,24 +241,6 @@ COPY --link --from=node_modules /node-deps /node-deps #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/json_v8r/Dockerfile b/linters/json_v8r/Dockerfile index 9bb49b3bd45..0efe6320cec 100644 --- a/linters/json_v8r/Dockerfile +++ b/linters/json_v8r/Dockerfile @@ -14,18 +14,138 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START +RUN apk add --update --no-cache \ + npm +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START +WORKDIR /node-deps +RUN npm --no-cache install --ignore-scripts --omit=dev \ + v8r && \ + echo "Cleaning npm cache…" \ + && npm cache clean --force || true \ + && echo "Changing owner of node_modules files…" \ + && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ + && echo "Removing extra node_module files…" \ + && rm -rf /root/.npm/_cacache \ + && find . -name "*.d.ts" -delete \ + && find . -name "*.map" -delete \ + && find . -name "*.npmignore" -delete \ + && find . -name "*.travis.yml" -delete \ + && find . -name "CHANGELOG.md" -delete \ + && find . -name "README.md" -delete \ + && find . -name ".package-lock.json" -delete \ + && find . -name "package-lock.json" -delete \ + && find . -name "README.md" -delete +WORKDIR / + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START +COPY --link --from=node_modules /node-deps /node-deps +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -74,6 +194,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -81,40 +203,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START +#PIPVENV_PATH__START -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START -WORKDIR /node-deps -RUN npm --no-cache install --ignore-scripts --omit=dev \ - v8r && \ - echo "Cleaning npm cache…" \ - && npm cache clean --force || true \ - && echo "Changing owner of node_modules files…" \ - && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ - && echo "Removing extra node_module files…" \ - && rm -rf /root/.npm/_cacache \ - && find . -name "*.d.ts" -delete \ - && find . -name "*.map" -delete \ - && find . -name "*.npmignore" -delete \ - && find . -name "*.travis.yml" -delete \ - && find . -name "CHANGELOG.md" -delete \ - && find . -name "README.md" -delete \ - && find . -name ".package-lock.json" -delete \ - && find . -name "package-lock.json" -delete \ - && find . -name "README.md" -delete -WORKDIR / - -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -140,15 +231,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START -COPY --link --from=node_modules /node-deps /node-deps -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -157,24 +241,6 @@ COPY --link --from=node_modules /node-deps /node-deps #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/jsx_eslint/Dockerfile b/linters/jsx_eslint/Dockerfile index 188efeda003..af99518dc7a 100644 --- a/linters/jsx_eslint/Dockerfile +++ b/linters/jsx_eslint/Dockerfile @@ -14,18 +14,141 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START +RUN apk add --update --no-cache \ + npm +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START +WORKDIR /node-deps +RUN npm --no-cache install --ignore-scripts --omit=dev \ + eslint \ + eslint-plugin-react \ + eslint-plugin-jsx-a11y \ + @microsoft/eslint-formatter-sarif && \ + echo "Cleaning npm cache…" \ + && npm cache clean --force || true \ + && echo "Changing owner of node_modules files…" \ + && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ + && echo "Removing extra node_module files…" \ + && rm -rf /root/.npm/_cacache \ + && find . -name "*.d.ts" -delete \ + && find . -name "*.map" -delete \ + && find . -name "*.npmignore" -delete \ + && find . -name "*.travis.yml" -delete \ + && find . -name "CHANGELOG.md" -delete \ + && find . -name "README.md" -delete \ + && find . -name ".package-lock.json" -delete \ + && find . -name "package-lock.json" -delete \ + && find . -name "README.md" -delete +WORKDIR / + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START +COPY --link --from=node_modules /node-deps /node-deps +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -74,6 +197,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -81,43 +206,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START -WORKDIR /node-deps -RUN npm --no-cache install --ignore-scripts --omit=dev \ - eslint \ - eslint-plugin-react \ - eslint-plugin-jsx-a11y \ - @microsoft/eslint-formatter-sarif && \ - echo "Cleaning npm cache…" \ - && npm cache clean --force || true \ - && echo "Changing owner of node_modules files…" \ - && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ - && echo "Removing extra node_module files…" \ - && rm -rf /root/.npm/_cacache \ - && find . -name "*.d.ts" -delete \ - && find . -name "*.map" -delete \ - && find . -name "*.npmignore" -delete \ - && find . -name "*.travis.yml" -delete \ - && find . -name "CHANGELOG.md" -delete \ - && find . -name "README.md" -delete \ - && find . -name ".package-lock.json" -delete \ - && find . -name "package-lock.json" -delete \ - && find . -name "README.md" -delete -WORKDIR / +#PIPVENV_PATH__START -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -143,15 +234,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START -COPY --link --from=node_modules /node-deps /node-deps -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -160,24 +244,6 @@ COPY --link --from=node_modules /node-deps /node-deps #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/kotlin_ktlint/Dockerfile b/linters/kotlin_ktlint/Dockerfile index 417d2100b07..d784032cbc8 100644 --- a/linters/kotlin_ktlint/Dockerfile +++ b/linters/kotlin_ktlint/Dockerfile @@ -14,18 +14,118 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START + +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -72,6 +172,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -79,21 +181,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START +#PIPVENV_PATH__START -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -119,15 +209,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START - -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -141,24 +224,6 @@ RUN curl --retry 5 --retry-delay 5 -sSLO https://github.com/pinterest/ktlint/rel # #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/kubernetes_helm/Dockerfile b/linters/kubernetes_helm/Dockerfile index 9ed6aaaa568..a3d6c798f0d 100644 --- a/linters/kubernetes_helm/Dockerfile +++ b/linters/kubernetes_helm/Dockerfile @@ -14,18 +14,118 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START + +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -72,6 +172,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -79,21 +181,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START +#PIPVENV_PATH__START -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -119,15 +209,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START - -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -136,24 +219,6 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/kubernetes_kubeconform/Dockerfile b/linters/kubernetes_kubeconform/Dockerfile index 19fc6d68209..4be3a166133 100644 --- a/linters/kubernetes_kubeconform/Dockerfile +++ b/linters/kubernetes_kubeconform/Dockerfile @@ -14,18 +14,118 @@ FROM ghcr.io/yannh/kubeconform:latest-alpine as kubeconform #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START +COPY --link --from=kubeconform /kubeconform /usr/bin/ +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -71,6 +171,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -78,21 +180,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START +#PIPVENV_PATH__START -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -118,15 +208,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START -COPY --link --from=kubeconform /kubeconform /usr/bin/ -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -135,24 +218,6 @@ COPY --link --from=kubeconform /kubeconform /usr/bin/ #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/kubernetes_kubescape/Dockerfile b/linters/kubernetes_kubescape/Dockerfile index 8c53d9c3edc..9c96147981d 100644 --- a/linters/kubernetes_kubescape/Dockerfile +++ b/linters/kubernetes_kubescape/Dockerfile @@ -14,18 +14,118 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START + +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -74,6 +174,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -81,21 +183,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START +#PIPVENV_PATH__START -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -121,15 +211,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START - -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -142,24 +225,6 @@ RUN ln -s /lib/libc.so.6 /usr/lib/libresolv.so.2 && \ # #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/latex_chktex/Dockerfile b/linters/latex_chktex/Dockerfile index ab76e5f16cb..8262590e2cd 100644 --- a/linters/latex_chktex/Dockerfile +++ b/linters/latex_chktex/Dockerfile @@ -14,18 +14,118 @@ FROM ghcr.io/assignuser/chktex-alpine:latest as chktex #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START +COPY --link --from=chktex /usr/bin/chktex /usr/bin/ +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -71,6 +171,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -78,21 +180,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START +#PIPVENV_PATH__START -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -118,15 +208,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START -COPY --link --from=chktex /usr/bin/chktex /usr/bin/ -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -137,24 +220,6 @@ RUN cd ~ && touch .chktexrc && cd / # #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/lua_luacheck/Dockerfile b/linters/lua_luacheck/Dockerfile index 13859b5a79f..a1dcefddb3d 100644 --- a/linters/lua_luacheck/Dockerfile +++ b/linters/lua_luacheck/Dockerfile @@ -14,18 +14,118 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START + +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -73,6 +173,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -80,21 +182,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START +#PIPVENV_PATH__START -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -120,15 +210,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START - -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -152,24 +235,6 @@ RUN wget --tries=5 https://www.lua.org/ftp/lua-5.3.5.tar.gz -O - -q | tar -xzf - # #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/makefile_checkmake/Dockerfile b/linters/makefile_checkmake/Dockerfile index 010bdd1dd77..4e2525e1120 100644 --- a/linters/makefile_checkmake/Dockerfile +++ b/linters/makefile_checkmake/Dockerfile @@ -14,18 +14,118 @@ FROM mrtazz/checkmake:latest as checkmake #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START +COPY --link --from=checkmake /checkmake /usr/bin/checkmake +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -71,6 +171,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -78,21 +180,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START +#PIPVENV_PATH__START -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -118,15 +208,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START -COPY --link --from=checkmake /checkmake /usr/bin/checkmake -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -135,24 +218,6 @@ COPY --link --from=checkmake /checkmake /usr/bin/checkmake #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/markdown_markdown_link_check/Dockerfile b/linters/markdown_markdown_link_check/Dockerfile index 4c5bdc89571..9dcfcb8f368 100644 --- a/linters/markdown_markdown_link_check/Dockerfile +++ b/linters/markdown_markdown_link_check/Dockerfile @@ -14,18 +14,138 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START +RUN apk add --update --no-cache \ + npm +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START +WORKDIR /node-deps +RUN npm --no-cache install --ignore-scripts --omit=dev \ + markdown-link-check && \ + echo "Cleaning npm cache…" \ + && npm cache clean --force || true \ + && echo "Changing owner of node_modules files…" \ + && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ + && echo "Removing extra node_module files…" \ + && rm -rf /root/.npm/_cacache \ + && find . -name "*.d.ts" -delete \ + && find . -name "*.map" -delete \ + && find . -name "*.npmignore" -delete \ + && find . -name "*.travis.yml" -delete \ + && find . -name "CHANGELOG.md" -delete \ + && find . -name "README.md" -delete \ + && find . -name ".package-lock.json" -delete \ + && find . -name "package-lock.json" -delete \ + && find . -name "README.md" -delete +WORKDIR / + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START +COPY --link --from=node_modules /node-deps /node-deps +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -74,6 +194,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -81,40 +203,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START +#PIPVENV_PATH__START -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START -WORKDIR /node-deps -RUN npm --no-cache install --ignore-scripts --omit=dev \ - markdown-link-check && \ - echo "Cleaning npm cache…" \ - && npm cache clean --force || true \ - && echo "Changing owner of node_modules files…" \ - && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ - && echo "Removing extra node_module files…" \ - && rm -rf /root/.npm/_cacache \ - && find . -name "*.d.ts" -delete \ - && find . -name "*.map" -delete \ - && find . -name "*.npmignore" -delete \ - && find . -name "*.travis.yml" -delete \ - && find . -name "CHANGELOG.md" -delete \ - && find . -name "README.md" -delete \ - && find . -name ".package-lock.json" -delete \ - && find . -name "package-lock.json" -delete \ - && find . -name "README.md" -delete -WORKDIR / - -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -140,15 +231,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START -COPY --link --from=node_modules /node-deps /node-deps -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -157,24 +241,6 @@ COPY --link --from=node_modules /node-deps /node-deps #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/markdown_markdown_table_formatter/Dockerfile b/linters/markdown_markdown_table_formatter/Dockerfile index 7375835b593..0804d7ef640 100644 --- a/linters/markdown_markdown_table_formatter/Dockerfile +++ b/linters/markdown_markdown_table_formatter/Dockerfile @@ -14,18 +14,138 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START +RUN apk add --update --no-cache \ + npm +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START +WORKDIR /node-deps +RUN npm --no-cache install --ignore-scripts --omit=dev \ + markdown-table-formatter && \ + echo "Cleaning npm cache…" \ + && npm cache clean --force || true \ + && echo "Changing owner of node_modules files…" \ + && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ + && echo "Removing extra node_module files…" \ + && rm -rf /root/.npm/_cacache \ + && find . -name "*.d.ts" -delete \ + && find . -name "*.map" -delete \ + && find . -name "*.npmignore" -delete \ + && find . -name "*.travis.yml" -delete \ + && find . -name "CHANGELOG.md" -delete \ + && find . -name "README.md" -delete \ + && find . -name ".package-lock.json" -delete \ + && find . -name "package-lock.json" -delete \ + && find . -name "README.md" -delete +WORKDIR / + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START +COPY --link --from=node_modules /node-deps /node-deps +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -74,6 +194,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -81,40 +203,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START +#PIPVENV_PATH__START -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START -WORKDIR /node-deps -RUN npm --no-cache install --ignore-scripts --omit=dev \ - markdown-table-formatter && \ - echo "Cleaning npm cache…" \ - && npm cache clean --force || true \ - && echo "Changing owner of node_modules files…" \ - && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ - && echo "Removing extra node_module files…" \ - && rm -rf /root/.npm/_cacache \ - && find . -name "*.d.ts" -delete \ - && find . -name "*.map" -delete \ - && find . -name "*.npmignore" -delete \ - && find . -name "*.travis.yml" -delete \ - && find . -name "CHANGELOG.md" -delete \ - && find . -name "README.md" -delete \ - && find . -name ".package-lock.json" -delete \ - && find . -name "package-lock.json" -delete \ - && find . -name "README.md" -delete -WORKDIR / - -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -140,15 +231,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START -COPY --link --from=node_modules /node-deps /node-deps -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -157,24 +241,6 @@ COPY --link --from=node_modules /node-deps /node-deps #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/markdown_markdownlint/Dockerfile b/linters/markdown_markdownlint/Dockerfile index 8a9cb18d6dd..4ec648e4e07 100644 --- a/linters/markdown_markdownlint/Dockerfile +++ b/linters/markdown_markdownlint/Dockerfile @@ -14,18 +14,138 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START +RUN apk add --update --no-cache \ + npm +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START +WORKDIR /node-deps +RUN npm --no-cache install --ignore-scripts --omit=dev \ + markdownlint-cli && \ + echo "Cleaning npm cache…" \ + && npm cache clean --force || true \ + && echo "Changing owner of node_modules files…" \ + && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ + && echo "Removing extra node_module files…" \ + && rm -rf /root/.npm/_cacache \ + && find . -name "*.d.ts" -delete \ + && find . -name "*.map" -delete \ + && find . -name "*.npmignore" -delete \ + && find . -name "*.travis.yml" -delete \ + && find . -name "CHANGELOG.md" -delete \ + && find . -name "README.md" -delete \ + && find . -name ".package-lock.json" -delete \ + && find . -name "package-lock.json" -delete \ + && find . -name "README.md" -delete +WORKDIR / + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START +COPY --link --from=node_modules /node-deps /node-deps +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -74,6 +194,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -81,40 +203,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START +#PIPVENV_PATH__START -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START -WORKDIR /node-deps -RUN npm --no-cache install --ignore-scripts --omit=dev \ - markdownlint-cli && \ - echo "Cleaning npm cache…" \ - && npm cache clean --force || true \ - && echo "Changing owner of node_modules files…" \ - && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ - && echo "Removing extra node_module files…" \ - && rm -rf /root/.npm/_cacache \ - && find . -name "*.d.ts" -delete \ - && find . -name "*.map" -delete \ - && find . -name "*.npmignore" -delete \ - && find . -name "*.travis.yml" -delete \ - && find . -name "CHANGELOG.md" -delete \ - && find . -name "README.md" -delete \ - && find . -name ".package-lock.json" -delete \ - && find . -name "package-lock.json" -delete \ - && find . -name "README.md" -delete -WORKDIR / - -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -140,15 +231,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START -COPY --link --from=node_modules /node-deps /node-deps -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -157,24 +241,6 @@ COPY --link --from=node_modules /node-deps /node-deps #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/markdown_remark_lint/Dockerfile b/linters/markdown_remark_lint/Dockerfile index b20fa7e60ba..df2ec5b48ef 100644 --- a/linters/markdown_remark_lint/Dockerfile +++ b/linters/markdown_remark_lint/Dockerfile @@ -14,18 +14,139 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START +RUN apk add --update --no-cache \ + npm +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START +WORKDIR /node-deps +RUN npm --no-cache install --ignore-scripts --omit=dev \ + remark-cli \ + remark-preset-lint-recommended && \ + echo "Cleaning npm cache…" \ + && npm cache clean --force || true \ + && echo "Changing owner of node_modules files…" \ + && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ + && echo "Removing extra node_module files…" \ + && rm -rf /root/.npm/_cacache \ + && find . -name "*.d.ts" -delete \ + && find . -name "*.map" -delete \ + && find . -name "*.npmignore" -delete \ + && find . -name "*.travis.yml" -delete \ + && find . -name "CHANGELOG.md" -delete \ + && find . -name "README.md" -delete \ + && find . -name ".package-lock.json" -delete \ + && find . -name "package-lock.json" -delete \ + && find . -name "README.md" -delete +WORKDIR / + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START +COPY --link --from=node_modules /node-deps /node-deps +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -74,6 +195,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -81,41 +204,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START -WORKDIR /node-deps -RUN npm --no-cache install --ignore-scripts --omit=dev \ - remark-cli \ - remark-preset-lint-recommended && \ - echo "Cleaning npm cache…" \ - && npm cache clean --force || true \ - && echo "Changing owner of node_modules files…" \ - && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ - && echo "Removing extra node_module files…" \ - && rm -rf /root/.npm/_cacache \ - && find . -name "*.d.ts" -delete \ - && find . -name "*.map" -delete \ - && find . -name "*.npmignore" -delete \ - && find . -name "*.travis.yml" -delete \ - && find . -name "CHANGELOG.md" -delete \ - && find . -name "README.md" -delete \ - && find . -name ".package-lock.json" -delete \ - && find . -name "package-lock.json" -delete \ - && find . -name "README.md" -delete -WORKDIR / +#PIPVENV_PATH__START -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -141,15 +232,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START -COPY --link --from=node_modules /node-deps /node-deps -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -158,24 +242,6 @@ COPY --link --from=node_modules /node-deps /node-deps #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/openapi_spectral/Dockerfile b/linters/openapi_spectral/Dockerfile index 8329350333a..362b95f40d5 100644 --- a/linters/openapi_spectral/Dockerfile +++ b/linters/openapi_spectral/Dockerfile @@ -14,18 +14,138 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START +RUN apk add --update --no-cache \ + npm +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START +WORKDIR /node-deps +RUN npm --no-cache install --ignore-scripts --omit=dev \ + @stoplight/spectral-cli && \ + echo "Cleaning npm cache…" \ + && npm cache clean --force || true \ + && echo "Changing owner of node_modules files…" \ + && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ + && echo "Removing extra node_module files…" \ + && rm -rf /root/.npm/_cacache \ + && find . -name "*.d.ts" -delete \ + && find . -name "*.map" -delete \ + && find . -name "*.npmignore" -delete \ + && find . -name "*.travis.yml" -delete \ + && find . -name "CHANGELOG.md" -delete \ + && find . -name "README.md" -delete \ + && find . -name ".package-lock.json" -delete \ + && find . -name "package-lock.json" -delete \ + && find . -name "README.md" -delete +WORKDIR / + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START +COPY --link --from=node_modules /node-deps /node-deps +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -74,6 +194,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -81,40 +203,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START +#PIPVENV_PATH__START -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START -WORKDIR /node-deps -RUN npm --no-cache install --ignore-scripts --omit=dev \ - @stoplight/spectral-cli && \ - echo "Cleaning npm cache…" \ - && npm cache clean --force || true \ - && echo "Changing owner of node_modules files…" \ - && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ - && echo "Removing extra node_module files…" \ - && rm -rf /root/.npm/_cacache \ - && find . -name "*.d.ts" -delete \ - && find . -name "*.map" -delete \ - && find . -name "*.npmignore" -delete \ - && find . -name "*.travis.yml" -delete \ - && find . -name "CHANGELOG.md" -delete \ - && find . -name "README.md" -delete \ - && find . -name ".package-lock.json" -delete \ - && find . -name "package-lock.json" -delete \ - && find . -name "README.md" -delete -WORKDIR / - -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -140,15 +231,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START -COPY --link --from=node_modules /node-deps /node-deps -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -157,24 +241,6 @@ COPY --link --from=node_modules /node-deps /node-deps #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/perl_perlcritic/Dockerfile b/linters/perl_perlcritic/Dockerfile index bfe7b5b1723..13ab4627774 100644 --- a/linters/perl_perlcritic/Dockerfile +++ b/linters/perl_perlcritic/Dockerfile @@ -14,18 +14,118 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START + +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -73,6 +173,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -80,21 +182,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START +#PIPVENV_PATH__START -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -120,15 +210,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START - -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -139,24 +222,6 @@ RUN curl --retry 5 --retry-delay 5 -sL https://cpanmin.us/ | perl - -nq --no-wge # #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/php_phpcs/Dockerfile b/linters/php_phpcs/Dockerfile index 3b11951a0b8..44df4872335 100644 --- a/linters/php_phpcs/Dockerfile +++ b/linters/php_phpcs/Dockerfile @@ -14,18 +14,118 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START + +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -82,6 +182,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -89,21 +191,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START +#PIPVENV_PATH__START -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -129,15 +219,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START - -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -166,24 +249,6 @@ RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GI # #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/php_phplint/Dockerfile b/linters/php_phplint/Dockerfile index 31a045cec49..fb4d325117f 100644 --- a/linters/php_phplint/Dockerfile +++ b/linters/php_phplint/Dockerfile @@ -14,18 +14,118 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START + +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -82,6 +182,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -89,21 +191,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START +#PIPVENV_PATH__START -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -129,15 +219,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START - -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -166,24 +249,6 @@ RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GI # #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/php_phpstan/Dockerfile b/linters/php_phpstan/Dockerfile index 69d349fec92..97e5b1f004c 100644 --- a/linters/php_phpstan/Dockerfile +++ b/linters/php_phpstan/Dockerfile @@ -14,18 +14,118 @@ FROM ghcr.io/phpstan/phpstan:latest-php8.1 as phpstan #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START +COPY --link --chmod=755 --from=phpstan /composer/vendor/phpstan/phpstan/phpstan.phar /usr/bin/phpstan +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -82,6 +182,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -89,21 +191,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START +#PIPVENV_PATH__START -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -129,15 +219,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START -COPY --link --chmod=755 --from=phpstan /composer/vendor/phpstan/phpstan/phpstan.phar /usr/bin/phpstan -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -162,24 +245,6 @@ RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GI # #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/php_psalm/Dockerfile b/linters/php_psalm/Dockerfile index 62d31508032..556298cfe7b 100644 --- a/linters/php_psalm/Dockerfile +++ b/linters/php_psalm/Dockerfile @@ -14,18 +14,118 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START + +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -82,6 +182,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -89,21 +191,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START +#PIPVENV_PATH__START -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -129,15 +219,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START - -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -166,24 +249,6 @@ RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GI # #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/powershell_powershell/Dockerfile b/linters/powershell_powershell/Dockerfile index 90965ec7a46..297a8a7147c 100644 --- a/linters/powershell_powershell/Dockerfile +++ b/linters/powershell_powershell/Dockerfile @@ -14,18 +14,118 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START + +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -75,6 +175,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -82,21 +184,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START +#PIPVENV_PATH__START -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START - -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -122,15 +212,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START - -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -160,24 +243,6 @@ RUN pwsh -c 'Install-Module -Name PSScriptAnalyzer -RequiredVersion ${PSSA_VERSI # #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/powershell_powershell_formatter/Dockerfile b/linters/powershell_powershell_formatter/Dockerfile index 6580a936833..3114a738b4c 100644 --- a/linters/powershell_powershell_formatter/Dockerfile +++ b/linters/powershell_powershell_formatter/Dockerfile @@ -14,18 +14,118 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START + +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -75,6 +175,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -82,21 +184,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START +#PIPVENV_PATH__START -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START - -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -122,15 +212,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START - -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -160,24 +243,6 @@ RUN pwsh -c 'Install-Module -Name PSScriptAnalyzer -RequiredVersion ${PSSA_VERSI # #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/protobuf_protolint/Dockerfile b/linters/protobuf_protolint/Dockerfile index e8ac8661ecd..7d46f2b6fb2 100644 --- a/linters/protobuf_protolint/Dockerfile +++ b/linters/protobuf_protolint/Dockerfile @@ -14,18 +14,118 @@ FROM yoheimuta/protolint:latest as protolint #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START +COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -71,6 +171,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -78,21 +180,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START +#PIPVENV_PATH__START -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -118,15 +208,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START -COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -135,24 +218,6 @@ COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/puppet_puppet_lint/Dockerfile b/linters/puppet_puppet_lint/Dockerfile index e80660b0ae8..bd121de6b80 100644 --- a/linters/puppet_puppet_lint/Dockerfile +++ b/linters/puppet_puppet_lint/Dockerfile @@ -14,18 +14,118 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START + +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -75,6 +175,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -82,21 +184,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START +#PIPVENV_PATH__START -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -124,15 +214,8 @@ RUN echo 'gem: --no-document' >> ~/.gemrc && \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START - -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -141,24 +224,6 @@ RUN echo 'gem: --no-document' >> ~/.gemrc && \ #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/python_bandit/Dockerfile b/linters/python_bandit/Dockerfile index 690d3190ba3..7cda30b946a 100644 --- a/linters/python_bandit/Dockerfile +++ b/linters/python_bandit/Dockerfile @@ -14,18 +14,131 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START + +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START +RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ + mkdir /download \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ +&& pip download --cache-dir=/var/cache/pip --dest "/download" \ + bandit \ + bandit_sarif_formatter \ + bandit[toml] + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/bandit" \ + && cd "/venvs/bandit" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip bandit bandit_sarif_formatter bandit[toml] + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -71,6 +184,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -78,27 +193,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START -RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ - mkdir -p "/venvs/bandit" \ - && cd "/venvs/bandit" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip bandit bandit_sarif_formatter bandit[toml] - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START - -#NPM__END +#PIPVENV_PATH__START +ENV PATH="${PATH}":/venvs/bandit/cross/bin +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -124,15 +221,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START - -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -141,24 +231,6 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/python_black/Dockerfile b/linters/python_black/Dockerfile index 4ce399c1a0a..fc974cbe68b 100644 --- a/linters/python_black/Dockerfile +++ b/linters/python_black/Dockerfile @@ -14,18 +14,129 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START + +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START +RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ + mkdir /download \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ +&& pip download --cache-dir=/var/cache/pip --dest "/download" \ + black + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/black" \ + && cd "/venvs/black" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip black + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -71,6 +182,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -78,27 +191,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START -RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ - mkdir -p "/venvs/black" \ - && cd "/venvs/black" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip black - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START - -#NPM__END +#PIPVENV_PATH__START +ENV PATH="${PATH}":/venvs/black/cross/bin +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -124,15 +219,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START - -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -141,24 +229,6 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/python_flake8/Dockerfile b/linters/python_flake8/Dockerfile index 50275a91874..e891e0f88cf 100644 --- a/linters/python_flake8/Dockerfile +++ b/linters/python_flake8/Dockerfile @@ -14,18 +14,129 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START + +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START +RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ + mkdir /download \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ +&& pip download --cache-dir=/var/cache/pip --dest "/download" \ + flake8 + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/flake8" \ + && cd "/venvs/flake8" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip flake8 + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -71,6 +182,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -78,27 +191,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START -RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ - mkdir -p "/venvs/flake8" \ - && cd "/venvs/flake8" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip flake8 - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START - -#NPM__END +#PIPVENV_PATH__START +ENV PATH="${PATH}":/venvs/flake8/cross/bin +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -124,15 +219,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START - -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -141,24 +229,6 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/python_isort/Dockerfile b/linters/python_isort/Dockerfile index 693b9380e33..5ae812f448c 100644 --- a/linters/python_isort/Dockerfile +++ b/linters/python_isort/Dockerfile @@ -14,18 +14,130 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START + +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START +RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ + mkdir /download \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ +&& pip download --cache-dir=/var/cache/pip --dest "/download" \ + isort \ + black + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/isort" \ + && cd "/venvs/isort" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip isort black + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -71,6 +183,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -78,27 +192,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START -RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ - mkdir -p "/venvs/isort" \ - && cd "/venvs/isort" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip isort black - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START - -#NPM__END +#PIPVENV_PATH__START +ENV PATH="${PATH}":/venvs/isort/cross/bin +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -124,15 +220,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START - -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -141,24 +230,6 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/python_mypy/Dockerfile b/linters/python_mypy/Dockerfile index 400ba3ae0ed..db724f16e0f 100644 --- a/linters/python_mypy/Dockerfile +++ b/linters/python_mypy/Dockerfile @@ -14,18 +14,129 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START + +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START +RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ + mkdir /download \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ +&& pip download --cache-dir=/var/cache/pip --dest "/download" \ + mypy + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/mypy" \ + && cd "/venvs/mypy" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip mypy + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -71,6 +182,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -78,27 +191,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START -RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ - mkdir -p "/venvs/mypy" \ - && cd "/venvs/mypy" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip mypy - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START - -#NPM__END +#PIPVENV_PATH__START +ENV PATH="${PATH}":/venvs/mypy/cross/bin +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -124,15 +219,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START - -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -143,24 +231,6 @@ ENV MYPY_CACHE_DIR=/tmp # #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/python_pylint/Dockerfile b/linters/python_pylint/Dockerfile index f861a80b05a..b9fc55ddab9 100644 --- a/linters/python_pylint/Dockerfile +++ b/linters/python_pylint/Dockerfile @@ -14,18 +14,130 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START + +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START +RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ + mkdir /download \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ +&& pip download --cache-dir=/var/cache/pip --dest "/download" \ + pylint \ + typing-extensions + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/pylint" \ + && cd "/venvs/pylint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip pylint typing-extensions + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -71,6 +183,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -78,27 +192,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START -RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ - mkdir -p "/venvs/pylint" \ - && cd "/venvs/pylint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip pylint typing-extensions - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START - -#NPM__END +#PIPVENV_PATH__START +ENV PATH="${PATH}":/venvs/pylint/cross/bin +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -124,15 +220,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START - -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -141,24 +230,6 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/python_pyright/Dockerfile b/linters/python_pyright/Dockerfile index 156e050d06c..8cdea0c74b7 100644 --- a/linters/python_pyright/Dockerfile +++ b/linters/python_pyright/Dockerfile @@ -14,18 +14,129 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START + +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START +RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ + mkdir /download \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ +&& pip download --cache-dir=/var/cache/pip --dest "/download" \ + pyright + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/pyright" \ + && cd "/venvs/pyright" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip pyright + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -72,6 +183,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -79,27 +192,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START -RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ - mkdir -p "/venvs/pyright" \ - && cd "/venvs/pyright" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip pyright - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START - -#NPM__END +#PIPVENV_PATH__START +ENV PATH="${PATH}":/venvs/pyright/cross/bin +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -125,15 +220,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START - -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -142,24 +230,6 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/python_ruff/Dockerfile b/linters/python_ruff/Dockerfile index 5fdac1fd8bc..9782dbcb4e2 100644 --- a/linters/python_ruff/Dockerfile +++ b/linters/python_ruff/Dockerfile @@ -22,18 +22,118 @@ RUN export DL_LOCATION="https://github.com/charliermarsh/ruff/releases/latest/do && curl --location "${DL_LOCATION}" | tar -xzv #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START +COPY --link --from=fetch-ruff /ruff /usr/bin/ruff +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -79,6 +179,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -86,21 +188,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START +#PIPVENV_PATH__START -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -126,15 +216,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START -COPY --link --from=fetch-ruff /ruff /usr/bin/ruff -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -143,24 +226,6 @@ COPY --link --from=fetch-ruff /ruff /usr/bin/ruff #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/r_lintr/Dockerfile b/linters/r_lintr/Dockerfile index 4f849378943..c28b1df24ae 100644 --- a/linters/r_lintr/Dockerfile +++ b/linters/r_lintr/Dockerfile @@ -14,18 +14,118 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START + +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -81,6 +181,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -88,21 +190,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START +#PIPVENV_PATH__START -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -128,15 +218,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START - -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -151,24 +234,6 @@ RUN mkdir -p /home/r-library \ # #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/raku_raku/Dockerfile b/linters/raku_raku/Dockerfile index 710d93e684e..3f11eb9c7b0 100644 --- a/linters/raku_raku/Dockerfile +++ b/linters/raku_raku/Dockerfile @@ -14,18 +14,118 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START + +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -71,6 +171,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -78,21 +180,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START +#PIPVENV_PATH__START -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -118,15 +208,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START - -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -144,24 +227,6 @@ ENV PATH="~/.raku/bin:/opt/rakudo-pkg/bin:/opt/rakudo-pkg/share/perl6/site/bin:$ # #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/repository_checkov/Dockerfile b/linters/repository_checkov/Dockerfile index 5b71853af96..1b30aff5c9b 100644 --- a/linters/repository_checkov/Dockerfile +++ b/linters/repository_checkov/Dockerfile @@ -14,18 +14,132 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START + +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev \ + g++ \ + cmake +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START +RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ + mkdir /download \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ +&& pip download --cache-dir=/var/cache/pip --dest "/download" \ + packaging \ + checkov + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/checkov" \ + && cd "/venvs/checkov" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip packaging checkov + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -71,6 +185,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -78,27 +194,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START -RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ - mkdir -p "/venvs/checkov" \ - && cd "/venvs/checkov" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip packaging checkov - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START - -#NPM__END +#PIPVENV_PATH__START +ENV PATH="${PATH}":/venvs/checkov/cross/bin +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -124,15 +222,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START - -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -141,24 +232,6 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/repository_devskim/Dockerfile b/linters/repository_devskim/Dockerfile index 0847ea8f202..dda841fc256 100644 --- a/linters/repository_devskim/Dockerfile +++ b/linters/repository_devskim/Dockerfile @@ -14,18 +14,118 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START + +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -79,6 +179,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -86,21 +188,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START +#PIPVENV_PATH__START -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -126,15 +216,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START - -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -150,24 +233,6 @@ RUN dotnet tool install --global Microsoft.CST.DevSkim.CLI # #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/repository_dustilock/Dockerfile b/linters/repository_dustilock/Dockerfile index a2f758a4bd1..45397758310 100644 --- a/linters/repository_dustilock/Dockerfile +++ b/linters/repository_dustilock/Dockerfile @@ -16,18 +16,118 @@ RUN GOBIN=/usr/bin go install github.com/checkmarx/dustilock@v1.2.0 #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START +COPY --link --from=dustilock /usr/bin/dustilock /usr/bin/dustilock +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -73,6 +173,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -80,21 +182,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START +#PIPVENV_PATH__START -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -120,15 +210,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START -COPY --link --from=dustilock /usr/bin/dustilock /usr/bin/dustilock -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -137,24 +220,6 @@ COPY --link --from=dustilock /usr/bin/dustilock /usr/bin/dustilock #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/repository_git_diff/Dockerfile b/linters/repository_git_diff/Dockerfile index 305463ada65..178e85dc9d7 100644 --- a/linters/repository_git_diff/Dockerfile +++ b/linters/repository_git_diff/Dockerfile @@ -14,18 +14,118 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START + +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -71,6 +171,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -78,21 +180,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START +#PIPVENV_PATH__START -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -118,15 +208,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START - -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -135,24 +218,6 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/repository_gitleaks/Dockerfile b/linters/repository_gitleaks/Dockerfile index eb59cd7b63e..5b0e529cc50 100644 --- a/linters/repository_gitleaks/Dockerfile +++ b/linters/repository_gitleaks/Dockerfile @@ -14,18 +14,118 @@ FROM zricethezav/gitleaks:v8.17.0 as gitleaks #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START +COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -71,6 +171,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -78,21 +180,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START +#PIPVENV_PATH__START -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -118,15 +208,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START -COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -135,24 +218,6 @@ COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/repository_grype/Dockerfile b/linters/repository_grype/Dockerfile index 42555c29a45..7313f760421 100644 --- a/linters/repository_grype/Dockerfile +++ b/linters/repository_grype/Dockerfile @@ -14,18 +14,118 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START + +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -71,6 +171,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -78,21 +180,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START +#PIPVENV_PATH__START -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -118,15 +208,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START - -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -137,24 +220,6 @@ RUN curl -sSfL https://raw.githubusercontent.com/anchore/grype/main/install.sh | # #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/repository_kics/Dockerfile b/linters/repository_kics/Dockerfile index 9e46534355f..769c623037d 100644 --- a/linters/repository_kics/Dockerfile +++ b/linters/repository_kics/Dockerfile @@ -14,18 +14,119 @@ FROM checkmarx/kics:alpine as kics #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START +COPY --link --from=kics /app/bin/kics /usr/bin/ +COPY --from=kics /app/bin/assets /opt/kics/assets/ +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -71,6 +172,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -78,21 +181,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START +#PIPVENV_PATH__START -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START - -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -118,16 +209,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START -COPY --link --from=kics /app/bin/kics /usr/bin/ -COPY --from=kics /app/bin/assets /opt/kics/assets/ -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -139,24 +222,6 @@ ENV KICS_QUERIES_PATH=/opt/kics/assets/queries KICS_LIBRARIES_PATH=/opt/kics/ass # #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/repository_secretlint/Dockerfile b/linters/repository_secretlint/Dockerfile index 7d296e75c36..66212fc4ddb 100644 --- a/linters/repository_secretlint/Dockerfile +++ b/linters/repository_secretlint/Dockerfile @@ -14,18 +14,140 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START +RUN apk add --update --no-cache \ + npm +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START +WORKDIR /node-deps +RUN npm --no-cache install --ignore-scripts --omit=dev \ + secretlint \ + @secretlint/secretlint-rule-preset-recommend \ + @secretlint/secretlint-formatter-sarif && \ + echo "Cleaning npm cache…" \ + && npm cache clean --force || true \ + && echo "Changing owner of node_modules files…" \ + && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ + && echo "Removing extra node_module files…" \ + && rm -rf /root/.npm/_cacache \ + && find . -name "*.d.ts" -delete \ + && find . -name "*.map" -delete \ + && find . -name "*.npmignore" -delete \ + && find . -name "*.travis.yml" -delete \ + && find . -name "CHANGELOG.md" -delete \ + && find . -name "README.md" -delete \ + && find . -name ".package-lock.json" -delete \ + && find . -name "package-lock.json" -delete \ + && find . -name "README.md" -delete +WORKDIR / + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START +COPY --link --from=node_modules /node-deps /node-deps +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -74,6 +196,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -81,42 +205,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START +#PIPVENV_PATH__START -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START -WORKDIR /node-deps -RUN npm --no-cache install --ignore-scripts --omit=dev \ - secretlint \ - @secretlint/secretlint-rule-preset-recommend \ - @secretlint/secretlint-formatter-sarif && \ - echo "Cleaning npm cache…" \ - && npm cache clean --force || true \ - && echo "Changing owner of node_modules files…" \ - && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ - && echo "Removing extra node_module files…" \ - && rm -rf /root/.npm/_cacache \ - && find . -name "*.d.ts" -delete \ - && find . -name "*.map" -delete \ - && find . -name "*.npmignore" -delete \ - && find . -name "*.travis.yml" -delete \ - && find . -name "CHANGELOG.md" -delete \ - && find . -name "README.md" -delete \ - && find . -name ".package-lock.json" -delete \ - && find . -name "package-lock.json" -delete \ - && find . -name "README.md" -delete -WORKDIR / - -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -142,15 +233,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START -COPY --link --from=node_modules /node-deps /node-deps -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -159,24 +243,6 @@ COPY --link --from=node_modules /node-deps /node-deps #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/repository_semgrep/Dockerfile b/linters/repository_semgrep/Dockerfile index a9a7beb3627..128fbf9617a 100644 --- a/linters/repository_semgrep/Dockerfile +++ b/linters/repository_semgrep/Dockerfile @@ -14,18 +14,131 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START + +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev \ + g++ \ + cmake +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START +RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ + mkdir /download \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ +&& pip download --cache-dir=/var/cache/pip --dest "/download" \ + semgrep + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/semgrep" \ + && cd "/venvs/semgrep" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip semgrep + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -71,6 +184,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -78,27 +193,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START -RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ - mkdir -p "/venvs/semgrep" \ - && cd "/venvs/semgrep" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip semgrep - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START - -#NPM__END +#PIPVENV_PATH__START +ENV PATH="${PATH}":/venvs/semgrep/cross/bin +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -124,15 +221,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START - -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -141,24 +231,6 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/repository_syft/Dockerfile b/linters/repository_syft/Dockerfile index 59028ac8c5b..22b778bd3f8 100644 --- a/linters/repository_syft/Dockerfile +++ b/linters/repository_syft/Dockerfile @@ -14,18 +14,118 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START + +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -71,6 +171,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -78,21 +180,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START +#PIPVENV_PATH__START -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -118,15 +208,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START - -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -137,24 +220,6 @@ RUN curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | # #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/repository_trivy/Dockerfile b/linters/repository_trivy/Dockerfile index 0b8733043bc..63b010b36fc 100644 --- a/linters/repository_trivy/Dockerfile +++ b/linters/repository_trivy/Dockerfile @@ -14,18 +14,118 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START + +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -71,6 +171,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -78,21 +180,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START +#PIPVENV_PATH__START -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -118,15 +208,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START - -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -138,24 +221,6 @@ RUN wget --tries=5 -q -O - https://raw.githubusercontent.com/aquasecurity/trivy/ # #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/repository_trivy_sbom/Dockerfile b/linters/repository_trivy_sbom/Dockerfile index a92a94fc486..a6c6ec3bdea 100644 --- a/linters/repository_trivy_sbom/Dockerfile +++ b/linters/repository_trivy_sbom/Dockerfile @@ -14,18 +14,118 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START + +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -71,6 +171,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -78,21 +180,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START +#PIPVENV_PATH__START -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -118,15 +208,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START - -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -138,24 +221,6 @@ RUN wget --tries=5 -q -O - https://raw.githubusercontent.com/aquasecurity/trivy/ # #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/repository_trufflehog/Dockerfile b/linters/repository_trufflehog/Dockerfile index 4f288e47340..8be07d846fe 100644 --- a/linters/repository_trufflehog/Dockerfile +++ b/linters/repository_trufflehog/Dockerfile @@ -14,18 +14,118 @@ FROM trufflesecurity/trufflehog:latest as trufflehog #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START +COPY --link --from=trufflehog /usr/bin/trufflehog /usr/bin/ +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -71,6 +171,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -78,21 +180,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START +#PIPVENV_PATH__START -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -118,15 +208,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START -COPY --link --from=trufflehog /usr/bin/trufflehog /usr/bin/ -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -135,24 +218,6 @@ COPY --link --from=trufflehog /usr/bin/trufflehog /usr/bin/ #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/rst_rst_lint/Dockerfile b/linters/rst_rst_lint/Dockerfile index 8a565576b8f..3f00961f159 100644 --- a/linters/rst_rst_lint/Dockerfile +++ b/linters/rst_rst_lint/Dockerfile @@ -14,18 +14,129 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START + +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START +RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ + mkdir /download \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ +&& pip download --cache-dir=/var/cache/pip --dest "/download" \ + restructuredtext_lint + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/rst-lint" \ + && cd "/venvs/rst-lint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip restructuredtext_lint + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -71,6 +182,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -78,27 +191,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START -RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ - mkdir -p "/venvs/rst-lint" \ - && cd "/venvs/rst-lint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip restructuredtext_lint - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START - -#NPM__END +#PIPVENV_PATH__START +ENV PATH="${PATH}":/venvs/rst-lint/cross/bin +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -124,15 +219,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START - -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -141,24 +229,6 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/rst_rstcheck/Dockerfile b/linters/rst_rstcheck/Dockerfile index 42a5129fbeb..750fc879a94 100644 --- a/linters/rst_rstcheck/Dockerfile +++ b/linters/rst_rstcheck/Dockerfile @@ -14,18 +14,129 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START + +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START +RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ + mkdir /download \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ +&& pip download --cache-dir=/var/cache/pip --dest "/download" \ + rstcheck + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/rstcheck" \ + && cd "/venvs/rstcheck" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip rstcheck + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -71,6 +182,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -78,27 +191,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START -RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ - mkdir -p "/venvs/rstcheck" \ - && cd "/venvs/rstcheck" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip rstcheck - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START - -#NPM__END +#PIPVENV_PATH__START +ENV PATH="${PATH}":/venvs/rstcheck/cross/bin +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -124,15 +219,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START - -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -141,24 +229,6 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/rst_rstfmt/Dockerfile b/linters/rst_rstfmt/Dockerfile index 7c0cce494c7..f5e572d68ea 100644 --- a/linters/rst_rstfmt/Dockerfile +++ b/linters/rst_rstfmt/Dockerfile @@ -14,18 +14,129 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START + +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START +RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ + mkdir /download \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ +&& pip download --cache-dir=/var/cache/pip --dest "/download" \ + rstfmt + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/rstfmt" \ + && cd "/venvs/rstfmt" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip rstfmt + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -71,6 +182,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -78,27 +191,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START -RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ - mkdir -p "/venvs/rstfmt" \ - && cd "/venvs/rstfmt" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip rstfmt - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START - -#NPM__END +#PIPVENV_PATH__START +ENV PATH="${PATH}":/venvs/rstfmt/cross/bin +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -124,15 +219,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START - -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -141,24 +229,6 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/ruby_rubocop/Dockerfile b/linters/ruby_rubocop/Dockerfile index 3e475661ef8..d4fc9f8ecd3 100644 --- a/linters/ruby_rubocop/Dockerfile +++ b/linters/ruby_rubocop/Dockerfile @@ -14,18 +14,118 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START + +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -75,6 +175,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -82,21 +184,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START +#PIPVENV_PATH__START -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -129,15 +219,8 @@ RUN echo 'gem: --no-document' >> ~/.gemrc && \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START - -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -146,24 +229,6 @@ RUN echo 'gem: --no-document' >> ~/.gemrc && \ #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/rust_clippy/Dockerfile b/linters/rust_clippy/Dockerfile index 64a05926222..9bf811076e2 100644 --- a/linters/rust_clippy/Dockerfile +++ b/linters/rust_clippy/Dockerfile @@ -49,18 +49,118 @@ RUN ["/bin/", "--help"] #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START +COPY --link --from=cargo /bin/* /usr/bin/ +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -106,6 +206,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -113,21 +215,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START +#PIPVENV_PATH__START -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -157,15 +247,8 @@ RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-too ENV PATH="/root/.cargo/bin:${PATH}" #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START -COPY --link --from=cargo /bin/* /usr/bin/ -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -174,24 +257,6 @@ COPY --link --from=cargo /bin/* /usr/bin/ #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/salesforce_sfdx_scanner_apex/Dockerfile b/linters/salesforce_sfdx_scanner_apex/Dockerfile index 2858f4ee9d3..a6ca3186afe 100644 --- a/linters/salesforce_sfdx_scanner_apex/Dockerfile +++ b/linters/salesforce_sfdx_scanner_apex/Dockerfile @@ -14,18 +14,138 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START +RUN apk add --update --no-cache \ + npm +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START +WORKDIR /node-deps +RUN npm --no-cache install --ignore-scripts --omit=dev \ + sfdx-cli && \ + echo "Cleaning npm cache…" \ + && npm cache clean --force || true \ + && echo "Changing owner of node_modules files…" \ + && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ + && echo "Removing extra node_module files…" \ + && rm -rf /root/.npm/_cacache \ + && find . -name "*.d.ts" -delete \ + && find . -name "*.map" -delete \ + && find . -name "*.npmignore" -delete \ + && find . -name "*.travis.yml" -delete \ + && find . -name "CHANGELOG.md" -delete \ + && find . -name "README.md" -delete \ + && find . -name ".package-lock.json" -delete \ + && find . -name "package-lock.json" -delete \ + && find . -name "README.md" -delete +WORKDIR / + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START +COPY --link --from=node_modules /node-deps /node-deps +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -75,6 +195,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -82,40 +204,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START +#PIPVENV_PATH__START -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START -WORKDIR /node-deps -RUN npm --no-cache install --ignore-scripts --omit=dev \ - sfdx-cli && \ - echo "Cleaning npm cache…" \ - && npm cache clean --force || true \ - && echo "Changing owner of node_modules files…" \ - && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ - && echo "Removing extra node_module files…" \ - && rm -rf /root/.npm/_cacache \ - && find . -name "*.d.ts" -delete \ - && find . -name "*.map" -delete \ - && find . -name "*.npmignore" -delete \ - && find . -name "*.travis.yml" -delete \ - && find . -name "CHANGELOG.md" -delete \ - && find . -name "README.md" -delete \ - && find . -name ".package-lock.json" -delete \ - && find . -name "package-lock.json" -delete \ - && find . -name "README.md" -delete -WORKDIR / - -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -141,15 +232,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START -COPY --link --from=node_modules /node-deps /node-deps -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -170,24 +254,6 @@ RUN echo y|sfdx plugins:install sfdx-hardis \ # #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/salesforce_sfdx_scanner_aura/Dockerfile b/linters/salesforce_sfdx_scanner_aura/Dockerfile index eaa7a086e62..cfc163c0172 100644 --- a/linters/salesforce_sfdx_scanner_aura/Dockerfile +++ b/linters/salesforce_sfdx_scanner_aura/Dockerfile @@ -14,18 +14,138 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START +RUN apk add --update --no-cache \ + npm +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START +WORKDIR /node-deps +RUN npm --no-cache install --ignore-scripts --omit=dev \ + sfdx-cli && \ + echo "Cleaning npm cache…" \ + && npm cache clean --force || true \ + && echo "Changing owner of node_modules files…" \ + && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ + && echo "Removing extra node_module files…" \ + && rm -rf /root/.npm/_cacache \ + && find . -name "*.d.ts" -delete \ + && find . -name "*.map" -delete \ + && find . -name "*.npmignore" -delete \ + && find . -name "*.travis.yml" -delete \ + && find . -name "CHANGELOG.md" -delete \ + && find . -name "README.md" -delete \ + && find . -name ".package-lock.json" -delete \ + && find . -name "package-lock.json" -delete \ + && find . -name "README.md" -delete +WORKDIR / + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START +COPY --link --from=node_modules /node-deps /node-deps +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -75,6 +195,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -82,40 +204,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START +#PIPVENV_PATH__START -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START -WORKDIR /node-deps -RUN npm --no-cache install --ignore-scripts --omit=dev \ - sfdx-cli && \ - echo "Cleaning npm cache…" \ - && npm cache clean --force || true \ - && echo "Changing owner of node_modules files…" \ - && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ - && echo "Removing extra node_module files…" \ - && rm -rf /root/.npm/_cacache \ - && find . -name "*.d.ts" -delete \ - && find . -name "*.map" -delete \ - && find . -name "*.npmignore" -delete \ - && find . -name "*.travis.yml" -delete \ - && find . -name "CHANGELOG.md" -delete \ - && find . -name "README.md" -delete \ - && find . -name ".package-lock.json" -delete \ - && find . -name "package-lock.json" -delete \ - && find . -name "README.md" -delete -WORKDIR / - -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -141,15 +232,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START -COPY --link --from=node_modules /node-deps /node-deps -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -170,24 +254,6 @@ RUN echo y|sfdx plugins:install sfdx-hardis \ # #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/salesforce_sfdx_scanner_lwc/Dockerfile b/linters/salesforce_sfdx_scanner_lwc/Dockerfile index 45b669dc694..cd763dc1306 100644 --- a/linters/salesforce_sfdx_scanner_lwc/Dockerfile +++ b/linters/salesforce_sfdx_scanner_lwc/Dockerfile @@ -14,18 +14,138 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START +RUN apk add --update --no-cache \ + npm +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START +WORKDIR /node-deps +RUN npm --no-cache install --ignore-scripts --omit=dev \ + sfdx-cli && \ + echo "Cleaning npm cache…" \ + && npm cache clean --force || true \ + && echo "Changing owner of node_modules files…" \ + && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ + && echo "Removing extra node_module files…" \ + && rm -rf /root/.npm/_cacache \ + && find . -name "*.d.ts" -delete \ + && find . -name "*.map" -delete \ + && find . -name "*.npmignore" -delete \ + && find . -name "*.travis.yml" -delete \ + && find . -name "CHANGELOG.md" -delete \ + && find . -name "README.md" -delete \ + && find . -name ".package-lock.json" -delete \ + && find . -name "package-lock.json" -delete \ + && find . -name "README.md" -delete +WORKDIR / + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START +COPY --link --from=node_modules /node-deps /node-deps +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -75,6 +195,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -82,40 +204,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START +#PIPVENV_PATH__START -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START -WORKDIR /node-deps -RUN npm --no-cache install --ignore-scripts --omit=dev \ - sfdx-cli && \ - echo "Cleaning npm cache…" \ - && npm cache clean --force || true \ - && echo "Changing owner of node_modules files…" \ - && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ - && echo "Removing extra node_module files…" \ - && rm -rf /root/.npm/_cacache \ - && find . -name "*.d.ts" -delete \ - && find . -name "*.map" -delete \ - && find . -name "*.npmignore" -delete \ - && find . -name "*.travis.yml" -delete \ - && find . -name "CHANGELOG.md" -delete \ - && find . -name "README.md" -delete \ - && find . -name ".package-lock.json" -delete \ - && find . -name "package-lock.json" -delete \ - && find . -name "README.md" -delete -WORKDIR / - -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -141,15 +232,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START -COPY --link --from=node_modules /node-deps /node-deps -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -170,24 +254,6 @@ RUN echo y|sfdx plugins:install sfdx-hardis \ # #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/scala_scalafix/Dockerfile b/linters/scala_scalafix/Dockerfile index b9fc35b6ca5..ae16f7aec5c 100644 --- a/linters/scala_scalafix/Dockerfile +++ b/linters/scala_scalafix/Dockerfile @@ -14,18 +14,126 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START +RUN apk add --update --no-cache \ + curl \ + openjdk11 +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START +# SCALA installation +RUN curl --retry-all-errors --retry 10 -fLo coursier https://git.io/coursier-cli && \ + chmod +x coursier \ +# +# scalafix installation + && ./coursier install scalafix --quiet --install-dir /usr/bin && rm -rf /root/.cache +# +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START +COPY --link --from=build-platform /usr/bin/scalafix /usr/bin/ +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -72,6 +180,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -79,21 +189,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START +#PIPVENV_PATH__START -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -119,15 +217,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START -COPY --link --from=build-platform /usr/bin/scalafix /usr/bin/ -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -136,24 +227,6 @@ COPY --link --from=build-platform /usr/bin/scalafix /usr/bin/ #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/snakemake_lint/Dockerfile b/linters/snakemake_lint/Dockerfile index ebd51ef2169..1f2622e7a41 100644 --- a/linters/snakemake_lint/Dockerfile +++ b/linters/snakemake_lint/Dockerfile @@ -14,18 +14,129 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START + +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START +RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ + mkdir /download \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ +&& pip download --cache-dir=/var/cache/pip --dest "/download" \ + snakemake + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/snakemake" \ + && cd "/venvs/snakemake" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakemake + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -71,6 +182,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -78,27 +191,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START -RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ - mkdir -p "/venvs/snakemake" \ - && cd "/venvs/snakemake" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakemake - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START - -#NPM__END +#PIPVENV_PATH__START +ENV PATH="${PATH}":/venvs/snakemake/cross/bin +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -124,15 +219,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START - -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -141,24 +229,6 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/snakemake_snakefmt/Dockerfile b/linters/snakemake_snakefmt/Dockerfile index c4f471f3820..576ad166ede 100644 --- a/linters/snakemake_snakefmt/Dockerfile +++ b/linters/snakemake_snakefmt/Dockerfile @@ -14,18 +14,129 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START + +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START +RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ + mkdir /download \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ +&& pip download --cache-dir=/var/cache/pip --dest "/download" \ + snakefmt + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/snakefmt" \ + && cd "/venvs/snakefmt" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakefmt + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -71,6 +182,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -78,27 +191,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START -RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ - mkdir -p "/venvs/snakefmt" \ - && cd "/venvs/snakefmt" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakefmt - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START - -#NPM__END +#PIPVENV_PATH__START +ENV PATH="${PATH}":/venvs/snakefmt/cross/bin +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -124,15 +219,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START - -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -141,24 +229,6 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/spell_cspell/Dockerfile b/linters/spell_cspell/Dockerfile index 9cccb56c6ed..22575987521 100644 --- a/linters/spell_cspell/Dockerfile +++ b/linters/spell_cspell/Dockerfile @@ -14,18 +14,138 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START +RUN apk add --update --no-cache \ + npm +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START +WORKDIR /node-deps +RUN npm --no-cache install --ignore-scripts --omit=dev \ + cspell && \ + echo "Cleaning npm cache…" \ + && npm cache clean --force || true \ + && echo "Changing owner of node_modules files…" \ + && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ + && echo "Removing extra node_module files…" \ + && rm -rf /root/.npm/_cacache \ + && find . -name "*.d.ts" -delete \ + && find . -name "*.map" -delete \ + && find . -name "*.npmignore" -delete \ + && find . -name "*.travis.yml" -delete \ + && find . -name "CHANGELOG.md" -delete \ + && find . -name "README.md" -delete \ + && find . -name ".package-lock.json" -delete \ + && find . -name "package-lock.json" -delete \ + && find . -name "README.md" -delete +WORKDIR / + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START +COPY --link --from=node_modules /node-deps /node-deps +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -74,6 +194,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -81,40 +203,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START +#PIPVENV_PATH__START -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START -WORKDIR /node-deps -RUN npm --no-cache install --ignore-scripts --omit=dev \ - cspell && \ - echo "Cleaning npm cache…" \ - && npm cache clean --force || true \ - && echo "Changing owner of node_modules files…" \ - && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ - && echo "Removing extra node_module files…" \ - && rm -rf /root/.npm/_cacache \ - && find . -name "*.d.ts" -delete \ - && find . -name "*.map" -delete \ - && find . -name "*.npmignore" -delete \ - && find . -name "*.travis.yml" -delete \ - && find . -name "CHANGELOG.md" -delete \ - && find . -name "README.md" -delete \ - && find . -name ".package-lock.json" -delete \ - && find . -name "package-lock.json" -delete \ - && find . -name "README.md" -delete -WORKDIR / - -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -140,15 +231,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START -COPY --link --from=node_modules /node-deps /node-deps -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -157,24 +241,6 @@ COPY --link --from=node_modules /node-deps /node-deps #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/spell_lychee/Dockerfile b/linters/spell_lychee/Dockerfile index a5cc011a991..2c9b5a9db55 100644 --- a/linters/spell_lychee/Dockerfile +++ b/linters/spell_lychee/Dockerfile @@ -14,18 +14,118 @@ FROM lycheeverse/lychee:latest-alpine as lychee #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START +COPY --link --from=lychee /usr/local/bin/lychee /usr/bin/ +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -71,6 +171,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -78,21 +180,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START +#PIPVENV_PATH__START -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -118,15 +208,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START -COPY --link --from=lychee /usr/local/bin/lychee /usr/bin/ -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -135,24 +218,6 @@ COPY --link --from=lychee /usr/local/bin/lychee /usr/bin/ #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/spell_proselint/Dockerfile b/linters/spell_proselint/Dockerfile index 7becc499dc6..c27a5e8d88b 100644 --- a/linters/spell_proselint/Dockerfile +++ b/linters/spell_proselint/Dockerfile @@ -14,18 +14,129 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START + +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START +RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ + mkdir /download \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ +&& pip download --cache-dir=/var/cache/pip --dest "/download" \ + proselint + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/proselint" \ + && cd "/venvs/proselint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip proselint + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -71,6 +182,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -78,27 +191,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START -RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ - mkdir -p "/venvs/proselint" \ - && cd "/venvs/proselint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip proselint - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START - -#NPM__END +#PIPVENV_PATH__START +ENV PATH="${PATH}":/venvs/proselint/cross/bin +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -124,15 +219,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START - -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -141,24 +229,6 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/spell_vale/Dockerfile b/linters/spell_vale/Dockerfile index 127756ed210..a555025f171 100644 --- a/linters/spell_vale/Dockerfile +++ b/linters/spell_vale/Dockerfile @@ -14,18 +14,118 @@ FROM jdkato/vale:latest as vale #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START +COPY --link --from=vale /bin/vale /bin/vale +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -71,6 +171,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -78,21 +180,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START +#PIPVENV_PATH__START -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -118,15 +208,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START -COPY --link --from=vale /bin/vale /bin/vale -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -135,24 +218,6 @@ COPY --link --from=vale /bin/vale /bin/vale #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/sql_sql_lint/Dockerfile b/linters/sql_sql_lint/Dockerfile index 17c5d5cf431..39a28e6c6d0 100644 --- a/linters/sql_sql_lint/Dockerfile +++ b/linters/sql_sql_lint/Dockerfile @@ -14,18 +14,138 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START +RUN apk add --update --no-cache \ + npm +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START +WORKDIR /node-deps +RUN npm --no-cache install --ignore-scripts --omit=dev \ + sql-lint && \ + echo "Cleaning npm cache…" \ + && npm cache clean --force || true \ + && echo "Changing owner of node_modules files…" \ + && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ + && echo "Removing extra node_module files…" \ + && rm -rf /root/.npm/_cacache \ + && find . -name "*.d.ts" -delete \ + && find . -name "*.map" -delete \ + && find . -name "*.npmignore" -delete \ + && find . -name "*.travis.yml" -delete \ + && find . -name "CHANGELOG.md" -delete \ + && find . -name "README.md" -delete \ + && find . -name ".package-lock.json" -delete \ + && find . -name "package-lock.json" -delete \ + && find . -name "README.md" -delete +WORKDIR / + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START +COPY --link --from=node_modules /node-deps /node-deps +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -74,6 +194,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -81,40 +203,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START +#PIPVENV_PATH__START -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START -WORKDIR /node-deps -RUN npm --no-cache install --ignore-scripts --omit=dev \ - sql-lint && \ - echo "Cleaning npm cache…" \ - && npm cache clean --force || true \ - && echo "Changing owner of node_modules files…" \ - && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ - && echo "Removing extra node_module files…" \ - && rm -rf /root/.npm/_cacache \ - && find . -name "*.d.ts" -delete \ - && find . -name "*.map" -delete \ - && find . -name "*.npmignore" -delete \ - && find . -name "*.travis.yml" -delete \ - && find . -name "CHANGELOG.md" -delete \ - && find . -name "README.md" -delete \ - && find . -name ".package-lock.json" -delete \ - && find . -name "package-lock.json" -delete \ - && find . -name "README.md" -delete -WORKDIR / - -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -140,15 +231,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START -COPY --link --from=node_modules /node-deps /node-deps -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -157,24 +241,6 @@ COPY --link --from=node_modules /node-deps /node-deps #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/sql_sqlfluff/Dockerfile b/linters/sql_sqlfluff/Dockerfile index 0aa8c0b064a..e70d2abdd99 100644 --- a/linters/sql_sqlfluff/Dockerfile +++ b/linters/sql_sqlfluff/Dockerfile @@ -14,18 +14,129 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START + +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START +RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ + mkdir /download \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ +&& pip download --cache-dir=/var/cache/pip --dest "/download" \ + sqlfluff + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/sqlfluff" \ + && cd "/venvs/sqlfluff" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip sqlfluff + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -71,6 +182,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -78,27 +191,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START -RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ - mkdir -p "/venvs/sqlfluff" \ - && cd "/venvs/sqlfluff" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip sqlfluff - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START - -#NPM__END +#PIPVENV_PATH__START +ENV PATH="${PATH}":/venvs/sqlfluff/cross/bin +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -124,15 +219,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START - -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -141,24 +229,6 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/sql_tsqllint/Dockerfile b/linters/sql_tsqllint/Dockerfile index 6175ab06176..7f19e6b8eaa 100644 --- a/linters/sql_tsqllint/Dockerfile +++ b/linters/sql_tsqllint/Dockerfile @@ -14,18 +14,118 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START + +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -79,6 +179,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -86,21 +188,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START +#PIPVENV_PATH__START -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -126,15 +216,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START - -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -150,24 +233,6 @@ RUN dotnet tool install --global TSQLLint # #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/swift_swiftlint/Dockerfile b/linters/swift_swiftlint/Dockerfile index 85d3e9e5f48..10a9d7cd304 100644 --- a/linters/swift_swiftlint/Dockerfile +++ b/linters/swift_swiftlint/Dockerfile @@ -14,18 +14,118 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START + +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -73,6 +173,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -80,21 +182,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START +#PIPVENV_PATH__START -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -120,15 +210,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START - -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -137,24 +220,6 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ RUN rc-update add docker boot && rc-service docker start || true #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/tekton_tekton_lint/Dockerfile b/linters/tekton_tekton_lint/Dockerfile index ae7f9be498f..a65df3cc0e1 100644 --- a/linters/tekton_tekton_lint/Dockerfile +++ b/linters/tekton_tekton_lint/Dockerfile @@ -14,18 +14,138 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START +RUN apk add --update --no-cache \ + npm +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START +WORKDIR /node-deps +RUN npm --no-cache install --ignore-scripts --omit=dev \ + tekton-lint && \ + echo "Cleaning npm cache…" \ + && npm cache clean --force || true \ + && echo "Changing owner of node_modules files…" \ + && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ + && echo "Removing extra node_module files…" \ + && rm -rf /root/.npm/_cacache \ + && find . -name "*.d.ts" -delete \ + && find . -name "*.map" -delete \ + && find . -name "*.npmignore" -delete \ + && find . -name "*.travis.yml" -delete \ + && find . -name "CHANGELOG.md" -delete \ + && find . -name "README.md" -delete \ + && find . -name ".package-lock.json" -delete \ + && find . -name "package-lock.json" -delete \ + && find . -name "README.md" -delete +WORKDIR / + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START +COPY --link --from=node_modules /node-deps /node-deps +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -74,6 +194,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -81,40 +203,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START +#PIPVENV_PATH__START -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START -WORKDIR /node-deps -RUN npm --no-cache install --ignore-scripts --omit=dev \ - tekton-lint && \ - echo "Cleaning npm cache…" \ - && npm cache clean --force || true \ - && echo "Changing owner of node_modules files…" \ - && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ - && echo "Removing extra node_module files…" \ - && rm -rf /root/.npm/_cacache \ - && find . -name "*.d.ts" -delete \ - && find . -name "*.map" -delete \ - && find . -name "*.npmignore" -delete \ - && find . -name "*.travis.yml" -delete \ - && find . -name "CHANGELOG.md" -delete \ - && find . -name "README.md" -delete \ - && find . -name ".package-lock.json" -delete \ - && find . -name "package-lock.json" -delete \ - && find . -name "README.md" -delete -WORKDIR / - -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -140,15 +231,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START -COPY --link --from=node_modules /node-deps /node-deps -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -157,24 +241,6 @@ COPY --link --from=node_modules /node-deps /node-deps #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/terraform_terraform_fmt/Dockerfile b/linters/terraform_terraform_fmt/Dockerfile index f2b693279b7..4bf7bef4568 100644 --- a/linters/terraform_terraform_fmt/Dockerfile +++ b/linters/terraform_terraform_fmt/Dockerfile @@ -14,18 +14,118 @@ FROM alpine/terragrunt:latest as terragrunt #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START +COPY --link --from=terragrunt /bin/terraform /usr/bin/ +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -71,6 +171,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -78,21 +180,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START +#PIPVENV_PATH__START -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -118,15 +208,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START -COPY --link --from=terragrunt /bin/terraform /usr/bin/ -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -135,24 +218,6 @@ COPY --link --from=terragrunt /bin/terraform /usr/bin/ #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/terraform_terragrunt/Dockerfile b/linters/terraform_terragrunt/Dockerfile index a3fa6e848f2..aad924093ac 100644 --- a/linters/terraform_terragrunt/Dockerfile +++ b/linters/terraform_terragrunt/Dockerfile @@ -14,18 +14,118 @@ FROM alpine/terragrunt:latest as terragrunt #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START +COPY --link --from=terragrunt /usr/local/bin/terragrunt /usr/bin/ +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -71,6 +171,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -78,21 +180,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START +#PIPVENV_PATH__START -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -118,15 +208,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START -COPY --link --from=terragrunt /usr/local/bin/terragrunt /usr/bin/ -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -135,24 +218,6 @@ COPY --link --from=terragrunt /usr/local/bin/terragrunt /usr/bin/ #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/terraform_terrascan/Dockerfile b/linters/terraform_terrascan/Dockerfile index 6d767a52043..50364226eda 100644 --- a/linters/terraform_terrascan/Dockerfile +++ b/linters/terraform_terrascan/Dockerfile @@ -14,18 +14,118 @@ FROM tenable/terrascan:1.18.1 as terrascan #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START +COPY --link --from=terrascan /go/bin/terrascan /usr/bin/ +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -71,6 +171,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -78,21 +180,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START +#PIPVENV_PATH__START -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -118,15 +208,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START -COPY --link --from=terrascan /go/bin/terrascan /usr/bin/ -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -135,24 +218,6 @@ COPY --link --from=terrascan /go/bin/terrascan /usr/bin/ #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/terraform_tflint/Dockerfile b/linters/terraform_tflint/Dockerfile index b2cf2dd52f6..883ce069c4d 100644 --- a/linters/terraform_tflint/Dockerfile +++ b/linters/terraform_tflint/Dockerfile @@ -14,18 +14,118 @@ FROM ghcr.io/terraform-linters/tflint:v0.47.0 as tflint #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START +COPY --link --from=tflint /usr/local/bin/tflint /usr/bin/ +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -71,6 +171,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -78,21 +180,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START +#PIPVENV_PATH__START -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -118,15 +208,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START -COPY --link --from=tflint /usr/local/bin/tflint /usr/bin/ -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -135,24 +218,6 @@ COPY --link --from=tflint /usr/local/bin/tflint /usr/bin/ #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/tsx_eslint/Dockerfile b/linters/tsx_eslint/Dockerfile index 68d6f02a720..2bd4cfd3e61 100644 --- a/linters/tsx_eslint/Dockerfile +++ b/linters/tsx_eslint/Dockerfile @@ -14,18 +14,150 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START +RUN apk add --update --no-cache \ + npm +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START +WORKDIR /node-deps +RUN npm --no-cache install --ignore-scripts --omit=dev \ + typescript \ + eslint \ + eslint-config-airbnb \ + eslint-config-prettier \ + eslint-plugin-jest \ + eslint-plugin-prettier \ + eslint-plugin-react \ + @babel/eslint-parser \ + prettier \ + prettyjson \ + @typescript-eslint/eslint-plugin \ + @typescript-eslint/parser \ + @microsoft/eslint-formatter-sarif && \ + echo "Cleaning npm cache…" \ + && npm cache clean --force || true \ + && echo "Changing owner of node_modules files…" \ + && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ + && echo "Removing extra node_module files…" \ + && rm -rf /root/.npm/_cacache \ + && find . -name "*.d.ts" -delete \ + && find . -name "*.map" -delete \ + && find . -name "*.npmignore" -delete \ + && find . -name "*.travis.yml" -delete \ + && find . -name "CHANGELOG.md" -delete \ + && find . -name "README.md" -delete \ + && find . -name ".package-lock.json" -delete \ + && find . -name "package-lock.json" -delete \ + && find . -name "README.md" -delete +WORKDIR / + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START +COPY --link --from=node_modules /node-deps /node-deps +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -74,6 +206,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -81,52 +215,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START +#PIPVENV_PATH__START -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START -WORKDIR /node-deps -RUN npm --no-cache install --ignore-scripts --omit=dev \ - typescript \ - eslint \ - eslint-config-airbnb \ - eslint-config-prettier \ - eslint-plugin-jest \ - eslint-plugin-prettier \ - eslint-plugin-react \ - @babel/eslint-parser \ - prettier \ - prettyjson \ - @typescript-eslint/eslint-plugin \ - @typescript-eslint/parser \ - @microsoft/eslint-formatter-sarif && \ - echo "Cleaning npm cache…" \ - && npm cache clean --force || true \ - && echo "Changing owner of node_modules files…" \ - && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ - && echo "Removing extra node_module files…" \ - && rm -rf /root/.npm/_cacache \ - && find . -name "*.d.ts" -delete \ - && find . -name "*.map" -delete \ - && find . -name "*.npmignore" -delete \ - && find . -name "*.travis.yml" -delete \ - && find . -name "CHANGELOG.md" -delete \ - && find . -name "README.md" -delete \ - && find . -name ".package-lock.json" -delete \ - && find . -name "package-lock.json" -delete \ - && find . -name "README.md" -delete -WORKDIR / - -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -152,15 +243,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START -COPY --link --from=node_modules /node-deps /node-deps -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -169,24 +253,6 @@ COPY --link --from=node_modules /node-deps /node-deps #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/typescript_es/Dockerfile b/linters/typescript_es/Dockerfile index 8443a8507db..bfab2651ef4 100644 --- a/linters/typescript_es/Dockerfile +++ b/linters/typescript_es/Dockerfile @@ -14,18 +14,153 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START +RUN apk add --update --no-cache \ + npm +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START +WORKDIR /node-deps +RUN npm --no-cache install --ignore-scripts --omit=dev \ + typescript \ + eslint \ + eslint-config-airbnb \ + eslint-config-prettier \ + eslint-config-standard \ + eslint-plugin-import \ + eslint-plugin-jest \ + eslint-plugin-node \ + eslint-plugin-prettier \ + eslint-plugin-promise \ + @babel/eslint-parser \ + prettier \ + prettyjson \ + @typescript-eslint/eslint-plugin \ + @typescript-eslint/parser \ + @microsoft/eslint-formatter-sarif && \ + echo "Cleaning npm cache…" \ + && npm cache clean --force || true \ + && echo "Changing owner of node_modules files…" \ + && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ + && echo "Removing extra node_module files…" \ + && rm -rf /root/.npm/_cacache \ + && find . -name "*.d.ts" -delete \ + && find . -name "*.map" -delete \ + && find . -name "*.npmignore" -delete \ + && find . -name "*.travis.yml" -delete \ + && find . -name "CHANGELOG.md" -delete \ + && find . -name "README.md" -delete \ + && find . -name ".package-lock.json" -delete \ + && find . -name "package-lock.json" -delete \ + && find . -name "README.md" -delete +WORKDIR / + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START +COPY --link --from=node_modules /node-deps /node-deps +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -74,6 +209,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -81,55 +218,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START -WORKDIR /node-deps -RUN npm --no-cache install --ignore-scripts --omit=dev \ - typescript \ - eslint \ - eslint-config-airbnb \ - eslint-config-prettier \ - eslint-config-standard \ - eslint-plugin-import \ - eslint-plugin-jest \ - eslint-plugin-node \ - eslint-plugin-prettier \ - eslint-plugin-promise \ - @babel/eslint-parser \ - prettier \ - prettyjson \ - @typescript-eslint/eslint-plugin \ - @typescript-eslint/parser \ - @microsoft/eslint-formatter-sarif && \ - echo "Cleaning npm cache…" \ - && npm cache clean --force || true \ - && echo "Changing owner of node_modules files…" \ - && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ - && echo "Removing extra node_module files…" \ - && rm -rf /root/.npm/_cacache \ - && find . -name "*.d.ts" -delete \ - && find . -name "*.map" -delete \ - && find . -name "*.npmignore" -delete \ - && find . -name "*.travis.yml" -delete \ - && find . -name "CHANGELOG.md" -delete \ - && find . -name "README.md" -delete \ - && find . -name ".package-lock.json" -delete \ - && find . -name "package-lock.json" -delete \ - && find . -name "README.md" -delete -WORKDIR / +#PIPVENV_PATH__START -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -155,15 +246,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START -COPY --link --from=node_modules /node-deps /node-deps -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -172,24 +256,6 @@ COPY --link --from=node_modules /node-deps /node-deps #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/typescript_prettier/Dockerfile b/linters/typescript_prettier/Dockerfile index b2c203d648b..a213bfd2842 100644 --- a/linters/typescript_prettier/Dockerfile +++ b/linters/typescript_prettier/Dockerfile @@ -14,18 +14,139 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START +RUN apk add --update --no-cache \ + npm +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START +WORKDIR /node-deps +RUN npm --no-cache install --ignore-scripts --omit=dev \ + typescript \ + prettier && \ + echo "Cleaning npm cache…" \ + && npm cache clean --force || true \ + && echo "Changing owner of node_modules files…" \ + && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ + && echo "Removing extra node_module files…" \ + && rm -rf /root/.npm/_cacache \ + && find . -name "*.d.ts" -delete \ + && find . -name "*.map" -delete \ + && find . -name "*.npmignore" -delete \ + && find . -name "*.travis.yml" -delete \ + && find . -name "CHANGELOG.md" -delete \ + && find . -name "README.md" -delete \ + && find . -name ".package-lock.json" -delete \ + && find . -name "package-lock.json" -delete \ + && find . -name "README.md" -delete +WORKDIR / + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START +COPY --link --from=node_modules /node-deps /node-deps +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -74,6 +195,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -81,41 +204,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START -WORKDIR /node-deps -RUN npm --no-cache install --ignore-scripts --omit=dev \ - typescript \ - prettier && \ - echo "Cleaning npm cache…" \ - && npm cache clean --force || true \ - && echo "Changing owner of node_modules files…" \ - && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ - && echo "Removing extra node_module files…" \ - && rm -rf /root/.npm/_cacache \ - && find . -name "*.d.ts" -delete \ - && find . -name "*.map" -delete \ - && find . -name "*.npmignore" -delete \ - && find . -name "*.travis.yml" -delete \ - && find . -name "CHANGELOG.md" -delete \ - && find . -name "README.md" -delete \ - && find . -name ".package-lock.json" -delete \ - && find . -name "package-lock.json" -delete \ - && find . -name "README.md" -delete -WORKDIR / +#PIPVENV_PATH__START -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -141,15 +232,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START -COPY --link --from=node_modules /node-deps /node-deps -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -158,24 +242,6 @@ COPY --link --from=node_modules /node-deps /node-deps #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/typescript_standard/Dockerfile b/linters/typescript_standard/Dockerfile index 5be39aad961..637154050a6 100644 --- a/linters/typescript_standard/Dockerfile +++ b/linters/typescript_standard/Dockerfile @@ -14,18 +14,139 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START +RUN apk add --update --no-cache \ + npm +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START +WORKDIR /node-deps +RUN npm --no-cache install --ignore-scripts --omit=dev \ + typescript \ + ts-standard && \ + echo "Cleaning npm cache…" \ + && npm cache clean --force || true \ + && echo "Changing owner of node_modules files…" \ + && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ + && echo "Removing extra node_module files…" \ + && rm -rf /root/.npm/_cacache \ + && find . -name "*.d.ts" -delete \ + && find . -name "*.map" -delete \ + && find . -name "*.npmignore" -delete \ + && find . -name "*.travis.yml" -delete \ + && find . -name "CHANGELOG.md" -delete \ + && find . -name "README.md" -delete \ + && find . -name ".package-lock.json" -delete \ + && find . -name "package-lock.json" -delete \ + && find . -name "README.md" -delete +WORKDIR / + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START +COPY --link --from=node_modules /node-deps /node-deps +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -74,6 +195,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -81,41 +204,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START -WORKDIR /node-deps -RUN npm --no-cache install --ignore-scripts --omit=dev \ - typescript \ - ts-standard && \ - echo "Cleaning npm cache…" \ - && npm cache clean --force || true \ - && echo "Changing owner of node_modules files…" \ - && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ - && echo "Removing extra node_module files…" \ - && rm -rf /root/.npm/_cacache \ - && find . -name "*.d.ts" -delete \ - && find . -name "*.map" -delete \ - && find . -name "*.npmignore" -delete \ - && find . -name "*.travis.yml" -delete \ - && find . -name "CHANGELOG.md" -delete \ - && find . -name "README.md" -delete \ - && find . -name ".package-lock.json" -delete \ - && find . -name "package-lock.json" -delete \ - && find . -name "README.md" -delete -WORKDIR / +#PIPVENV_PATH__START -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -141,15 +232,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START -COPY --link --from=node_modules /node-deps /node-deps -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -158,24 +242,6 @@ COPY --link --from=node_modules /node-deps /node-deps #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/vbdotnet_dotnet_format/Dockerfile b/linters/vbdotnet_dotnet_format/Dockerfile index c2151240ed8..38fc6785bf6 100644 --- a/linters/vbdotnet_dotnet_format/Dockerfile +++ b/linters/vbdotnet_dotnet_format/Dockerfile @@ -14,18 +14,118 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START + +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -79,6 +179,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -86,21 +188,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START +#PIPVENV_PATH__START -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -126,15 +216,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START - -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -149,24 +232,6 @@ ENV PATH="${PATH}:/root/.dotnet/tools:/usr/share/dotnet" # #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/xml_xmllint/Dockerfile b/linters/xml_xmllint/Dockerfile index d0a188ca704..ed21ff27525 100644 --- a/linters/xml_xmllint/Dockerfile +++ b/linters/xml_xmllint/Dockerfile @@ -14,18 +14,118 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START + +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -75,6 +175,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -82,21 +184,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START +#PIPVENV_PATH__START -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -122,15 +212,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START - -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -139,24 +222,6 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/yaml_prettier/Dockerfile b/linters/yaml_prettier/Dockerfile index de30c4f9f8b..89363079c01 100644 --- a/linters/yaml_prettier/Dockerfile +++ b/linters/yaml_prettier/Dockerfile @@ -14,18 +14,138 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START +RUN apk add --update --no-cache \ + npm +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START +WORKDIR /node-deps +RUN npm --no-cache install --ignore-scripts --omit=dev \ + prettier && \ + echo "Cleaning npm cache…" \ + && npm cache clean --force || true \ + && echo "Changing owner of node_modules files…" \ + && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ + && echo "Removing extra node_module files…" \ + && rm -rf /root/.npm/_cacache \ + && find . -name "*.d.ts" -delete \ + && find . -name "*.map" -delete \ + && find . -name "*.npmignore" -delete \ + && find . -name "*.travis.yml" -delete \ + && find . -name "CHANGELOG.md" -delete \ + && find . -name "README.md" -delete \ + && find . -name ".package-lock.json" -delete \ + && find . -name "package-lock.json" -delete \ + && find . -name "README.md" -delete +WORKDIR / + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START +COPY --link --from=node_modules /node-deps /node-deps +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -74,6 +194,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -81,40 +203,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START +#PIPVENV_PATH__START -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START -WORKDIR /node-deps -RUN npm --no-cache install --ignore-scripts --omit=dev \ - prettier && \ - echo "Cleaning npm cache…" \ - && npm cache clean --force || true \ - && echo "Changing owner of node_modules files…" \ - && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ - && echo "Removing extra node_module files…" \ - && rm -rf /root/.npm/_cacache \ - && find . -name "*.d.ts" -delete \ - && find . -name "*.map" -delete \ - && find . -name "*.npmignore" -delete \ - && find . -name "*.travis.yml" -delete \ - && find . -name "CHANGELOG.md" -delete \ - && find . -name "README.md" -delete \ - && find . -name ".package-lock.json" -delete \ - && find . -name "package-lock.json" -delete \ - && find . -name "README.md" -delete -WORKDIR / - -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -140,15 +231,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START -COPY --link --from=node_modules /node-deps /node-deps -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -157,24 +241,6 @@ COPY --link --from=node_modules /node-deps /node-deps #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/yaml_v8r/Dockerfile b/linters/yaml_v8r/Dockerfile index b86a13fbcda..8ee9b348d95 100644 --- a/linters/yaml_v8r/Dockerfile +++ b/linters/yaml_v8r/Dockerfile @@ -14,18 +14,138 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START +RUN apk add --update --no-cache \ + npm +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START +WORKDIR /node-deps +RUN npm --no-cache install --ignore-scripts --omit=dev \ + v8r && \ + echo "Cleaning npm cache…" \ + && npm cache clean --force || true \ + && echo "Changing owner of node_modules files…" \ + && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ + && echo "Removing extra node_module files…" \ + && rm -rf /root/.npm/_cacache \ + && find . -name "*.d.ts" -delete \ + && find . -name "*.map" -delete \ + && find . -name "*.npmignore" -delete \ + && find . -name "*.travis.yml" -delete \ + && find . -name "CHANGELOG.md" -delete \ + && find . -name "README.md" -delete \ + && find . -name ".package-lock.json" -delete \ + && find . -name "package-lock.json" -delete \ + && find . -name "README.md" -delete +WORKDIR / + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START +COPY --link --from=node_modules /node-deps /node-deps +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -74,6 +194,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -81,40 +203,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START +#PIPVENV_PATH__START -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START -WORKDIR /node-deps -RUN npm --no-cache install --ignore-scripts --omit=dev \ - v8r && \ - echo "Cleaning npm cache…" \ - && npm cache clean --force || true \ - && echo "Changing owner of node_modules files…" \ - && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \ - && echo "Removing extra node_module files…" \ - && rm -rf /root/.npm/_cacache \ - && find . -name "*.d.ts" -delete \ - && find . -name "*.map" -delete \ - && find . -name "*.npmignore" -delete \ - && find . -name "*.travis.yml" -delete \ - && find . -name "CHANGELOG.md" -delete \ - && find . -name "README.md" -delete \ - && find . -name ".package-lock.json" -delete \ - && find . -name "package-lock.json" -delete \ - && find . -name "README.md" -delete -WORKDIR / - -#NPM__END +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -140,15 +231,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START -COPY --link --from=node_modules /node-deps /node-deps -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -157,24 +241,6 @@ COPY --link --from=node_modules /node-deps /node-deps #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### diff --git a/linters/yaml_yamllint/Dockerfile b/linters/yaml_yamllint/Dockerfile index 396138c42a9..7a615a8c35f 100644 --- a/linters/yaml_yamllint/Dockerfile +++ b/linters/yaml_yamllint/Dockerfile @@ -14,18 +14,129 @@ #FROM__END +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# +#BUILD_PLATFORM_APK__START + +#BUILD_PLATFORM_APK__END + +#BUILD_PLATFORM_OTHER__START + +#BUILD_PLATFORM_OTHER__END + +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules + +#NPM_APK__START + +#NPM_APK__END + +############################ +# Install NPM dependencies # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +ENV NODE_OPTIONS="--max-old-space-size=8192" \ + NODE_ENV=production +#NPM__START + +#NPM__END + +FROM busybox AS copy-collector + +############################## +# COPY instructions # +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#COPY__START + +#COPY__END + +####################################### +# Copy scripts and rules to container # +####################################### +COPY --link megalinter/descriptors /megalinter-descriptors +COPY --link TEMPLATES /action/lib/.automation + +FROM --platform=$TARGETPLATFORM python:3.11.3-alpine3.17 AS target-python +FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS python-venv + + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV_BUILDDEPS__START +RUN apk add --update --no-cache \ + gcc \ + libffi-dev \ + musl-dev \ + make \ + curl \ + openssl-dev +#PIPVENV_BUILDDEPS__END + +#PIPVENV_DOWNLOAD__START +RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ + mkdir /download \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ +&& pip download --cache-dir=/var/cache/pip --dest "/download" \ + yamllint + +#PIPVENV_DOWNLOAD__END + +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable +ENV PATH=${PATH}:/root/.cargo/bin + +RUN mkdir /venvs + +ARG TARGETPLATFORM +COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 + +################################ +# Installs python dependencies # +################################ +COPY --link megalinter /megalinter +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/megalinter" \ + && cd "/venvs/megalinter" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter + +############################################################################################# +## @generated by .automation/build.py using descriptor files, please do not update manually ## +############################################################################################# + +#PIPVENV__START +RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ + mkdir -p "/venvs/yamllint" \ + && cd "/venvs/yamllint" \ + && python3 -m crossenv /usr/local/bin/target-python3 . \ + && source bin/activate \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip yamllint + +#PIPVENV__END + ################## # Get base image # ################## -# https://stackoverflow.com/a/73711302/699056 + # https://stackoverflow.com/a/73711302/699056 FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu -FROM python:3.11.4-alpine3.17 +FROM python:3.11.3-alpine3.17 AS final ARG GITHUB_TOKEN # https://stackoverflow.com/a/73711302/699056 COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/ # https://stackoverflow.com/a/73711302/699056 +# https://stackoverflow.com/a/73359981/699056 +# https://stackoverflow.com/a/71209637/699056 RUN apk add --update --no-cache libc6-compat \ gcompat \ qemu-x86_64 @@ -71,6 +182,8 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ # Ignore npm package issues yarn config set ignore-engines true || true +COPY --link --from=python-venv /venvs /venvs + ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# @@ -78,27 +191,9 @@ RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin || true && \ #PIP__END -#PIPVENV__START -RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ - mkdir -p "/venvs/yamllint" \ - && cd "/venvs/yamllint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip yamllint - -#PIPVENV__END - -############################ -# Install NPM dependencies # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -ENV NODE_OPTIONS="--max-old-space-size=8192" \ - NODE_ENV=production -#NPM__START - -#NPM__END +#PIPVENV_PATH__START +ENV PATH="${PATH}":/venvs/yamllint/cross/bin +#PIPVENV_PATH__END # Add node packages to path # ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ @@ -124,15 +219,8 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #CARGO__END -############################## -# COPY instructions # -############################################################################################# -## @generated by .automation/build.py using descriptor files, please do not update manually ## -############################################################################################# - -#COPY__START - -#COPY__END +# Don't add link to this one otherwise it doesn't merge correctly +COPY --from=copy-collector / / ############################################################################################# ## @generated by .automation/build.py using descriptor files, please do not update manually ## @@ -141,24 +229,6 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ #OTHER__END -################################ -# Installs python dependencies # -################################ -COPY megalinter /megalinter -RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \ - && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \ - && rm -rf /var/cache/apk/* \ - && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf - -####################################### -# Copy scripts and rules to container # -####################################### -COPY megalinter/descriptors /megalinter-descriptors -COPY TEMPLATES /action/lib/.automation - -# Copy server scripts -COPY server /server - ########################### # Get the build arguments # ########################### From b04c606fc54f72a80c429cc234907baaef1ac367 Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Wed, 19 Jul 2023 16:39:30 -0500 Subject: [PATCH 082/105] Switch a base image --- Dockerfile | 6 +++--- flavors/ci_light/Dockerfile | 2 +- flavors/cupcake/Dockerfile | 6 +++--- flavors/documentation/Dockerfile | 2 +- flavors/dotnet/Dockerfile | 2 +- flavors/dotnetweb/Dockerfile | 2 +- flavors/go/Dockerfile | 2 +- flavors/java/Dockerfile | 2 +- flavors/javascript/Dockerfile | 2 +- flavors/php/Dockerfile | 2 +- flavors/python/Dockerfile | 2 +- flavors/ruby/Dockerfile | 2 +- flavors/rust/Dockerfile | 6 +++--- flavors/salesforce/Dockerfile | 2 +- flavors/security/Dockerfile | 2 +- flavors/swift/Dockerfile | 2 +- flavors/terraform/Dockerfile | 2 +- linters/action_actionlint/Dockerfile | 2 +- linters/ansible_ansible_lint/Dockerfile | 2 +- linters/arm_arm_ttk/Dockerfile | 2 +- linters/bash_exec/Dockerfile | 2 +- linters/bash_shellcheck/Dockerfile | 2 +- linters/bash_shfmt/Dockerfile | 2 +- linters/bicep_bicep_linter/Dockerfile | 2 +- linters/c_cpplint/Dockerfile | 2 +- linters/clojure_clj_kondo/Dockerfile | 2 +- linters/clojure_cljstyle/Dockerfile | 2 +- linters/cloudformation_cfn_lint/Dockerfile | 2 +- linters/coffee_coffeelint/Dockerfile | 2 +- linters/copypaste_jscpd/Dockerfile | 2 +- linters/cpp_cpplint/Dockerfile | 2 +- linters/csharp_csharpier/Dockerfile | 2 +- linters/csharp_dotnet_format/Dockerfile | 2 +- linters/css_scss_lint/Dockerfile | 2 +- linters/css_stylelint/Dockerfile | 2 +- linters/dart_dartanalyzer/Dockerfile | 2 +- linters/dockerfile_hadolint/Dockerfile | 2 +- linters/editorconfig_editorconfig_checker/Dockerfile | 2 +- linters/env_dotenv_linter/Dockerfile | 2 +- linters/gherkin_gherkin_lint/Dockerfile | 2 +- linters/go_golangci_lint/Dockerfile | 2 +- linters/go_revive/Dockerfile | 2 +- linters/graphql_graphql_schema_linter/Dockerfile | 2 +- linters/groovy_npm_groovy_lint/Dockerfile | 2 +- linters/html_djlint/Dockerfile | 2 +- linters/html_htmlhint/Dockerfile | 2 +- linters/java_checkstyle/Dockerfile | 2 +- linters/java_pmd/Dockerfile | 2 +- linters/javascript_es/Dockerfile | 2 +- linters/javascript_prettier/Dockerfile | 2 +- linters/javascript_standard/Dockerfile | 2 +- linters/json_eslint_plugin_jsonc/Dockerfile | 2 +- linters/json_jsonlint/Dockerfile | 2 +- linters/json_npm_package_json_lint/Dockerfile | 2 +- linters/json_prettier/Dockerfile | 2 +- linters/json_v8r/Dockerfile | 2 +- linters/jsx_eslint/Dockerfile | 2 +- linters/kotlin_ktlint/Dockerfile | 2 +- linters/kubernetes_helm/Dockerfile | 2 +- linters/kubernetes_kubeconform/Dockerfile | 2 +- linters/kubernetes_kubescape/Dockerfile | 2 +- linters/latex_chktex/Dockerfile | 2 +- linters/lua_luacheck/Dockerfile | 2 +- linters/makefile_checkmake/Dockerfile | 2 +- linters/markdown_markdown_link_check/Dockerfile | 2 +- linters/markdown_markdown_table_formatter/Dockerfile | 2 +- linters/markdown_markdownlint/Dockerfile | 2 +- linters/markdown_remark_lint/Dockerfile | 2 +- linters/openapi_spectral/Dockerfile | 2 +- linters/perl_perlcritic/Dockerfile | 2 +- linters/php_phpcs/Dockerfile | 2 +- linters/php_phplint/Dockerfile | 2 +- linters/php_phpstan/Dockerfile | 2 +- linters/php_psalm/Dockerfile | 2 +- linters/powershell_powershell/Dockerfile | 2 +- linters/powershell_powershell_formatter/Dockerfile | 2 +- linters/protobuf_protolint/Dockerfile | 2 +- linters/puppet_puppet_lint/Dockerfile | 2 +- linters/python_bandit/Dockerfile | 2 +- linters/python_black/Dockerfile | 2 +- linters/python_flake8/Dockerfile | 2 +- linters/python_isort/Dockerfile | 2 +- linters/python_mypy/Dockerfile | 2 +- linters/python_pylint/Dockerfile | 2 +- linters/python_pyright/Dockerfile | 2 +- linters/python_ruff/Dockerfile | 2 +- linters/r_lintr/Dockerfile | 2 +- linters/raku_raku/Dockerfile | 2 +- linters/repository_checkov/Dockerfile | 2 +- linters/repository_devskim/Dockerfile | 2 +- linters/repository_dustilock/Dockerfile | 2 +- linters/repository_git_diff/Dockerfile | 2 +- linters/repository_gitleaks/Dockerfile | 2 +- linters/repository_grype/Dockerfile | 2 +- linters/repository_kics/Dockerfile | 2 +- linters/repository_secretlint/Dockerfile | 2 +- linters/repository_semgrep/Dockerfile | 2 +- linters/repository_syft/Dockerfile | 2 +- linters/repository_trivy/Dockerfile | 2 +- linters/repository_trivy_sbom/Dockerfile | 2 +- linters/repository_trufflehog/Dockerfile | 2 +- linters/rst_rst_lint/Dockerfile | 2 +- linters/rst_rstcheck/Dockerfile | 2 +- linters/rst_rstfmt/Dockerfile | 2 +- linters/ruby_rubocop/Dockerfile | 2 +- linters/rust_clippy/Dockerfile | 2 +- linters/salesforce_sfdx_scanner_apex/Dockerfile | 2 +- linters/salesforce_sfdx_scanner_aura/Dockerfile | 2 +- linters/salesforce_sfdx_scanner_lwc/Dockerfile | 2 +- linters/scala_scalafix/Dockerfile | 2 +- linters/snakemake_lint/Dockerfile | 2 +- linters/snakemake_snakefmt/Dockerfile | 2 +- linters/spell_cspell/Dockerfile | 2 +- linters/spell_lychee/Dockerfile | 2 +- linters/spell_proselint/Dockerfile | 2 +- linters/spell_vale/Dockerfile | 2 +- linters/sql_sql_lint/Dockerfile | 2 +- linters/sql_sqlfluff/Dockerfile | 2 +- linters/sql_tsqllint/Dockerfile | 2 +- linters/swift_swiftlint/Dockerfile | 2 +- linters/tekton_tekton_lint/Dockerfile | 2 +- linters/terraform_terraform_fmt/Dockerfile | 2 +- linters/terraform_terragrunt/Dockerfile | 2 +- linters/terraform_terrascan/Dockerfile | 2 +- linters/terraform_tflint/Dockerfile | 2 +- linters/tsx_eslint/Dockerfile | 2 +- linters/typescript_es/Dockerfile | 2 +- linters/typescript_prettier/Dockerfile | 2 +- linters/typescript_standard/Dockerfile | 2 +- linters/vbdotnet_dotnet_format/Dockerfile | 2 +- linters/xml_xmllint/Dockerfile | 2 +- linters/yaml_prettier/Dockerfile | 2 +- linters/yaml_v8r/Dockerfile | 2 +- linters/yaml_yamllint/Dockerfile | 2 +- 134 files changed, 140 insertions(+), 140 deletions(-) diff --git a/Dockerfile b/Dockerfile index 64f95017149..b869918d771 100644 --- a/Dockerfile +++ b/Dockerfile @@ -84,12 +84,12 @@ RUN rustup-init -y --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-u RUN --mount=type=cache,id=cargo-${TARGETARCH},sharing=locked,target=/cargo/.cargo/registry/,uid=63425 \ . /cargo/.cargo/env \ - && cargo binstall --no-confirm --no-symlinks shellcheck-sarif sarif-fmt --root /tmp --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") + && cargo binstall --no-confirm --no-symlinks sarif-fmt shellcheck-sarif --root /tmp --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") FROM scratch AS cargo COPY --link --from=cargo-build /tmp/bin/* /bin/ -RUN ["/bin/shellcheck-sarif", "--help"] RUN ["/bin/sarif-fmt", "--help"] +RUN ["/bin/shellcheck-sarif", "--help"] #FROM__END @@ -204,7 +204,7 @@ WORKDIR / #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/flavors/ci_light/Dockerfile b/flavors/ci_light/Dockerfile index 9e5b27fc207..fe898adfd8f 100644 --- a/flavors/ci_light/Dockerfile +++ b/flavors/ci_light/Dockerfile @@ -82,7 +82,7 @@ WORKDIR / #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/flavors/cupcake/Dockerfile b/flavors/cupcake/Dockerfile index 537d20ca36c..d0b1b79e188 100644 --- a/flavors/cupcake/Dockerfile +++ b/flavors/cupcake/Dockerfile @@ -79,12 +79,12 @@ RUN rustup-init -y --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-u RUN --mount=type=cache,id=cargo-${TARGETARCH},sharing=locked,target=/cargo/.cargo/registry/,uid=63425 \ . /cargo/.cargo/env \ - && cargo binstall --no-confirm --no-symlinks shellcheck-sarif sarif-fmt --root /tmp --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") + && cargo binstall --no-confirm --no-symlinks sarif-fmt shellcheck-sarif --root /tmp --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") FROM scratch AS cargo COPY --link --from=cargo-build /tmp/bin/* /bin/ -RUN ["/bin/shellcheck-sarif", "--help"] RUN ["/bin/sarif-fmt", "--help"] +RUN ["/bin/shellcheck-sarif", "--help"] #FROM__END @@ -186,7 +186,7 @@ WORKDIR / #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/flavors/documentation/Dockerfile b/flavors/documentation/Dockerfile index bfe2c7c50a4..7482202775d 100644 --- a/flavors/documentation/Dockerfile +++ b/flavors/documentation/Dockerfile @@ -110,7 +110,7 @@ WORKDIR / #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/flavors/dotnet/Dockerfile b/flavors/dotnet/Dockerfile index 734da455f93..fd784ee9394 100644 --- a/flavors/dotnet/Dockerfile +++ b/flavors/dotnet/Dockerfile @@ -113,7 +113,7 @@ WORKDIR / #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/flavors/dotnetweb/Dockerfile b/flavors/dotnetweb/Dockerfile index 2f07acde5c9..563eac0574d 100644 --- a/flavors/dotnetweb/Dockerfile +++ b/flavors/dotnetweb/Dockerfile @@ -133,7 +133,7 @@ WORKDIR / #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/flavors/go/Dockerfile b/flavors/go/Dockerfile index a29a7eb9f61..c05b052accd 100644 --- a/flavors/go/Dockerfile +++ b/flavors/go/Dockerfile @@ -116,7 +116,7 @@ WORKDIR / #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/flavors/java/Dockerfile b/flavors/java/Dockerfile index 019d74a8ae2..f6d8c26c827 100644 --- a/flavors/java/Dockerfile +++ b/flavors/java/Dockerfile @@ -110,7 +110,7 @@ WORKDIR / #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/flavors/javascript/Dockerfile b/flavors/javascript/Dockerfile index 7d1268ffedf..19823b56f79 100644 --- a/flavors/javascript/Dockerfile +++ b/flavors/javascript/Dockerfile @@ -131,7 +131,7 @@ WORKDIR / #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/flavors/php/Dockerfile b/flavors/php/Dockerfile index 1ae8639a95f..c249094b653 100644 --- a/flavors/php/Dockerfile +++ b/flavors/php/Dockerfile @@ -110,7 +110,7 @@ WORKDIR / #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/flavors/python/Dockerfile b/flavors/python/Dockerfile index c94b664c6df..1a1a021c052 100644 --- a/flavors/python/Dockerfile +++ b/flavors/python/Dockerfile @@ -119,7 +119,7 @@ WORKDIR / #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/flavors/ruby/Dockerfile b/flavors/ruby/Dockerfile index eb2f2ea4792..d1b723e67e3 100644 --- a/flavors/ruby/Dockerfile +++ b/flavors/ruby/Dockerfile @@ -109,7 +109,7 @@ WORKDIR / #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/flavors/rust/Dockerfile b/flavors/rust/Dockerfile index 33448e724ce..04b74ebddbf 100644 --- a/flavors/rust/Dockerfile +++ b/flavors/rust/Dockerfile @@ -58,12 +58,12 @@ RUN rustup-init -y --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-u RUN --mount=type=cache,id=cargo-${TARGETARCH},sharing=locked,target=/cargo/.cargo/registry/,uid=63425 \ . /cargo/.cargo/env \ - && cargo binstall --no-confirm --no-symlinks shellcheck-sarif sarif-fmt --root /tmp --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") + && cargo binstall --no-confirm --no-symlinks sarif-fmt shellcheck-sarif --root /tmp --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") FROM scratch AS cargo COPY --link --from=cargo-build /tmp/bin/* /bin/ -RUN ["/bin/shellcheck-sarif", "--help"] RUN ["/bin/sarif-fmt", "--help"] +RUN ["/bin/shellcheck-sarif", "--help"] #FROM__END @@ -146,7 +146,7 @@ WORKDIR / #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/flavors/salesforce/Dockerfile b/flavors/salesforce/Dockerfile index fc90bdf424a..433637b2c48 100644 --- a/flavors/salesforce/Dockerfile +++ b/flavors/salesforce/Dockerfile @@ -112,7 +112,7 @@ WORKDIR / #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/flavors/security/Dockerfile b/flavors/security/Dockerfile index 2bc93b5f560..8ab3943f123 100644 --- a/flavors/security/Dockerfile +++ b/flavors/security/Dockerfile @@ -83,7 +83,7 @@ WORKDIR / #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/flavors/swift/Dockerfile b/flavors/swift/Dockerfile index bba17faf14c..5f082127b20 100644 --- a/flavors/swift/Dockerfile +++ b/flavors/swift/Dockerfile @@ -109,7 +109,7 @@ WORKDIR / #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/flavors/terraform/Dockerfile b/flavors/terraform/Dockerfile index 17538c3eece..448715aec4b 100644 --- a/flavors/terraform/Dockerfile +++ b/flavors/terraform/Dockerfile @@ -115,7 +115,7 @@ WORKDIR / #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/action_actionlint/Dockerfile b/linters/action_actionlint/Dockerfile index 6e86a316827..0b1f02a8a0e 100644 --- a/linters/action_actionlint/Dockerfile +++ b/linters/action_actionlint/Dockerfile @@ -48,7 +48,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/ansible_ansible_lint/Dockerfile b/linters/ansible_ansible_lint/Dockerfile index c6d9505e197..27b6a7857f9 100644 --- a/linters/ansible_ansible_lint/Dockerfile +++ b/linters/ansible_ansible_lint/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/arm_arm_ttk/Dockerfile b/linters/arm_arm_ttk/Dockerfile index 284d7c7c8f4..481552de20e 100644 --- a/linters/arm_arm_ttk/Dockerfile +++ b/linters/arm_arm_ttk/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/bash_exec/Dockerfile b/linters/bash_exec/Dockerfile index 8843dd3bc36..51412ef0eb1 100644 --- a/linters/bash_exec/Dockerfile +++ b/linters/bash_exec/Dockerfile @@ -49,7 +49,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/bash_shellcheck/Dockerfile b/linters/bash_shellcheck/Dockerfile index 47591a7dd66..98e6c6f8a6b 100644 --- a/linters/bash_shellcheck/Dockerfile +++ b/linters/bash_shellcheck/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/bash_shfmt/Dockerfile b/linters/bash_shfmt/Dockerfile index 4fe63875822..02e5b4dd65a 100644 --- a/linters/bash_shfmt/Dockerfile +++ b/linters/bash_shfmt/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/bicep_bicep_linter/Dockerfile b/linters/bicep_bicep_linter/Dockerfile index 6f6a38e2b4c..b8afa2544d2 100644 --- a/linters/bicep_bicep_linter/Dockerfile +++ b/linters/bicep_bicep_linter/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/c_cpplint/Dockerfile b/linters/c_cpplint/Dockerfile index df4916286e3..2ffb9c190b2 100644 --- a/linters/c_cpplint/Dockerfile +++ b/linters/c_cpplint/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/clojure_clj_kondo/Dockerfile b/linters/clojure_clj_kondo/Dockerfile index 3a1f2c6c33c..9c15b3d74a9 100644 --- a/linters/clojure_clj_kondo/Dockerfile +++ b/linters/clojure_clj_kondo/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/clojure_cljstyle/Dockerfile b/linters/clojure_cljstyle/Dockerfile index df24635ecd8..2306f908c4c 100644 --- a/linters/clojure_cljstyle/Dockerfile +++ b/linters/clojure_cljstyle/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/cloudformation_cfn_lint/Dockerfile b/linters/cloudformation_cfn_lint/Dockerfile index 0eaef08415c..7abdfc16c7d 100644 --- a/linters/cloudformation_cfn_lint/Dockerfile +++ b/linters/cloudformation_cfn_lint/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/coffee_coffeelint/Dockerfile b/linters/coffee_coffeelint/Dockerfile index 65ca7a2bbcc..dfa3dee5dc9 100644 --- a/linters/coffee_coffeelint/Dockerfile +++ b/linters/coffee_coffeelint/Dockerfile @@ -65,7 +65,7 @@ WORKDIR / #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/copypaste_jscpd/Dockerfile b/linters/copypaste_jscpd/Dockerfile index 0030944447c..6fac5511f08 100644 --- a/linters/copypaste_jscpd/Dockerfile +++ b/linters/copypaste_jscpd/Dockerfile @@ -65,7 +65,7 @@ WORKDIR / #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/cpp_cpplint/Dockerfile b/linters/cpp_cpplint/Dockerfile index 3306ce1be18..22c55bd7faf 100644 --- a/linters/cpp_cpplint/Dockerfile +++ b/linters/cpp_cpplint/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/csharp_csharpier/Dockerfile b/linters/csharp_csharpier/Dockerfile index 4014b2de95b..b07600ddb61 100644 --- a/linters/csharp_csharpier/Dockerfile +++ b/linters/csharp_csharpier/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/csharp_dotnet_format/Dockerfile b/linters/csharp_dotnet_format/Dockerfile index cb52ddde09f..d9af19769fd 100644 --- a/linters/csharp_dotnet_format/Dockerfile +++ b/linters/csharp_dotnet_format/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/css_scss_lint/Dockerfile b/linters/css_scss_lint/Dockerfile index 144db0ab35b..1fd48691cb3 100644 --- a/linters/css_scss_lint/Dockerfile +++ b/linters/css_scss_lint/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/css_stylelint/Dockerfile b/linters/css_stylelint/Dockerfile index 54a7e0d8177..a5af6b20f4e 100644 --- a/linters/css_stylelint/Dockerfile +++ b/linters/css_stylelint/Dockerfile @@ -68,7 +68,7 @@ WORKDIR / #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/dart_dartanalyzer/Dockerfile b/linters/dart_dartanalyzer/Dockerfile index 26627b5865a..032255582ec 100644 --- a/linters/dart_dartanalyzer/Dockerfile +++ b/linters/dart_dartanalyzer/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/dockerfile_hadolint/Dockerfile b/linters/dockerfile_hadolint/Dockerfile index 834ff477d8a..e0013f13ea4 100644 --- a/linters/dockerfile_hadolint/Dockerfile +++ b/linters/dockerfile_hadolint/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/editorconfig_editorconfig_checker/Dockerfile b/linters/editorconfig_editorconfig_checker/Dockerfile index 8ab418f5c7e..6c67c4bced7 100644 --- a/linters/editorconfig_editorconfig_checker/Dockerfile +++ b/linters/editorconfig_editorconfig_checker/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/env_dotenv_linter/Dockerfile b/linters/env_dotenv_linter/Dockerfile index c349fc8ebb0..8416a54c282 100644 --- a/linters/env_dotenv_linter/Dockerfile +++ b/linters/env_dotenv_linter/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/gherkin_gherkin_lint/Dockerfile b/linters/gherkin_gherkin_lint/Dockerfile index 903dba45df0..59f73148c8f 100644 --- a/linters/gherkin_gherkin_lint/Dockerfile +++ b/linters/gherkin_gherkin_lint/Dockerfile @@ -65,7 +65,7 @@ WORKDIR / #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/go_golangci_lint/Dockerfile b/linters/go_golangci_lint/Dockerfile index 63b7172fe8c..0fdf6641640 100644 --- a/linters/go_golangci_lint/Dockerfile +++ b/linters/go_golangci_lint/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/go_revive/Dockerfile b/linters/go_revive/Dockerfile index 585a49aad91..d47191434d7 100644 --- a/linters/go_revive/Dockerfile +++ b/linters/go_revive/Dockerfile @@ -50,7 +50,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/graphql_graphql_schema_linter/Dockerfile b/linters/graphql_graphql_schema_linter/Dockerfile index 8a26f39a5c5..fc01f4bc67c 100644 --- a/linters/graphql_graphql_schema_linter/Dockerfile +++ b/linters/graphql_graphql_schema_linter/Dockerfile @@ -66,7 +66,7 @@ WORKDIR / #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/groovy_npm_groovy_lint/Dockerfile b/linters/groovy_npm_groovy_lint/Dockerfile index e46571607b4..d4f03a127d6 100644 --- a/linters/groovy_npm_groovy_lint/Dockerfile +++ b/linters/groovy_npm_groovy_lint/Dockerfile @@ -65,7 +65,7 @@ WORKDIR / #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/html_djlint/Dockerfile b/linters/html_djlint/Dockerfile index d1f68a18c63..5d4e9e971f3 100644 --- a/linters/html_djlint/Dockerfile +++ b/linters/html_djlint/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/html_htmlhint/Dockerfile b/linters/html_htmlhint/Dockerfile index e619683e1ae..d9ffb453399 100644 --- a/linters/html_htmlhint/Dockerfile +++ b/linters/html_htmlhint/Dockerfile @@ -65,7 +65,7 @@ WORKDIR / #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/java_checkstyle/Dockerfile b/linters/java_checkstyle/Dockerfile index 2be338561d7..49b52e6cc32 100644 --- a/linters/java_checkstyle/Dockerfile +++ b/linters/java_checkstyle/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/java_pmd/Dockerfile b/linters/java_pmd/Dockerfile index fb0167dcfa3..4761ce9597f 100644 --- a/linters/java_pmd/Dockerfile +++ b/linters/java_pmd/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/javascript_es/Dockerfile b/linters/javascript_es/Dockerfile index 5ca9d3814a5..2537e4ef05a 100644 --- a/linters/javascript_es/Dockerfile +++ b/linters/javascript_es/Dockerfile @@ -77,7 +77,7 @@ WORKDIR / #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/javascript_prettier/Dockerfile b/linters/javascript_prettier/Dockerfile index 3150ace1de9..83843bf1ced 100644 --- a/linters/javascript_prettier/Dockerfile +++ b/linters/javascript_prettier/Dockerfile @@ -65,7 +65,7 @@ WORKDIR / #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/javascript_standard/Dockerfile b/linters/javascript_standard/Dockerfile index 1e178806bdb..953c7bbc3af 100644 --- a/linters/javascript_standard/Dockerfile +++ b/linters/javascript_standard/Dockerfile @@ -65,7 +65,7 @@ WORKDIR / #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/json_eslint_plugin_jsonc/Dockerfile b/linters/json_eslint_plugin_jsonc/Dockerfile index bab8baf8c69..111b043258e 100644 --- a/linters/json_eslint_plugin_jsonc/Dockerfile +++ b/linters/json_eslint_plugin_jsonc/Dockerfile @@ -67,7 +67,7 @@ WORKDIR / #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/json_jsonlint/Dockerfile b/linters/json_jsonlint/Dockerfile index 5580a0911d3..21338459b1d 100644 --- a/linters/json_jsonlint/Dockerfile +++ b/linters/json_jsonlint/Dockerfile @@ -65,7 +65,7 @@ WORKDIR / #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/json_npm_package_json_lint/Dockerfile b/linters/json_npm_package_json_lint/Dockerfile index 40cf297d5e6..982b0f6fb41 100644 --- a/linters/json_npm_package_json_lint/Dockerfile +++ b/linters/json_npm_package_json_lint/Dockerfile @@ -66,7 +66,7 @@ WORKDIR / #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/json_prettier/Dockerfile b/linters/json_prettier/Dockerfile index c28b43997cd..5dd5188d808 100644 --- a/linters/json_prettier/Dockerfile +++ b/linters/json_prettier/Dockerfile @@ -65,7 +65,7 @@ WORKDIR / #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/json_v8r/Dockerfile b/linters/json_v8r/Dockerfile index 0efe6320cec..5fe27c3220c 100644 --- a/linters/json_v8r/Dockerfile +++ b/linters/json_v8r/Dockerfile @@ -65,7 +65,7 @@ WORKDIR / #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/jsx_eslint/Dockerfile b/linters/jsx_eslint/Dockerfile index af99518dc7a..baf403327c2 100644 --- a/linters/jsx_eslint/Dockerfile +++ b/linters/jsx_eslint/Dockerfile @@ -68,7 +68,7 @@ WORKDIR / #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/kotlin_ktlint/Dockerfile b/linters/kotlin_ktlint/Dockerfile index d784032cbc8..656a80ca205 100644 --- a/linters/kotlin_ktlint/Dockerfile +++ b/linters/kotlin_ktlint/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/kubernetes_helm/Dockerfile b/linters/kubernetes_helm/Dockerfile index a3d6c798f0d..b677fec9a50 100644 --- a/linters/kubernetes_helm/Dockerfile +++ b/linters/kubernetes_helm/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/kubernetes_kubeconform/Dockerfile b/linters/kubernetes_kubeconform/Dockerfile index 4be3a166133..495b0084424 100644 --- a/linters/kubernetes_kubeconform/Dockerfile +++ b/linters/kubernetes_kubeconform/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/kubernetes_kubescape/Dockerfile b/linters/kubernetes_kubescape/Dockerfile index 9c96147981d..d1ebb2c4448 100644 --- a/linters/kubernetes_kubescape/Dockerfile +++ b/linters/kubernetes_kubescape/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/latex_chktex/Dockerfile b/linters/latex_chktex/Dockerfile index 8262590e2cd..be9b93a075d 100644 --- a/linters/latex_chktex/Dockerfile +++ b/linters/latex_chktex/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/lua_luacheck/Dockerfile b/linters/lua_luacheck/Dockerfile index a1dcefddb3d..9b2f5913405 100644 --- a/linters/lua_luacheck/Dockerfile +++ b/linters/lua_luacheck/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/makefile_checkmake/Dockerfile b/linters/makefile_checkmake/Dockerfile index 4e2525e1120..f828adb510f 100644 --- a/linters/makefile_checkmake/Dockerfile +++ b/linters/makefile_checkmake/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/markdown_markdown_link_check/Dockerfile b/linters/markdown_markdown_link_check/Dockerfile index 9dcfcb8f368..c7c50347393 100644 --- a/linters/markdown_markdown_link_check/Dockerfile +++ b/linters/markdown_markdown_link_check/Dockerfile @@ -65,7 +65,7 @@ WORKDIR / #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/markdown_markdown_table_formatter/Dockerfile b/linters/markdown_markdown_table_formatter/Dockerfile index 0804d7ef640..ddf97293c0e 100644 --- a/linters/markdown_markdown_table_formatter/Dockerfile +++ b/linters/markdown_markdown_table_formatter/Dockerfile @@ -65,7 +65,7 @@ WORKDIR / #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/markdown_markdownlint/Dockerfile b/linters/markdown_markdownlint/Dockerfile index 4ec648e4e07..605a90daa1e 100644 --- a/linters/markdown_markdownlint/Dockerfile +++ b/linters/markdown_markdownlint/Dockerfile @@ -65,7 +65,7 @@ WORKDIR / #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/markdown_remark_lint/Dockerfile b/linters/markdown_remark_lint/Dockerfile index df2ec5b48ef..3063e179ed2 100644 --- a/linters/markdown_remark_lint/Dockerfile +++ b/linters/markdown_remark_lint/Dockerfile @@ -66,7 +66,7 @@ WORKDIR / #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/openapi_spectral/Dockerfile b/linters/openapi_spectral/Dockerfile index 362b95f40d5..a1e6825585d 100644 --- a/linters/openapi_spectral/Dockerfile +++ b/linters/openapi_spectral/Dockerfile @@ -65,7 +65,7 @@ WORKDIR / #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/perl_perlcritic/Dockerfile b/linters/perl_perlcritic/Dockerfile index 13ab4627774..2523fe07401 100644 --- a/linters/perl_perlcritic/Dockerfile +++ b/linters/perl_perlcritic/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/php_phpcs/Dockerfile b/linters/php_phpcs/Dockerfile index 44df4872335..c13e7a29573 100644 --- a/linters/php_phpcs/Dockerfile +++ b/linters/php_phpcs/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/php_phplint/Dockerfile b/linters/php_phplint/Dockerfile index fb4d325117f..e8aae692e4d 100644 --- a/linters/php_phplint/Dockerfile +++ b/linters/php_phplint/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/php_phpstan/Dockerfile b/linters/php_phpstan/Dockerfile index 97e5b1f004c..9de32cffcf4 100644 --- a/linters/php_phpstan/Dockerfile +++ b/linters/php_phpstan/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/php_psalm/Dockerfile b/linters/php_psalm/Dockerfile index 556298cfe7b..c50f0281d22 100644 --- a/linters/php_psalm/Dockerfile +++ b/linters/php_psalm/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/powershell_powershell/Dockerfile b/linters/powershell_powershell/Dockerfile index 297a8a7147c..b05f3860b99 100644 --- a/linters/powershell_powershell/Dockerfile +++ b/linters/powershell_powershell/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/powershell_powershell_formatter/Dockerfile b/linters/powershell_powershell_formatter/Dockerfile index 3114a738b4c..eef9b8c5897 100644 --- a/linters/powershell_powershell_formatter/Dockerfile +++ b/linters/powershell_powershell_formatter/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/protobuf_protolint/Dockerfile b/linters/protobuf_protolint/Dockerfile index 7d46f2b6fb2..ba5193a1c1b 100644 --- a/linters/protobuf_protolint/Dockerfile +++ b/linters/protobuf_protolint/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/puppet_puppet_lint/Dockerfile b/linters/puppet_puppet_lint/Dockerfile index bd121de6b80..b6cd6a5b16a 100644 --- a/linters/puppet_puppet_lint/Dockerfile +++ b/linters/puppet_puppet_lint/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/python_bandit/Dockerfile b/linters/python_bandit/Dockerfile index 7cda30b946a..2751147d20a 100644 --- a/linters/python_bandit/Dockerfile +++ b/linters/python_bandit/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/python_black/Dockerfile b/linters/python_black/Dockerfile index fc974cbe68b..a5ba44a00f3 100644 --- a/linters/python_black/Dockerfile +++ b/linters/python_black/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/python_flake8/Dockerfile b/linters/python_flake8/Dockerfile index e891e0f88cf..0ff0c1bb76c 100644 --- a/linters/python_flake8/Dockerfile +++ b/linters/python_flake8/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/python_isort/Dockerfile b/linters/python_isort/Dockerfile index 5ae812f448c..290d14c07ed 100644 --- a/linters/python_isort/Dockerfile +++ b/linters/python_isort/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/python_mypy/Dockerfile b/linters/python_mypy/Dockerfile index db724f16e0f..bc045fbcadd 100644 --- a/linters/python_mypy/Dockerfile +++ b/linters/python_mypy/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/python_pylint/Dockerfile b/linters/python_pylint/Dockerfile index b9fc55ddab9..995905dc29e 100644 --- a/linters/python_pylint/Dockerfile +++ b/linters/python_pylint/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/python_pyright/Dockerfile b/linters/python_pyright/Dockerfile index 8cdea0c74b7..7fc49bef591 100644 --- a/linters/python_pyright/Dockerfile +++ b/linters/python_pyright/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/python_ruff/Dockerfile b/linters/python_ruff/Dockerfile index 9782dbcb4e2..2f29aee27df 100644 --- a/linters/python_ruff/Dockerfile +++ b/linters/python_ruff/Dockerfile @@ -53,7 +53,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/r_lintr/Dockerfile b/linters/r_lintr/Dockerfile index c28b1df24ae..c3885b296e8 100644 --- a/linters/r_lintr/Dockerfile +++ b/linters/r_lintr/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/raku_raku/Dockerfile b/linters/raku_raku/Dockerfile index 3f11eb9c7b0..b93c3832bef 100644 --- a/linters/raku_raku/Dockerfile +++ b/linters/raku_raku/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/repository_checkov/Dockerfile b/linters/repository_checkov/Dockerfile index 1b30aff5c9b..92f7be0df4f 100644 --- a/linters/repository_checkov/Dockerfile +++ b/linters/repository_checkov/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/repository_devskim/Dockerfile b/linters/repository_devskim/Dockerfile index dda841fc256..ae589eedd02 100644 --- a/linters/repository_devskim/Dockerfile +++ b/linters/repository_devskim/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/repository_dustilock/Dockerfile b/linters/repository_dustilock/Dockerfile index 45397758310..70f0ca306df 100644 --- a/linters/repository_dustilock/Dockerfile +++ b/linters/repository_dustilock/Dockerfile @@ -47,7 +47,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/repository_git_diff/Dockerfile b/linters/repository_git_diff/Dockerfile index 178e85dc9d7..f5d3c9f83dd 100644 --- a/linters/repository_git_diff/Dockerfile +++ b/linters/repository_git_diff/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/repository_gitleaks/Dockerfile b/linters/repository_gitleaks/Dockerfile index 5b0e529cc50..ec391365c7a 100644 --- a/linters/repository_gitleaks/Dockerfile +++ b/linters/repository_gitleaks/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/repository_grype/Dockerfile b/linters/repository_grype/Dockerfile index 7313f760421..b3c2d206704 100644 --- a/linters/repository_grype/Dockerfile +++ b/linters/repository_grype/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/repository_kics/Dockerfile b/linters/repository_kics/Dockerfile index 769c623037d..d0613b7ce77 100644 --- a/linters/repository_kics/Dockerfile +++ b/linters/repository_kics/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/repository_secretlint/Dockerfile b/linters/repository_secretlint/Dockerfile index 66212fc4ddb..abb7fe64c60 100644 --- a/linters/repository_secretlint/Dockerfile +++ b/linters/repository_secretlint/Dockerfile @@ -67,7 +67,7 @@ WORKDIR / #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/repository_semgrep/Dockerfile b/linters/repository_semgrep/Dockerfile index 128fbf9617a..4506620d965 100644 --- a/linters/repository_semgrep/Dockerfile +++ b/linters/repository_semgrep/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/repository_syft/Dockerfile b/linters/repository_syft/Dockerfile index 22b778bd3f8..ad080cd43d7 100644 --- a/linters/repository_syft/Dockerfile +++ b/linters/repository_syft/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/repository_trivy/Dockerfile b/linters/repository_trivy/Dockerfile index 63b010b36fc..0b738fc8885 100644 --- a/linters/repository_trivy/Dockerfile +++ b/linters/repository_trivy/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/repository_trivy_sbom/Dockerfile b/linters/repository_trivy_sbom/Dockerfile index a6c6ec3bdea..45e81f0bc59 100644 --- a/linters/repository_trivy_sbom/Dockerfile +++ b/linters/repository_trivy_sbom/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/repository_trufflehog/Dockerfile b/linters/repository_trufflehog/Dockerfile index 8be07d846fe..86ed107eaf7 100644 --- a/linters/repository_trufflehog/Dockerfile +++ b/linters/repository_trufflehog/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/rst_rst_lint/Dockerfile b/linters/rst_rst_lint/Dockerfile index 3f00961f159..41fda829a2c 100644 --- a/linters/rst_rst_lint/Dockerfile +++ b/linters/rst_rst_lint/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/rst_rstcheck/Dockerfile b/linters/rst_rstcheck/Dockerfile index 750fc879a94..baaee166b86 100644 --- a/linters/rst_rstcheck/Dockerfile +++ b/linters/rst_rstcheck/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/rst_rstfmt/Dockerfile b/linters/rst_rstfmt/Dockerfile index f5e572d68ea..e3c020709d4 100644 --- a/linters/rst_rstfmt/Dockerfile +++ b/linters/rst_rstfmt/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/ruby_rubocop/Dockerfile b/linters/ruby_rubocop/Dockerfile index d4fc9f8ecd3..cb67c58223c 100644 --- a/linters/ruby_rubocop/Dockerfile +++ b/linters/ruby_rubocop/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/rust_clippy/Dockerfile b/linters/rust_clippy/Dockerfile index 9bf811076e2..15254c100ca 100644 --- a/linters/rust_clippy/Dockerfile +++ b/linters/rust_clippy/Dockerfile @@ -80,7 +80,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/salesforce_sfdx_scanner_apex/Dockerfile b/linters/salesforce_sfdx_scanner_apex/Dockerfile index a6ca3186afe..58579274783 100644 --- a/linters/salesforce_sfdx_scanner_apex/Dockerfile +++ b/linters/salesforce_sfdx_scanner_apex/Dockerfile @@ -65,7 +65,7 @@ WORKDIR / #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/salesforce_sfdx_scanner_aura/Dockerfile b/linters/salesforce_sfdx_scanner_aura/Dockerfile index cfc163c0172..c09d3cabc87 100644 --- a/linters/salesforce_sfdx_scanner_aura/Dockerfile +++ b/linters/salesforce_sfdx_scanner_aura/Dockerfile @@ -65,7 +65,7 @@ WORKDIR / #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/salesforce_sfdx_scanner_lwc/Dockerfile b/linters/salesforce_sfdx_scanner_lwc/Dockerfile index cd763dc1306..ff1a80b140e 100644 --- a/linters/salesforce_sfdx_scanner_lwc/Dockerfile +++ b/linters/salesforce_sfdx_scanner_lwc/Dockerfile @@ -65,7 +65,7 @@ WORKDIR / #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/scala_scalafix/Dockerfile b/linters/scala_scalafix/Dockerfile index ae16f7aec5c..cb494650fea 100644 --- a/linters/scala_scalafix/Dockerfile +++ b/linters/scala_scalafix/Dockerfile @@ -53,7 +53,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/snakemake_lint/Dockerfile b/linters/snakemake_lint/Dockerfile index 1f2622e7a41..1320a966dbb 100644 --- a/linters/snakemake_lint/Dockerfile +++ b/linters/snakemake_lint/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/snakemake_snakefmt/Dockerfile b/linters/snakemake_snakefmt/Dockerfile index 576ad166ede..77b6d31796b 100644 --- a/linters/snakemake_snakefmt/Dockerfile +++ b/linters/snakemake_snakefmt/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/spell_cspell/Dockerfile b/linters/spell_cspell/Dockerfile index 22575987521..47f5ef0b53f 100644 --- a/linters/spell_cspell/Dockerfile +++ b/linters/spell_cspell/Dockerfile @@ -65,7 +65,7 @@ WORKDIR / #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/spell_lychee/Dockerfile b/linters/spell_lychee/Dockerfile index 2c9b5a9db55..5cb797b81b1 100644 --- a/linters/spell_lychee/Dockerfile +++ b/linters/spell_lychee/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/spell_proselint/Dockerfile b/linters/spell_proselint/Dockerfile index c27a5e8d88b..8dd5707ca42 100644 --- a/linters/spell_proselint/Dockerfile +++ b/linters/spell_proselint/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/spell_vale/Dockerfile b/linters/spell_vale/Dockerfile index a555025f171..e8dafbdd9f2 100644 --- a/linters/spell_vale/Dockerfile +++ b/linters/spell_vale/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/sql_sql_lint/Dockerfile b/linters/sql_sql_lint/Dockerfile index 39a28e6c6d0..0ee3cee0251 100644 --- a/linters/sql_sql_lint/Dockerfile +++ b/linters/sql_sql_lint/Dockerfile @@ -65,7 +65,7 @@ WORKDIR / #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/sql_sqlfluff/Dockerfile b/linters/sql_sqlfluff/Dockerfile index e70d2abdd99..9144b2eb010 100644 --- a/linters/sql_sqlfluff/Dockerfile +++ b/linters/sql_sqlfluff/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/sql_tsqllint/Dockerfile b/linters/sql_tsqllint/Dockerfile index 7f19e6b8eaa..422171d282c 100644 --- a/linters/sql_tsqllint/Dockerfile +++ b/linters/sql_tsqllint/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/swift_swiftlint/Dockerfile b/linters/swift_swiftlint/Dockerfile index 10a9d7cd304..fb4bf16e218 100644 --- a/linters/swift_swiftlint/Dockerfile +++ b/linters/swift_swiftlint/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/tekton_tekton_lint/Dockerfile b/linters/tekton_tekton_lint/Dockerfile index a65df3cc0e1..ea1c9889e00 100644 --- a/linters/tekton_tekton_lint/Dockerfile +++ b/linters/tekton_tekton_lint/Dockerfile @@ -65,7 +65,7 @@ WORKDIR / #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/terraform_terraform_fmt/Dockerfile b/linters/terraform_terraform_fmt/Dockerfile index 4bf7bef4568..08539859ca2 100644 --- a/linters/terraform_terraform_fmt/Dockerfile +++ b/linters/terraform_terraform_fmt/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/terraform_terragrunt/Dockerfile b/linters/terraform_terragrunt/Dockerfile index aad924093ac..c228ed12b78 100644 --- a/linters/terraform_terragrunt/Dockerfile +++ b/linters/terraform_terragrunt/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/terraform_terrascan/Dockerfile b/linters/terraform_terrascan/Dockerfile index 50364226eda..b2d1576b37e 100644 --- a/linters/terraform_terrascan/Dockerfile +++ b/linters/terraform_terrascan/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/terraform_tflint/Dockerfile b/linters/terraform_tflint/Dockerfile index 883ce069c4d..df6dd2fd6ed 100644 --- a/linters/terraform_tflint/Dockerfile +++ b/linters/terraform_tflint/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/tsx_eslint/Dockerfile b/linters/tsx_eslint/Dockerfile index 2bd4cfd3e61..7242aea5219 100644 --- a/linters/tsx_eslint/Dockerfile +++ b/linters/tsx_eslint/Dockerfile @@ -77,7 +77,7 @@ WORKDIR / #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/typescript_es/Dockerfile b/linters/typescript_es/Dockerfile index bfab2651ef4..860c354fb7e 100644 --- a/linters/typescript_es/Dockerfile +++ b/linters/typescript_es/Dockerfile @@ -80,7 +80,7 @@ WORKDIR / #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/typescript_prettier/Dockerfile b/linters/typescript_prettier/Dockerfile index a213bfd2842..0ca9c6d0cd9 100644 --- a/linters/typescript_prettier/Dockerfile +++ b/linters/typescript_prettier/Dockerfile @@ -66,7 +66,7 @@ WORKDIR / #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/typescript_standard/Dockerfile b/linters/typescript_standard/Dockerfile index 637154050a6..8bf01d53f94 100644 --- a/linters/typescript_standard/Dockerfile +++ b/linters/typescript_standard/Dockerfile @@ -66,7 +66,7 @@ WORKDIR / #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/vbdotnet_dotnet_format/Dockerfile b/linters/vbdotnet_dotnet_format/Dockerfile index 38fc6785bf6..4ff89a7e37d 100644 --- a/linters/vbdotnet_dotnet_format/Dockerfile +++ b/linters/vbdotnet_dotnet_format/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/xml_xmllint/Dockerfile b/linters/xml_xmllint/Dockerfile index ed21ff27525..33f76275476 100644 --- a/linters/xml_xmllint/Dockerfile +++ b/linters/xml_xmllint/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/yaml_prettier/Dockerfile b/linters/yaml_prettier/Dockerfile index 89363079c01..d5f00a86ac6 100644 --- a/linters/yaml_prettier/Dockerfile +++ b/linters/yaml_prettier/Dockerfile @@ -65,7 +65,7 @@ WORKDIR / #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/yaml_v8r/Dockerfile b/linters/yaml_v8r/Dockerfile index 8ee9b348d95..bf97bd4d596 100644 --- a/linters/yaml_v8r/Dockerfile +++ b/linters/yaml_v8r/Dockerfile @@ -65,7 +65,7 @@ WORKDIR / #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # diff --git a/linters/yaml_yamllint/Dockerfile b/linters/yaml_yamllint/Dockerfile index 7a615a8c35f..1573250d402 100644 --- a/linters/yaml_yamllint/Dockerfile +++ b/linters/yaml_yamllint/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__END -FROM busybox AS copy-collector +FROM scratch AS copy-collector ############################## # COPY instructions # From 5e9602615e361eff23e88830b54e71e79670b94f Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Wed, 19 Jul 2023 17:35:46 -0500 Subject: [PATCH 083/105] Enable arm --- .github/workflows/-build-docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/-build-docker.yml b/.github/workflows/-build-docker.yml index 5e7ebeaca6a..c8cc5945156 100644 --- a/.github/workflows/-build-docker.yml +++ b/.github/workflows/-build-docker.yml @@ -88,7 +88,7 @@ jobs: uses: docker/build-push-action@v4 with: file: ${{ inputs.dockerfile }} - platforms: linux/amd64 #,linux/arm64 -Temporary, getting no space left on device + platforms: linux/amd64,linux/arm64 build-args: | BUILD_DATE=${{ env.BUILD_DATE }} BUILD_REVISION=${{ github.sha }} From 48a46c6fa63855f6401523076226ba92ede82aa3 Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Thu, 20 Jul 2023 09:39:25 -0500 Subject: [PATCH 084/105] Moved revive build to cross compile --- Dockerfile | 26 ++++++++++++------ flavors/cupcake/Dockerfile | 26 ++++++++++++------ flavors/go/Dockerfile | 27 +++++++++++++------ flavors/rust/Dockerfile | 4 +-- linters/go_revive/Dockerfile | 20 ++++++++++---- .../descriptors/go.megalinter-descriptor.yml | 12 +++++++-- parseLog | 4 +-- 7 files changed, 84 insertions(+), 35 deletions(-) diff --git a/Dockerfile b/Dockerfile index b869918d771..af4ae35ada6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,12 +21,6 @@ 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 dotenvlinter/dotenv-linter:latest as dotenvlinter -FROM golang:1-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/yannh/kubeconform:latest-alpine as kubeconform FROM ghcr.io/assignuser/chktex-alpine:latest as chktex FROM mrtazz/checkmake:latest as checkmake @@ -84,12 +78,12 @@ RUN rustup-init -y --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-u RUN --mount=type=cache,id=cargo-${TARGETARCH},sharing=locked,target=/cargo/.cargo/registry/,uid=63425 \ . /cargo/.cargo/env \ - && cargo binstall --no-confirm --no-symlinks sarif-fmt shellcheck-sarif --root /tmp --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") + && cargo binstall --no-confirm --no-symlinks shellcheck-sarif sarif-fmt --root /tmp --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") FROM scratch AS cargo COPY --link --from=cargo-build /tmp/bin/* /bin/ -RUN ["/bin/sarif-fmt", "--help"] RUN ["/bin/shellcheck-sarif", "--help"] +RUN ["/bin/sarif-fmt", "--help"] #FROM__END @@ -848,6 +842,22 @@ esac \ && wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh \ && golangci-lint --version +# +# revive installation +## 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 +FROM --platform=$BUILDPLATFORM golang:1-alpine as revive-build +RUN mkdir temp && cd temp && go mod init temp && go get -d github.com/mgechev/revive@latest +ARG BUILDARCH +ARG TARGETARCH +RUN GOOS=linux GOARCH=${TARGETARCH} go install github.com/mgechev/revive@latest \ +&& ([[ "${BUILDARCH}" == "${TARGETARCH}" ]] && mv bin/revive /usr/bin) || mv bin/linux_${TARGETARCH}/revive /usr/bin +FROM golang:1-alpine as revive +COPY --from=revive-build /usr/bin/revive /usr/bin/revive +# Verify Binary +RUN /usr/bin/revive --version + # # checkstyle installation RUN --mount=type=secret,id=GITHUB_TOKEN CHECKSTYLE_LATEST=$(curl -s \ diff --git a/flavors/cupcake/Dockerfile b/flavors/cupcake/Dockerfile index d0b1b79e188..dc2a417229d 100644 --- a/flavors/cupcake/Dockerfile +++ b/flavors/cupcake/Dockerfile @@ -22,12 +22,6 @@ 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 dotenvlinter/dotenv-linter:latest as dotenvlinter -FROM golang:1-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/yannh/kubeconform:latest-alpine as kubeconform FROM mrtazz/checkmake:latest as checkmake FROM ghcr.io/phpstan/phpstan:latest-php8.1 as phpstan @@ -79,12 +73,12 @@ RUN rustup-init -y --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-u RUN --mount=type=cache,id=cargo-${TARGETARCH},sharing=locked,target=/cargo/.cargo/registry/,uid=63425 \ . /cargo/.cargo/env \ - && cargo binstall --no-confirm --no-symlinks sarif-fmt shellcheck-sarif --root /tmp --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") + && cargo binstall --no-confirm --no-symlinks shellcheck-sarif sarif-fmt --root /tmp --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") FROM scratch AS cargo COPY --link --from=cargo-build /tmp/bin/* /bin/ -RUN ["/bin/sarif-fmt", "--help"] RUN ["/bin/shellcheck-sarif", "--help"] +RUN ["/bin/sarif-fmt", "--help"] #FROM__END @@ -640,6 +634,22 @@ RUN curl --retry 5 --retry-delay 5 -sLO https://raw.githubusercontent.com/clj-ko && wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh \ && golangci-lint --version +# +# revive installation +## 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 +FROM --platform=$BUILDPLATFORM golang:1-alpine as revive-build +RUN mkdir temp && cd temp && go mod init temp && go get -d github.com/mgechev/revive@latest +ARG BUILDARCH +ARG TARGETARCH +RUN GOOS=linux GOARCH=${TARGETARCH} go install github.com/mgechev/revive@latest \ +&& ([[ "${BUILDARCH}" == "${TARGETARCH}" ]] && mv bin/revive /usr/bin) || mv bin/linux_${TARGETARCH}/revive /usr/bin +FROM golang:1-alpine as revive +COPY --from=revive-build /usr/bin/revive /usr/bin/revive +# Verify Binary +RUN /usr/bin/revive --version + # # checkstyle installation RUN --mount=type=secret,id=GITHUB_TOKEN CHECKSTYLE_LATEST=$(curl -s \ diff --git a/flavors/go/Dockerfile b/flavors/go/Dockerfile index c05b052accd..fb14b5a4b3f 100644 --- a/flavors/go/Dockerfile +++ b/flavors/go/Dockerfile @@ -22,12 +22,6 @@ 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 dotenvlinter/dotenv-linter:latest as dotenvlinter -FROM golang:1-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/yannh/kubeconform:latest-alpine as kubeconform FROM mrtazz/checkmake:latest as checkmake FROM yoheimuta/protolint:latest as protolint @@ -398,10 +392,27 @@ COPY --from=copy-collector / / #OTHER__START # golangci-lint installation RUN wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh \ - && golangci-lint --version \ + && golangci-lint --version + +# +# revive installation +## 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 +FROM --platform=$BUILDPLATFORM golang:1-alpine as revive-build +RUN mkdir temp && cd temp && go mod init temp && go get -d github.com/mgechev/revive@latest +ARG BUILDARCH +ARG TARGETARCH +RUN GOOS=linux GOARCH=${TARGETARCH} go install github.com/mgechev/revive@latest \ +&& ([[ "${BUILDARCH}" == "${TARGETARCH}" ]] && mv bin/revive /usr/bin) || mv bin/linux_${TARGETARCH}/revive /usr/bin +FROM golang:1-alpine as revive +COPY --from=revive-build /usr/bin/revive /usr/bin/revive +# Verify Binary +RUN /usr/bin/revive --version + # # ktlint installation - && curl --retry 5 --retry-delay 5 -sSLO https://github.com/pinterest/ktlint/releases/latest/download/ktlint && \ +RUN curl --retry 5 --retry-delay 5 -sSLO https://github.com/pinterest/ktlint/releases/latest/download/ktlint && \ chmod a+x ktlint && \ mv "ktlint" /usr/bin/ \ # diff --git a/flavors/rust/Dockerfile b/flavors/rust/Dockerfile index 04b74ebddbf..56b6399a47f 100644 --- a/flavors/rust/Dockerfile +++ b/flavors/rust/Dockerfile @@ -58,12 +58,12 @@ RUN rustup-init -y --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-u RUN --mount=type=cache,id=cargo-${TARGETARCH},sharing=locked,target=/cargo/.cargo/registry/,uid=63425 \ . /cargo/.cargo/env \ - && cargo binstall --no-confirm --no-symlinks sarif-fmt shellcheck-sarif --root /tmp --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") + && cargo binstall --no-confirm --no-symlinks shellcheck-sarif sarif-fmt --root /tmp --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") FROM scratch AS cargo COPY --link --from=cargo-build /tmp/bin/* /bin/ -RUN ["/bin/sarif-fmt", "--help"] RUN ["/bin/shellcheck-sarif", "--help"] +RUN ["/bin/sarif-fmt", "--help"] #FROM__END diff --git a/linters/go_revive/Dockerfile b/linters/go_revive/Dockerfile index d47191434d7..393338849a1 100644 --- a/linters/go_revive/Dockerfile +++ b/linters/go_revive/Dockerfile @@ -11,11 +11,6 @@ ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #FROM__START -FROM golang:1-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 @@ -220,7 +215,22 @@ COPY --from=copy-collector / / ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #OTHER__START +# revive installation +## 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 +FROM --platform=$BUILDPLATFORM golang:1-alpine as revive-build +RUN mkdir temp && cd temp && go mod init temp && go get -d github.com/mgechev/revive@latest +ARG BUILDARCH +ARG TARGETARCH +RUN GOOS=linux GOARCH=${TARGETARCH} go install github.com/mgechev/revive@latest \ +&& ([[ "${BUILDARCH}" == "${TARGETARCH}" ]] && mv bin/revive /usr/bin) || mv bin/linux_${TARGETARCH}/revive /usr/bin +FROM golang:1-alpine as revive +COPY --from=revive-build /usr/bin/revive /usr/bin/revive +# Verify Binary +RUN /usr/bin/revive --version +# #OTHER__END ########################### diff --git a/megalinter/descriptors/go.megalinter-descriptor.yml b/megalinter/descriptors/go.megalinter-descriptor.yml index 7246a5a6d8a..2b17ea357ec 100644 --- a/megalinter/descriptors/go.megalinter-descriptor.yml +++ b/megalinter/descriptors/go.megalinter-descriptor.yml @@ -85,11 +85,19 @@ linters: # - FROM ghcr.io/mgechev/revive:1.2.5 as revive # - COPY --link --from=revive /usr/bin/revive /usr/bin/revive - | - FROM golang:1-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 --platform=$BUILDPLATFORM golang:1-alpine as revive-build + RUN mkdir temp && cd temp && go mod init temp && go get -d github.com/mgechev/revive@latest + ARG BUILDARCH + ARG TARGETARCH + RUN GOOS=linux GOARCH=${TARGETARCH} go install github.com/mgechev/revive@latest \ + && ([[ "${BUILDARCH}" == "${TARGETARCH}" ]] && mv bin/revive /usr/bin) || mv bin/linux_${TARGETARCH}/revive /usr/bin + FROM golang:1-alpine as revive + COPY --from=revive-build /usr/bin/revive /usr/bin/revive + # Verify Binary + RUN /usr/bin/revive --version - COPY --link --from=revive /usr/bin/revive /usr/bin/revive supported_platforms: platform: diff --git a/parseLog b/parseLog index 43c0b644d27..b6ec8cd3444 100755 --- a/parseLog +++ b/parseLog @@ -16,8 +16,8 @@ for f in $jobIds; do jobTimestamps=$(echo "$timeStamps" | grep "$f$" | grep -o "^[^ ]*") start=$(echo "$jobTimestamps" | head -n 1) end=$(echo "$jobTimestamps" | tail -n 1) - length=$(echo "$file" | grep "$f DONE" | grep -o "[0-9.]*s$" | grep -o "[0-9.]*") - label=$(echo "$file" | grep -o -e "Z $f \[[^]]*\]" | grep -o -e "\[[^]]*\]" | grep -o -e "[^][]*") + length=$(echo "$file" | grep "$f DONE" | grep -o "[0-9.]*s$" | grep -o "[0-9.]*" | tail -n 1) + label=$(echo "$file" | grep -o -e "Z $f \[[^]]*\]" | grep -o -e "\[[^]]*\]" | grep -o -e "[^][]*" | tail -n 1 | sed 's_1/1__g') data="${data} ${f},${label},${start},${end},${length}" done From f0a05a30f817d53f92da617b55011ef3de49c6b1 Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Thu, 20 Jul 2023 09:48:52 -0500 Subject: [PATCH 085/105] Move dustilock to cross compile --- Dockerfile | 10 +++++++++- flavors/security/Dockerfile | 10 +++++++++- linters/repository_dustilock/Dockerfile | 10 +++++++++- .../repository.megalinter-descriptor.yml | 16 ++++++++++++---- 4 files changed, 39 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index af4ae35ada6..6f6cefc36cd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -35,8 +35,16 @@ ARG TARGETARCH RUN export DL_LOCATION="https://github.com/charliermarsh/ruff/releases/latest/download/ruff-$([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64" || echo "aarch64")-unknown-linux-musl.tar.gz" \ && echo "Downloading from ${DL_LOCATION}" \ && curl --location "${DL_LOCATION}" | tar -xzv +FROM --platform=$BUILDPLATFORM golang:alpine as dustilock-build +RUN mkdir temp && cd temp && go mod init temp && go get -d github.com/checkmarx/dustilock@v1.2.0 +ARG BUILDARCH +ARG TARGETARCH +RUN GOOS=linux GOARCH=${TARGETARCH} go install github.com/checkmarx/dustilock@v1.2.0 \ +&& ([[ "${BUILDARCH}" == "${TARGETARCH}" ]] && mv bin/dustilock /usr/bin) || mv bin/linux_${TARGETARCH}/dustilock /usr/bin FROM golang:alpine as dustilock -RUN GOBIN=/usr/bin go install github.com/checkmarx/dustilock@v1.2.0 +COPY --from=dustilock-build /usr/bin/dustilock /usr/bin/dustilock +# Verify Binary +RUN /usr/bin/dustilock --version FROM zricethezav/gitleaks:v8.17.0 as gitleaks FROM checkmarx/kics:alpine as kics diff --git a/flavors/security/Dockerfile b/flavors/security/Dockerfile index 8ab3943f123..15f5923011c 100644 --- a/flavors/security/Dockerfile +++ b/flavors/security/Dockerfile @@ -15,8 +15,16 @@ FROM koalaman/shellcheck:stable as shellcheck FROM hadolint/hadolint:v2.12.0-alpine as hadolint FROM ghcr.io/yannh/kubeconform:latest-alpine as kubeconform +FROM --platform=$BUILDPLATFORM golang:alpine as dustilock-build +RUN mkdir temp && cd temp && go mod init temp && go get -d github.com/checkmarx/dustilock@v1.2.0 +ARG BUILDARCH +ARG TARGETARCH +RUN GOOS=linux GOARCH=${TARGETARCH} go install github.com/checkmarx/dustilock@v1.2.0 \ +&& ([[ "${BUILDARCH}" == "${TARGETARCH}" ]] && mv bin/dustilock /usr/bin) || mv bin/linux_${TARGETARCH}/dustilock /usr/bin FROM golang:alpine as dustilock -RUN GOBIN=/usr/bin go install github.com/checkmarx/dustilock@v1.2.0 +COPY --from=dustilock-build /usr/bin/dustilock /usr/bin/dustilock +# Verify Binary +RUN /usr/bin/dustilock --version FROM zricethezav/gitleaks:v8.17.0 as gitleaks FROM checkmarx/kics:alpine as kics diff --git a/linters/repository_dustilock/Dockerfile b/linters/repository_dustilock/Dockerfile index 70f0ca306df..b786828294d 100644 --- a/linters/repository_dustilock/Dockerfile +++ b/linters/repository_dustilock/Dockerfile @@ -11,8 +11,16 @@ ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #FROM__START +FROM --platform=$BUILDPLATFORM golang:alpine as dustilock-build +RUN mkdir temp && cd temp && go mod init temp && go get -d github.com/checkmarx/dustilock@v1.2.0 +ARG BUILDARCH +ARG TARGETARCH +RUN GOOS=linux GOARCH=${TARGETARCH} go install github.com/checkmarx/dustilock@v1.2.0 \ +&& ([[ "${BUILDARCH}" == "${TARGETARCH}" ]] && mv bin/dustilock /usr/bin) || mv bin/linux_${TARGETARCH}/dustilock /usr/bin FROM golang:alpine as dustilock -RUN GOBIN=/usr/bin go install github.com/checkmarx/dustilock@v1.2.0 +COPY --from=dustilock-build /usr/bin/dustilock /usr/bin/dustilock +# Verify Binary +RUN /usr/bin/dustilock --version #FROM__END diff --git a/megalinter/descriptors/repository.megalinter-descriptor.yml b/megalinter/descriptors/repository.megalinter-descriptor.yml index c8421685f6d..21fa56f8faf 100644 --- a/megalinter/descriptors/repository.megalinter-descriptor.yml +++ b/megalinter/descriptors/repository.megalinter-descriptor.yml @@ -137,10 +137,18 @@ linters: dockerfile: # The golang image used as a builder is a temporary workaround # Dustilock is not released as a binary or container - - | - 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 + - | + FROM --platform=$BUILDPLATFORM golang:alpine as dustilock-build + RUN mkdir temp && cd temp && go mod init temp && go get -d github.com/checkmarx/dustilock@v1.2.0 + ARG BUILDARCH + ARG TARGETARCH + RUN GOOS=linux GOARCH=${TARGETARCH} go install github.com/checkmarx/dustilock@v1.2.0 \ + && ([[ "${BUILDARCH}" == "${TARGETARCH}" ]] && mv bin/dustilock /usr/bin) || mv bin/linux_${TARGETARCH}/dustilock /usr/bin + FROM golang:alpine as dustilock + COPY --from=dustilock-build /usr/bin/dustilock /usr/bin/dustilock + # Verify Binary + RUN /usr/bin/dustilock --version + - COPY --link --from=dustilock /usr/bin/dustilock /usr/bin/dustilock supported_platforms: platform: - linux/amd64 From 43d937869829cb134be4fa0b7742cb41ec001b31 Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Thu, 20 Jul 2023 09:59:53 -0500 Subject: [PATCH 086/105] Bugfix --- Dockerfile | 30 ++++++++-------- flavors/cupcake/Dockerfile | 30 ++++++++-------- flavors/go/Dockerfile | 35 +++++++++---------- linters/go_revive/Dockerfile | 28 +++++++-------- .../descriptors/go.megalinter-descriptor.yml | 2 +- 5 files changed, 58 insertions(+), 67 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6f6cefc36cd..d2585515a66 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,6 +21,20 @@ 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 dotenvlinter/dotenv-linter:latest as dotenvlinter +FROM --platform=$BUILDPLATFORM golang:1-alpine as revive-build +## 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 mkdir temp && cd temp && go mod init temp && go get -d github.com/mgechev/revive@latest +ARG BUILDARCH +ARG TARGETARCH +RUN GOOS=linux GOARCH=${TARGETARCH} go install github.com/mgechev/revive@latest \ +&& ([[ "${BUILDARCH}" == "${TARGETARCH}" ]] && mv bin/revive /usr/bin) || mv bin/linux_${TARGETARCH}/revive /usr/bin +FROM golang:1-alpine as revive +COPY --from=revive-build /usr/bin/revive /usr/bin/revive +# Verify Binary +RUN /usr/bin/revive --version + FROM ghcr.io/yannh/kubeconform:latest-alpine as kubeconform FROM ghcr.io/assignuser/chktex-alpine:latest as chktex FROM mrtazz/checkmake:latest as checkmake @@ -850,22 +864,6 @@ esac \ && wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh \ && golangci-lint --version -# -# revive installation -## 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 -FROM --platform=$BUILDPLATFORM golang:1-alpine as revive-build -RUN mkdir temp && cd temp && go mod init temp && go get -d github.com/mgechev/revive@latest -ARG BUILDARCH -ARG TARGETARCH -RUN GOOS=linux GOARCH=${TARGETARCH} go install github.com/mgechev/revive@latest \ -&& ([[ "${BUILDARCH}" == "${TARGETARCH}" ]] && mv bin/revive /usr/bin) || mv bin/linux_${TARGETARCH}/revive /usr/bin -FROM golang:1-alpine as revive -COPY --from=revive-build /usr/bin/revive /usr/bin/revive -# Verify Binary -RUN /usr/bin/revive --version - # # checkstyle installation RUN --mount=type=secret,id=GITHUB_TOKEN CHECKSTYLE_LATEST=$(curl -s \ diff --git a/flavors/cupcake/Dockerfile b/flavors/cupcake/Dockerfile index dc2a417229d..ab954a99a22 100644 --- a/flavors/cupcake/Dockerfile +++ b/flavors/cupcake/Dockerfile @@ -22,6 +22,20 @@ 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 dotenvlinter/dotenv-linter:latest as dotenvlinter +FROM --platform=$BUILDPLATFORM golang:1-alpine as revive-build +## 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 mkdir temp && cd temp && go mod init temp && go get -d github.com/mgechev/revive@latest +ARG BUILDARCH +ARG TARGETARCH +RUN GOOS=linux GOARCH=${TARGETARCH} go install github.com/mgechev/revive@latest \ +&& ([[ "${BUILDARCH}" == "${TARGETARCH}" ]] && mv bin/revive /usr/bin) || mv bin/linux_${TARGETARCH}/revive /usr/bin +FROM golang:1-alpine as revive +COPY --from=revive-build /usr/bin/revive /usr/bin/revive +# Verify Binary +RUN /usr/bin/revive --version + FROM ghcr.io/yannh/kubeconform:latest-alpine as kubeconform FROM mrtazz/checkmake:latest as checkmake FROM ghcr.io/phpstan/phpstan:latest-php8.1 as phpstan @@ -634,22 +648,6 @@ RUN curl --retry 5 --retry-delay 5 -sLO https://raw.githubusercontent.com/clj-ko && wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh \ && golangci-lint --version -# -# revive installation -## 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 -FROM --platform=$BUILDPLATFORM golang:1-alpine as revive-build -RUN mkdir temp && cd temp && go mod init temp && go get -d github.com/mgechev/revive@latest -ARG BUILDARCH -ARG TARGETARCH -RUN GOOS=linux GOARCH=${TARGETARCH} go install github.com/mgechev/revive@latest \ -&& ([[ "${BUILDARCH}" == "${TARGETARCH}" ]] && mv bin/revive /usr/bin) || mv bin/linux_${TARGETARCH}/revive /usr/bin -FROM golang:1-alpine as revive -COPY --from=revive-build /usr/bin/revive /usr/bin/revive -# Verify Binary -RUN /usr/bin/revive --version - # # checkstyle installation RUN --mount=type=secret,id=GITHUB_TOKEN CHECKSTYLE_LATEST=$(curl -s \ diff --git a/flavors/go/Dockerfile b/flavors/go/Dockerfile index fb14b5a4b3f..6bf57b4a47f 100644 --- a/flavors/go/Dockerfile +++ b/flavors/go/Dockerfile @@ -22,6 +22,20 @@ 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 dotenvlinter/dotenv-linter:latest as dotenvlinter +FROM --platform=$BUILDPLATFORM golang:1-alpine as revive-build +## 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 mkdir temp && cd temp && go mod init temp && go get -d github.com/mgechev/revive@latest +ARG BUILDARCH +ARG TARGETARCH +RUN GOOS=linux GOARCH=${TARGETARCH} go install github.com/mgechev/revive@latest \ +&& ([[ "${BUILDARCH}" == "${TARGETARCH}" ]] && mv bin/revive /usr/bin) || mv bin/linux_${TARGETARCH}/revive /usr/bin +FROM golang:1-alpine as revive +COPY --from=revive-build /usr/bin/revive /usr/bin/revive +# Verify Binary +RUN /usr/bin/revive --version + FROM ghcr.io/yannh/kubeconform:latest-alpine as kubeconform FROM mrtazz/checkmake:latest as checkmake FROM yoheimuta/protolint:latest as protolint @@ -392,27 +406,10 @@ COPY --from=copy-collector / / #OTHER__START # golangci-lint installation RUN wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh \ - && golangci-lint --version - -# -# revive installation -## 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 -FROM --platform=$BUILDPLATFORM golang:1-alpine as revive-build -RUN mkdir temp && cd temp && go mod init temp && go get -d github.com/mgechev/revive@latest -ARG BUILDARCH -ARG TARGETARCH -RUN GOOS=linux GOARCH=${TARGETARCH} go install github.com/mgechev/revive@latest \ -&& ([[ "${BUILDARCH}" == "${TARGETARCH}" ]] && mv bin/revive /usr/bin) || mv bin/linux_${TARGETARCH}/revive /usr/bin -FROM golang:1-alpine as revive -COPY --from=revive-build /usr/bin/revive /usr/bin/revive -# Verify Binary -RUN /usr/bin/revive --version - + && golangci-lint --version \ # # ktlint installation -RUN curl --retry 5 --retry-delay 5 -sSLO https://github.com/pinterest/ktlint/releases/latest/download/ktlint && \ + && curl --retry 5 --retry-delay 5 -sSLO https://github.com/pinterest/ktlint/releases/latest/download/ktlint && \ chmod a+x ktlint && \ mv "ktlint" /usr/bin/ \ # diff --git a/linters/go_revive/Dockerfile b/linters/go_revive/Dockerfile index 393338849a1..96545050131 100644 --- a/linters/go_revive/Dockerfile +++ b/linters/go_revive/Dockerfile @@ -11,6 +11,19 @@ ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #FROM__START +FROM --platform=$BUILDPLATFORM golang:1-alpine as revive-build +## 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 mkdir temp && cd temp && go mod init temp && go get -d github.com/mgechev/revive@latest +ARG BUILDARCH +ARG TARGETARCH +RUN GOOS=linux GOARCH=${TARGETARCH} go install github.com/mgechev/revive@latest \ +&& ([[ "${BUILDARCH}" == "${TARGETARCH}" ]] && mv bin/revive /usr/bin) || mv bin/linux_${TARGETARCH}/revive /usr/bin +FROM golang:1-alpine as revive +COPY --from=revive-build /usr/bin/revive /usr/bin/revive +# Verify Binary +RUN /usr/bin/revive --version #FROM__END @@ -215,22 +228,7 @@ COPY --from=copy-collector / / ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #OTHER__START -# revive installation -## 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 -FROM --platform=$BUILDPLATFORM golang:1-alpine as revive-build -RUN mkdir temp && cd temp && go mod init temp && go get -d github.com/mgechev/revive@latest -ARG BUILDARCH -ARG TARGETARCH -RUN GOOS=linux GOARCH=${TARGETARCH} go install github.com/mgechev/revive@latest \ -&& ([[ "${BUILDARCH}" == "${TARGETARCH}" ]] && mv bin/revive /usr/bin) || mv bin/linux_${TARGETARCH}/revive /usr/bin -FROM golang:1-alpine as revive -COPY --from=revive-build /usr/bin/revive /usr/bin/revive -# Verify Binary -RUN /usr/bin/revive --version -# #OTHER__END ########################### diff --git a/megalinter/descriptors/go.megalinter-descriptor.yml b/megalinter/descriptors/go.megalinter-descriptor.yml index 2b17ea357ec..d904f5ebf06 100644 --- a/megalinter/descriptors/go.megalinter-descriptor.yml +++ b/megalinter/descriptors/go.megalinter-descriptor.yml @@ -85,10 +85,10 @@ linters: # - FROM ghcr.io/mgechev/revive:1.2.5 as revive # - COPY --link --from=revive /usr/bin/revive /usr/bin/revive - | + FROM --platform=$BUILDPLATFORM golang:1-alpine as revive-build ## 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 - FROM --platform=$BUILDPLATFORM golang:1-alpine as revive-build RUN mkdir temp && cd temp && go mod init temp && go get -d github.com/mgechev/revive@latest ARG BUILDARCH ARG TARGETARCH From 891a99e5fca308e7a27cc6d6d122d0c9f2483a8b Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Thu, 20 Jul 2023 10:53:50 -0500 Subject: [PATCH 087/105] Add wheel --- .automation/build.py | 2 +- .github/workflows/-build-docker.yml | 2 +- Dockerfile | 6 +++--- flavors/ci_light/Dockerfile | 2 +- flavors/cupcake/Dockerfile | 6 +++--- flavors/documentation/Dockerfile | 2 +- flavors/dotnet/Dockerfile | 2 +- flavors/dotnetweb/Dockerfile | 2 +- flavors/go/Dockerfile | 2 +- flavors/java/Dockerfile | 2 +- flavors/javascript/Dockerfile | 2 +- flavors/php/Dockerfile | 2 +- flavors/python/Dockerfile | 2 +- flavors/ruby/Dockerfile | 2 +- flavors/rust/Dockerfile | 6 +++--- flavors/salesforce/Dockerfile | 2 +- flavors/security/Dockerfile | 2 +- flavors/swift/Dockerfile | 2 +- flavors/terraform/Dockerfile | 2 +- linters/ansible_ansible_lint/Dockerfile | 2 +- linters/c_cpplint/Dockerfile | 2 +- linters/cloudformation_cfn_lint/Dockerfile | 2 +- linters/cpp_cpplint/Dockerfile | 2 +- linters/html_djlint/Dockerfile | 2 +- linters/python_bandit/Dockerfile | 2 +- linters/python_black/Dockerfile | 2 +- linters/python_flake8/Dockerfile | 2 +- linters/python_isort/Dockerfile | 2 +- linters/python_mypy/Dockerfile | 2 +- linters/python_pylint/Dockerfile | 2 +- linters/python_pyright/Dockerfile | 2 +- linters/repository_checkov/Dockerfile | 2 +- linters/repository_semgrep/Dockerfile | 2 +- linters/rst_rst_lint/Dockerfile | 2 +- linters/rst_rstcheck/Dockerfile | 2 +- linters/rst_rstfmt/Dockerfile | 2 +- linters/snakemake_lint/Dockerfile | 2 +- linters/snakemake_snakefmt/Dockerfile | 2 +- linters/spell_proselint/Dockerfile | 2 +- linters/sql_sqlfluff/Dockerfile | 2 +- linters/yaml_yamllint/Dockerfile | 2 +- 41 files changed, 47 insertions(+), 47 deletions(-) diff --git a/.automation/build.py b/.automation/build.py index a63495b5015..841735ddf59 100644 --- a/.automation/build.py +++ b/.automation/build.py @@ -646,7 +646,7 @@ def build_dockerfile( pipenv_download_command = ( "RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \\\n" " mkdir /download \\\n" - " && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \\\n" + " && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv wheel \\\n" ) pipenv_install_command = "" pipenv_path_command = 'ENV PATH="${PATH}"' diff --git a/.github/workflows/-build-docker.yml b/.github/workflows/-build-docker.yml index c8cc5945156..213149fa745 100644 --- a/.github/workflows/-build-docker.yml +++ b/.github/workflows/-build-docker.yml @@ -88,7 +88,7 @@ jobs: uses: docker/build-push-action@v4 with: file: ${{ inputs.dockerfile }} - platforms: linux/amd64,linux/arm64 + platforms: linux/arm64 # linux/amd64, build-args: | BUILD_DATE=${{ env.BUILD_DATE }} BUILD_REVISION=${{ github.sha }} diff --git a/Dockerfile b/Dockerfile index d2585515a66..1edc3674489 100644 --- a/Dockerfile +++ b/Dockerfile @@ -100,12 +100,12 @@ RUN rustup-init -y --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-u RUN --mount=type=cache,id=cargo-${TARGETARCH},sharing=locked,target=/cargo/.cargo/registry/,uid=63425 \ . /cargo/.cargo/env \ - && cargo binstall --no-confirm --no-symlinks shellcheck-sarif sarif-fmt --root /tmp --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") + && cargo binstall --no-confirm --no-symlinks sarif-fmt shellcheck-sarif --root /tmp --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") FROM scratch AS cargo COPY --link --from=cargo-build /tmp/bin/* /bin/ -RUN ["/bin/shellcheck-sarif", "--help"] RUN ["/bin/sarif-fmt", "--help"] +RUN ["/bin/shellcheck-sarif", "--help"] #FROM__END @@ -292,7 +292,7 @@ RUN apk add --update --no-cache \ #PIPVENV_DOWNLOAD__START RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ mkdir /download \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv wheel \ && pip download --cache-dir=/var/cache/pip --dest "/download" \ ansible-lint \ cpplint \ diff --git a/flavors/ci_light/Dockerfile b/flavors/ci_light/Dockerfile index fe898adfd8f..c0d0486ecc2 100644 --- a/flavors/ci_light/Dockerfile +++ b/flavors/ci_light/Dockerfile @@ -128,7 +128,7 @@ RUN apk add --update --no-cache \ #PIPVENV_DOWNLOAD__START RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ mkdir /download \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv wheel \ && pip download --cache-dir=/var/cache/pip --dest "/download" \ yamllint diff --git a/flavors/cupcake/Dockerfile b/flavors/cupcake/Dockerfile index ab954a99a22..2efa67a95af 100644 --- a/flavors/cupcake/Dockerfile +++ b/flavors/cupcake/Dockerfile @@ -87,12 +87,12 @@ RUN rustup-init -y --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-u RUN --mount=type=cache,id=cargo-${TARGETARCH},sharing=locked,target=/cargo/.cargo/registry/,uid=63425 \ . /cargo/.cargo/env \ - && cargo binstall --no-confirm --no-symlinks shellcheck-sarif sarif-fmt --root /tmp --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") + && cargo binstall --no-confirm --no-symlinks sarif-fmt shellcheck-sarif --root /tmp --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") FROM scratch AS cargo COPY --link --from=cargo-build /tmp/bin/* /bin/ -RUN ["/bin/shellcheck-sarif", "--help"] RUN ["/bin/sarif-fmt", "--help"] +RUN ["/bin/shellcheck-sarif", "--help"] #FROM__END @@ -261,7 +261,7 @@ RUN apk add --update --no-cache \ #PIPVENV_DOWNLOAD__START RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ mkdir /download \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv wheel \ && pip download --cache-dir=/var/cache/pip --dest "/download" \ ansible-lint \ cpplint \ diff --git a/flavors/documentation/Dockerfile b/flavors/documentation/Dockerfile index 7482202775d..23b7fe8af4a 100644 --- a/flavors/documentation/Dockerfile +++ b/flavors/documentation/Dockerfile @@ -169,7 +169,7 @@ RUN apk add --update --no-cache \ #PIPVENV_DOWNLOAD__START RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ mkdir /download \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv wheel \ && pip download --cache-dir=/var/cache/pip --dest "/download" \ ansible-lint \ djlint \ diff --git a/flavors/dotnet/Dockerfile b/flavors/dotnet/Dockerfile index fd784ee9394..6023b6d8d08 100644 --- a/flavors/dotnet/Dockerfile +++ b/flavors/dotnet/Dockerfile @@ -172,7 +172,7 @@ RUN apk add --update --no-cache \ #PIPVENV_DOWNLOAD__START RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ mkdir /download \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv wheel \ && pip download --cache-dir=/var/cache/pip --dest "/download" \ ansible-lint \ cpplint \ diff --git a/flavors/dotnetweb/Dockerfile b/flavors/dotnetweb/Dockerfile index 563eac0574d..9ad96892ce1 100644 --- a/flavors/dotnetweb/Dockerfile +++ b/flavors/dotnetweb/Dockerfile @@ -192,7 +192,7 @@ RUN apk add --update --no-cache \ #PIPVENV_DOWNLOAD__START RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ mkdir /download \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv wheel \ && pip download --cache-dir=/var/cache/pip --dest "/download" \ ansible-lint \ cpplint \ diff --git a/flavors/go/Dockerfile b/flavors/go/Dockerfile index 6bf57b4a47f..fb983ac3811 100644 --- a/flavors/go/Dockerfile +++ b/flavors/go/Dockerfile @@ -184,7 +184,7 @@ RUN apk add --update --no-cache \ #PIPVENV_DOWNLOAD__START RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ mkdir /download \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv wheel \ && pip download --cache-dir=/var/cache/pip --dest "/download" \ ansible-lint \ djlint \ diff --git a/flavors/java/Dockerfile b/flavors/java/Dockerfile index f6d8c26c827..80c66dd063e 100644 --- a/flavors/java/Dockerfile +++ b/flavors/java/Dockerfile @@ -169,7 +169,7 @@ RUN apk add --update --no-cache \ #PIPVENV_DOWNLOAD__START RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ mkdir /download \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv wheel \ && pip download --cache-dir=/var/cache/pip --dest "/download" \ ansible-lint \ djlint \ diff --git a/flavors/javascript/Dockerfile b/flavors/javascript/Dockerfile index 19823b56f79..fa173eb1601 100644 --- a/flavors/javascript/Dockerfile +++ b/flavors/javascript/Dockerfile @@ -189,7 +189,7 @@ RUN apk add --update --no-cache \ #PIPVENV_DOWNLOAD__START RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ mkdir /download \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv wheel \ && pip download --cache-dir=/var/cache/pip --dest "/download" \ ansible-lint \ djlint \ diff --git a/flavors/php/Dockerfile b/flavors/php/Dockerfile index c249094b653..057fae74618 100644 --- a/flavors/php/Dockerfile +++ b/flavors/php/Dockerfile @@ -169,7 +169,7 @@ RUN apk add --update --no-cache \ #PIPVENV_DOWNLOAD__START RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ mkdir /download \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv wheel \ && pip download --cache-dir=/var/cache/pip --dest "/download" \ ansible-lint \ djlint \ diff --git a/flavors/python/Dockerfile b/flavors/python/Dockerfile index 1a1a021c052..95e83eed911 100644 --- a/flavors/python/Dockerfile +++ b/flavors/python/Dockerfile @@ -179,7 +179,7 @@ RUN apk add --update --no-cache \ #PIPVENV_DOWNLOAD__START RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ mkdir /download \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv wheel \ && pip download --cache-dir=/var/cache/pip --dest "/download" \ ansible-lint \ djlint \ diff --git a/flavors/ruby/Dockerfile b/flavors/ruby/Dockerfile index d1b723e67e3..90ab3e7a23e 100644 --- a/flavors/ruby/Dockerfile +++ b/flavors/ruby/Dockerfile @@ -167,7 +167,7 @@ RUN apk add --update --no-cache \ #PIPVENV_DOWNLOAD__START RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ mkdir /download \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv wheel \ && pip download --cache-dir=/var/cache/pip --dest "/download" \ ansible-lint \ djlint \ diff --git a/flavors/rust/Dockerfile b/flavors/rust/Dockerfile index 56b6399a47f..362a3382efd 100644 --- a/flavors/rust/Dockerfile +++ b/flavors/rust/Dockerfile @@ -58,12 +58,12 @@ RUN rustup-init -y --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-u RUN --mount=type=cache,id=cargo-${TARGETARCH},sharing=locked,target=/cargo/.cargo/registry/,uid=63425 \ . /cargo/.cargo/env \ - && cargo binstall --no-confirm --no-symlinks shellcheck-sarif sarif-fmt --root /tmp --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") + && cargo binstall --no-confirm --no-symlinks sarif-fmt shellcheck-sarif --root /tmp --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") FROM scratch AS cargo COPY --link --from=cargo-build /tmp/bin/* /bin/ -RUN ["/bin/shellcheck-sarif", "--help"] RUN ["/bin/sarif-fmt", "--help"] +RUN ["/bin/shellcheck-sarif", "--help"] #FROM__END @@ -205,7 +205,7 @@ RUN apk add --update --no-cache \ #PIPVENV_DOWNLOAD__START RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ mkdir /download \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv wheel \ && pip download --cache-dir=/var/cache/pip --dest "/download" \ ansible-lint \ djlint \ diff --git a/flavors/salesforce/Dockerfile b/flavors/salesforce/Dockerfile index 433637b2c48..1e97228a2fb 100644 --- a/flavors/salesforce/Dockerfile +++ b/flavors/salesforce/Dockerfile @@ -170,7 +170,7 @@ RUN apk add --update --no-cache \ #PIPVENV_DOWNLOAD__START RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ mkdir /download \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv wheel \ && pip download --cache-dir=/var/cache/pip --dest "/download" \ ansible-lint \ djlint \ diff --git a/flavors/security/Dockerfile b/flavors/security/Dockerfile index 15f5923011c..42bb88d7b09 100644 --- a/flavors/security/Dockerfile +++ b/flavors/security/Dockerfile @@ -144,7 +144,7 @@ RUN apk add --update --no-cache \ #PIPVENV_DOWNLOAD__START RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ mkdir /download \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv wheel \ && pip download --cache-dir=/var/cache/pip --dest "/download" \ ansible-lint \ cfn-lint \ diff --git a/flavors/swift/Dockerfile b/flavors/swift/Dockerfile index 5f082127b20..341f001b5a0 100644 --- a/flavors/swift/Dockerfile +++ b/flavors/swift/Dockerfile @@ -167,7 +167,7 @@ RUN apk add --update --no-cache \ #PIPVENV_DOWNLOAD__START RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ mkdir /download \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv wheel \ && pip download --cache-dir=/var/cache/pip --dest "/download" \ ansible-lint \ djlint \ diff --git a/flavors/terraform/Dockerfile b/flavors/terraform/Dockerfile index 448715aec4b..4ea1f59e8c4 100644 --- a/flavors/terraform/Dockerfile +++ b/flavors/terraform/Dockerfile @@ -179,7 +179,7 @@ RUN apk add --update --no-cache \ #PIPVENV_DOWNLOAD__START RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ mkdir /download \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv wheel \ && pip download --cache-dir=/var/cache/pip --dest "/download" \ ansible-lint \ djlint \ diff --git a/linters/ansible_ansible_lint/Dockerfile b/linters/ansible_ansible_lint/Dockerfile index 27b6a7857f9..0261eb7a782 100644 --- a/linters/ansible_ansible_lint/Dockerfile +++ b/linters/ansible_ansible_lint/Dockerfile @@ -84,7 +84,7 @@ RUN apk add --update --no-cache \ #PIPVENV_DOWNLOAD__START RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ mkdir /download \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv wheel \ && pip download --cache-dir=/var/cache/pip --dest "/download" \ ansible-lint diff --git a/linters/c_cpplint/Dockerfile b/linters/c_cpplint/Dockerfile index 2ffb9c190b2..c0dec231a4e 100644 --- a/linters/c_cpplint/Dockerfile +++ b/linters/c_cpplint/Dockerfile @@ -84,7 +84,7 @@ RUN apk add --update --no-cache \ #PIPVENV_DOWNLOAD__START RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ mkdir /download \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv wheel \ && pip download --cache-dir=/var/cache/pip --dest "/download" \ cpplint diff --git a/linters/cloudformation_cfn_lint/Dockerfile b/linters/cloudformation_cfn_lint/Dockerfile index 7abdfc16c7d..d23fd9ed079 100644 --- a/linters/cloudformation_cfn_lint/Dockerfile +++ b/linters/cloudformation_cfn_lint/Dockerfile @@ -84,7 +84,7 @@ RUN apk add --update --no-cache \ #PIPVENV_DOWNLOAD__START RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ mkdir /download \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv wheel \ && pip download --cache-dir=/var/cache/pip --dest "/download" \ cfn-lint diff --git a/linters/cpp_cpplint/Dockerfile b/linters/cpp_cpplint/Dockerfile index 22c55bd7faf..478f5928f89 100644 --- a/linters/cpp_cpplint/Dockerfile +++ b/linters/cpp_cpplint/Dockerfile @@ -84,7 +84,7 @@ RUN apk add --update --no-cache \ #PIPVENV_DOWNLOAD__START RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ mkdir /download \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv wheel \ && pip download --cache-dir=/var/cache/pip --dest "/download" \ cpplint diff --git a/linters/html_djlint/Dockerfile b/linters/html_djlint/Dockerfile index 5d4e9e971f3..a4cf4f436d0 100644 --- a/linters/html_djlint/Dockerfile +++ b/linters/html_djlint/Dockerfile @@ -84,7 +84,7 @@ RUN apk add --update --no-cache \ #PIPVENV_DOWNLOAD__START RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ mkdir /download \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv wheel \ && pip download --cache-dir=/var/cache/pip --dest "/download" \ djlint diff --git a/linters/python_bandit/Dockerfile b/linters/python_bandit/Dockerfile index 2751147d20a..7ff7c1a886d 100644 --- a/linters/python_bandit/Dockerfile +++ b/linters/python_bandit/Dockerfile @@ -84,7 +84,7 @@ RUN apk add --update --no-cache \ #PIPVENV_DOWNLOAD__START RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ mkdir /download \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv wheel \ && pip download --cache-dir=/var/cache/pip --dest "/download" \ bandit \ bandit_sarif_formatter \ diff --git a/linters/python_black/Dockerfile b/linters/python_black/Dockerfile index a5ba44a00f3..1ac3c84a6f6 100644 --- a/linters/python_black/Dockerfile +++ b/linters/python_black/Dockerfile @@ -84,7 +84,7 @@ RUN apk add --update --no-cache \ #PIPVENV_DOWNLOAD__START RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ mkdir /download \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv wheel \ && pip download --cache-dir=/var/cache/pip --dest "/download" \ black diff --git a/linters/python_flake8/Dockerfile b/linters/python_flake8/Dockerfile index 0ff0c1bb76c..a87e5998bb2 100644 --- a/linters/python_flake8/Dockerfile +++ b/linters/python_flake8/Dockerfile @@ -84,7 +84,7 @@ RUN apk add --update --no-cache \ #PIPVENV_DOWNLOAD__START RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ mkdir /download \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv wheel \ && pip download --cache-dir=/var/cache/pip --dest "/download" \ flake8 diff --git a/linters/python_isort/Dockerfile b/linters/python_isort/Dockerfile index 290d14c07ed..a9a9f70db2c 100644 --- a/linters/python_isort/Dockerfile +++ b/linters/python_isort/Dockerfile @@ -84,7 +84,7 @@ RUN apk add --update --no-cache \ #PIPVENV_DOWNLOAD__START RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ mkdir /download \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv wheel \ && pip download --cache-dir=/var/cache/pip --dest "/download" \ isort \ black diff --git a/linters/python_mypy/Dockerfile b/linters/python_mypy/Dockerfile index bc045fbcadd..8c06ec54f7d 100644 --- a/linters/python_mypy/Dockerfile +++ b/linters/python_mypy/Dockerfile @@ -84,7 +84,7 @@ RUN apk add --update --no-cache \ #PIPVENV_DOWNLOAD__START RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ mkdir /download \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv wheel \ && pip download --cache-dir=/var/cache/pip --dest "/download" \ mypy diff --git a/linters/python_pylint/Dockerfile b/linters/python_pylint/Dockerfile index 995905dc29e..ce8d335c069 100644 --- a/linters/python_pylint/Dockerfile +++ b/linters/python_pylint/Dockerfile @@ -84,7 +84,7 @@ RUN apk add --update --no-cache \ #PIPVENV_DOWNLOAD__START RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ mkdir /download \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv wheel \ && pip download --cache-dir=/var/cache/pip --dest "/download" \ pylint \ typing-extensions diff --git a/linters/python_pyright/Dockerfile b/linters/python_pyright/Dockerfile index 7fc49bef591..3a4ef247f98 100644 --- a/linters/python_pyright/Dockerfile +++ b/linters/python_pyright/Dockerfile @@ -84,7 +84,7 @@ RUN apk add --update --no-cache \ #PIPVENV_DOWNLOAD__START RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ mkdir /download \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv wheel \ && pip download --cache-dir=/var/cache/pip --dest "/download" \ pyright diff --git a/linters/repository_checkov/Dockerfile b/linters/repository_checkov/Dockerfile index 92f7be0df4f..8748e27267e 100644 --- a/linters/repository_checkov/Dockerfile +++ b/linters/repository_checkov/Dockerfile @@ -86,7 +86,7 @@ RUN apk add --update --no-cache \ #PIPVENV_DOWNLOAD__START RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ mkdir /download \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv wheel \ && pip download --cache-dir=/var/cache/pip --dest "/download" \ packaging \ checkov diff --git a/linters/repository_semgrep/Dockerfile b/linters/repository_semgrep/Dockerfile index 4506620d965..53b6c8d0ef2 100644 --- a/linters/repository_semgrep/Dockerfile +++ b/linters/repository_semgrep/Dockerfile @@ -86,7 +86,7 @@ RUN apk add --update --no-cache \ #PIPVENV_DOWNLOAD__START RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ mkdir /download \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv wheel \ && pip download --cache-dir=/var/cache/pip --dest "/download" \ semgrep diff --git a/linters/rst_rst_lint/Dockerfile b/linters/rst_rst_lint/Dockerfile index 41fda829a2c..03eac6b130d 100644 --- a/linters/rst_rst_lint/Dockerfile +++ b/linters/rst_rst_lint/Dockerfile @@ -84,7 +84,7 @@ RUN apk add --update --no-cache \ #PIPVENV_DOWNLOAD__START RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ mkdir /download \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv wheel \ && pip download --cache-dir=/var/cache/pip --dest "/download" \ restructuredtext_lint diff --git a/linters/rst_rstcheck/Dockerfile b/linters/rst_rstcheck/Dockerfile index baaee166b86..106879d2ffe 100644 --- a/linters/rst_rstcheck/Dockerfile +++ b/linters/rst_rstcheck/Dockerfile @@ -84,7 +84,7 @@ RUN apk add --update --no-cache \ #PIPVENV_DOWNLOAD__START RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ mkdir /download \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv wheel \ && pip download --cache-dir=/var/cache/pip --dest "/download" \ rstcheck diff --git a/linters/rst_rstfmt/Dockerfile b/linters/rst_rstfmt/Dockerfile index e3c020709d4..01460883b8d 100644 --- a/linters/rst_rstfmt/Dockerfile +++ b/linters/rst_rstfmt/Dockerfile @@ -84,7 +84,7 @@ RUN apk add --update --no-cache \ #PIPVENV_DOWNLOAD__START RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ mkdir /download \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv wheel \ && pip download --cache-dir=/var/cache/pip --dest "/download" \ rstfmt diff --git a/linters/snakemake_lint/Dockerfile b/linters/snakemake_lint/Dockerfile index 1320a966dbb..dad7ff39629 100644 --- a/linters/snakemake_lint/Dockerfile +++ b/linters/snakemake_lint/Dockerfile @@ -84,7 +84,7 @@ RUN apk add --update --no-cache \ #PIPVENV_DOWNLOAD__START RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ mkdir /download \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv wheel \ && pip download --cache-dir=/var/cache/pip --dest "/download" \ snakemake diff --git a/linters/snakemake_snakefmt/Dockerfile b/linters/snakemake_snakefmt/Dockerfile index 77b6d31796b..05b4c7cce11 100644 --- a/linters/snakemake_snakefmt/Dockerfile +++ b/linters/snakemake_snakefmt/Dockerfile @@ -84,7 +84,7 @@ RUN apk add --update --no-cache \ #PIPVENV_DOWNLOAD__START RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ mkdir /download \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv wheel \ && pip download --cache-dir=/var/cache/pip --dest "/download" \ snakefmt diff --git a/linters/spell_proselint/Dockerfile b/linters/spell_proselint/Dockerfile index 8dd5707ca42..db74a1cf4e9 100644 --- a/linters/spell_proselint/Dockerfile +++ b/linters/spell_proselint/Dockerfile @@ -84,7 +84,7 @@ RUN apk add --update --no-cache \ #PIPVENV_DOWNLOAD__START RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ mkdir /download \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv wheel \ && pip download --cache-dir=/var/cache/pip --dest "/download" \ proselint diff --git a/linters/sql_sqlfluff/Dockerfile b/linters/sql_sqlfluff/Dockerfile index 9144b2eb010..41a5e3b6569 100644 --- a/linters/sql_sqlfluff/Dockerfile +++ b/linters/sql_sqlfluff/Dockerfile @@ -84,7 +84,7 @@ RUN apk add --update --no-cache \ #PIPVENV_DOWNLOAD__START RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ mkdir /download \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv wheel \ && pip download --cache-dir=/var/cache/pip --dest "/download" \ sqlfluff diff --git a/linters/yaml_yamllint/Dockerfile b/linters/yaml_yamllint/Dockerfile index 1573250d402..3e8581ad91f 100644 --- a/linters/yaml_yamllint/Dockerfile +++ b/linters/yaml_yamllint/Dockerfile @@ -84,7 +84,7 @@ RUN apk add --update --no-cache \ #PIPVENV_DOWNLOAD__START RUN --mount=type=cache,id=pip,sharing=locked,target=/var/cache/pip,uid=0 \ mkdir /download \ - && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv \ + && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --cache-dir=/var/cache/pip --upgrade pip crossenv wheel \ && pip download --cache-dir=/var/cache/pip --dest "/download" \ yamllint From ea0cd801b32ccb1e4c0ee906e386beb1c16c0d7b Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Mon, 24 Jul 2023 08:20:15 -0500 Subject: [PATCH 088/105] Sped up the build a bit --- Dockerfile | 47 ++++++++----------- flavors/cupcake/Dockerfile | 32 +++++++------ flavors/documentation/Dockerfile | 15 +++--- flavors/dotnet/Dockerfile | 13 ++--- flavors/dotnetweb/Dockerfile | 13 ++--- flavors/go/Dockerfile | 13 ++--- flavors/java/Dockerfile | 32 +++++++------ flavors/javascript/Dockerfile | 15 +++--- flavors/php/Dockerfile | 15 +++--- flavors/python/Dockerfile | 15 +++--- flavors/ruby/Dockerfile | 15 +++--- flavors/rust/Dockerfile | 15 +++--- flavors/salesforce/Dockerfile | 13 ++--- flavors/swift/Dockerfile | 13 ++--- flavors/terraform/Dockerfile | 15 +++--- linters/java_pmd/Dockerfile | 20 ++++---- linters/kotlin_ktlint/Dockerfile | 12 ++--- linters/lua_luacheck/Dockerfile | 17 ++----- .../java.megalinter-descriptor.yml | 4 +- .../kotlin.megalinter-descriptor.yml | 4 +- .../descriptors/lua.megalinter-descriptor.yml | 17 ++----- 21 files changed, 175 insertions(+), 180 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1edc3674489..8e58a06d4c2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -127,7 +127,21 @@ RUN curl --retry-all-errors --retry 10 -fLo coursier https://git.io/coursier-cli # # 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 \ + && chmod +x /usr/bin/bash-exec + +# +# pmd installation +ARG PMD_VERSION=6.55.0 +RUN wget --quiet https://github.com/pmd/pmd/releases/download/pmd_releases%2F${PMD_VERSION}/pmd-bin-${PMD_VERSION}.zip && \ + unzip pmd-bin-${PMD_VERSION}.zip && \ + rm pmd-bin-${PMD_VERSION}.zip && \ + mv pmd-bin-${PMD_VERSION} /usr/bin/pmd && \ + chmod +x /usr/bin/pmd/bin/run.sh \ +# +# ktlint installation + && curl --retry 5 --retry-delay 5 -sSLO https://github.com/pinterest/ktlint/releases/latest/download/ktlint && \ + chmod a+x ktlint && \ + mv "ktlint" /usr/bin/ \ # # scalafix installation && ./coursier install scalafix --quiet --install-dir /usr/bin && rm -rf /root/.cache @@ -242,6 +256,8 @@ COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker COPY --link --from=dotenvlinter /dotenv-linter /usr/bin/dotenv-linter COPY --link --from=revive /usr/bin/revive /usr/bin/revive +COPY --link --from=build-platform /usr/bin/pmd /usr/bin/pmd +COPY --link --from=build-platform /usr/bin/ktlint /usr/bin/ktlint COPY --link --from=kubeconform /kubeconform /usr/bin/ COPY --link --from=chktex /usr/bin/chktex /usr/bin/ COPY --link --from=checkmake /checkmake /usr/bin/checkmake @@ -507,7 +523,6 @@ ARG ARM_TTK_DIRECTORY='/opt/microsoft' ARG BICEP_EXE='bicep' ARG BICEP_DIR='/usr/local/bin' ARG DART_VERSION='2.8.4' -ARG PMD_VERSION=6.55.0 ARG PSSA_VERSION='latest' #ARG__END @@ -566,6 +581,8 @@ RUN apk add --no-cache \ libc6-compat \ openssl \ readline-dev \ + lua \ + luarocks \ g++ \ libc-dev \ libgcc \ @@ -877,39 +894,15 @@ RUN --mount=type=secret,id=GITHUB_TOKEN CHECKSTYLE_LATEST=$(curl -s \ --output /usr/bin/checkstyle # -# pmd installation -RUN wget --quiet https://github.com/pmd/pmd/releases/download/pmd_releases%2F${PMD_VERSION}/pmd-bin-${PMD_VERSION}.zip && \ - unzip pmd-bin-${PMD_VERSION}.zip && \ - rm pmd-bin-${PMD_VERSION}.zip && \ - mv pmd-bin-${PMD_VERSION} /usr/bin/pmd && \ - chmod +x /usr/bin/pmd/bin/run.sh \ -# -# ktlint installation - && curl --retry 5 --retry-delay 5 -sSLO https://github.com/pinterest/ktlint/releases/latest/download/ktlint && \ - chmod a+x ktlint && \ - mv "ktlint" /usr/bin/ \ -# # kubescape installation - && ln -s /lib/libc.so.6 /usr/lib/libresolv.so.2 && \ +RUN ln -s /lib/libc.so.6 /usr/lib/libresolv.so.2 && \ curl --retry 5 --retry-delay 5 -sLv https://raw.githubusercontent.com/kubescape/kubescape/master/install.sh | /bin/bash -s -- -v v2.3.6 \ # # chktex installation && cd ~ && touch .chktexrc && cd / \ # # luacheck installation - && wget --tries=5 https://www.lua.org/ftp/lua-5.3.5.tar.gz -O - -q | tar -xzf - \ - && cd lua-5.3.5 \ - && make linux \ - && make install \ - && cd .. && rm -r lua-5.3.5/ \ - && wget --tries=5 https://github.com/cvega/luarocks/archive/v3.3.1-super-linter.tar.gz -O - -q | tar -xzf - \ - && cd luarocks-3.3.1-super-linter \ - && ./configure --with-lua-include=/usr/local/include \ - && make \ - && make -b install \ - && cd .. && rm -r luarocks-3.3.1-super-linter/ \ && luarocks install luacheck \ - && cd / \ # # perlcritic installation && curl --retry 5 --retry-delay 5 -sL https://cpanmin.us/ | perl - -nq --no-wget Perl::Critic diff --git a/flavors/cupcake/Dockerfile b/flavors/cupcake/Dockerfile index 2efa67a95af..921d78099c5 100644 --- a/flavors/cupcake/Dockerfile +++ b/flavors/cupcake/Dockerfile @@ -110,6 +110,20 @@ FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform 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 +# +# pmd installation +ARG PMD_VERSION=6.55.0 +RUN wget --quiet https://github.com/pmd/pmd/releases/download/pmd_releases%2F${PMD_VERSION}/pmd-bin-${PMD_VERSION}.zip && \ + unzip pmd-bin-${PMD_VERSION}.zip && \ + rm pmd-bin-${PMD_VERSION}.zip && \ + mv pmd-bin-${PMD_VERSION} /usr/bin/pmd && \ + chmod +x /usr/bin/pmd/bin/run.sh \ +# +# ktlint installation + && curl --retry 5 --retry-delay 5 -sSLO https://github.com/pinterest/ktlint/releases/latest/download/ktlint && \ + chmod a+x ktlint && \ + mv "ktlint" /usr/bin/ + # #BUILD_PLATFORM_OTHER__END @@ -216,6 +230,8 @@ COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker COPY --link --from=dotenvlinter /dotenv-linter /usr/bin/dotenv-linter COPY --link --from=revive /usr/bin/revive /usr/bin/revive +COPY --link --from=build-platform /usr/bin/pmd /usr/bin/pmd +COPY --link --from=build-platform /usr/bin/ktlint /usr/bin/ktlint COPY --link --from=kubeconform /kubeconform /usr/bin/ COPY --link --from=checkmake /checkmake /usr/bin/checkmake COPY --link --chmod=755 --from=phpstan /composer/vendor/phpstan/phpstan/phpstan.phar /usr/bin/phpstan @@ -444,7 +460,7 @@ RUN apk add --update --no-cache libc6-compat \ ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #ARG__START -ARG PMD_VERSION=6.55.0 + #ARG__END #################### @@ -661,20 +677,8 @@ RUN --mount=type=secret,id=GITHUB_TOKEN CHECKSTYLE_LATEST=$(curl -s \ --output /usr/bin/checkstyle # -# pmd installation -RUN wget --quiet https://github.com/pmd/pmd/releases/download/pmd_releases%2F${PMD_VERSION}/pmd-bin-${PMD_VERSION}.zip && \ - unzip pmd-bin-${PMD_VERSION}.zip && \ - rm pmd-bin-${PMD_VERSION}.zip && \ - mv pmd-bin-${PMD_VERSION} /usr/bin/pmd && \ - chmod +x /usr/bin/pmd/bin/run.sh \ -# -# ktlint installation - && curl --retry 5 --retry-delay 5 -sSLO https://github.com/pinterest/ktlint/releases/latest/download/ktlint && \ - chmod a+x ktlint && \ - mv "ktlint" /usr/bin/ \ -# # kubescape installation - && ln -s /lib/libc.so.6 /usr/lib/libresolv.so.2 && \ +RUN ln -s /lib/libc.so.6 /usr/lib/libresolv.so.2 && \ curl --retry 5 --retry-delay 5 -sLv https://raw.githubusercontent.com/kubescape/kubescape/master/install.sh | /bin/bash -s -- -v v2.3.6 # diff --git a/flavors/documentation/Dockerfile b/flavors/documentation/Dockerfile index 23b7fe8af4a..e492ccfd8af 100644 --- a/flavors/documentation/Dockerfile +++ b/flavors/documentation/Dockerfile @@ -43,7 +43,12 @@ FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform #BUILD_PLATFORM_OTHER__START # bash-exec installation 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 + && chmod +x /usr/bin/bash-exec \ +# +# ktlint installation + && curl --retry 5 --retry-delay 5 -sSLO https://github.com/pinterest/ktlint/releases/latest/download/ktlint && \ + chmod a+x ktlint && \ + mv "ktlint" /usr/bin/ # #BUILD_PLATFORM_OTHER__END @@ -131,6 +136,7 @@ COPY --link --from=node_modules /node-deps /node-deps COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker COPY --link --from=dotenvlinter /dotenv-linter /usr/bin/dotenv-linter +COPY --link --from=build-platform /usr/bin/ktlint /usr/bin/ktlint COPY --link --from=kubeconform /kubeconform /usr/bin/ COPY --link --from=checkmake /checkmake /usr/bin/checkmake COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ @@ -388,13 +394,8 @@ COPY --from=copy-collector / / ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #OTHER__START -# ktlint installation -RUN curl --retry 5 --retry-delay 5 -sSLO https://github.com/pinterest/ktlint/releases/latest/download/ktlint && \ - chmod a+x ktlint && \ - mv "ktlint" /usr/bin/ \ -# # kubescape installation - && ln -s /lib/libc.so.6 /usr/lib/libresolv.so.2 && \ +RUN ln -s /lib/libc.so.6 /usr/lib/libresolv.so.2 && \ curl --retry 5 --retry-delay 5 -sLv https://raw.githubusercontent.com/kubescape/kubescape/master/install.sh | /bin/bash -s -- -v v2.3.6 \ # # grype installation diff --git a/flavors/dotnet/Dockerfile b/flavors/dotnet/Dockerfile index 6023b6d8d08..f15f04151cf 100644 --- a/flavors/dotnet/Dockerfile +++ b/flavors/dotnet/Dockerfile @@ -43,7 +43,12 @@ FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform #BUILD_PLATFORM_OTHER__START # bash-exec installation 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 + && chmod +x /usr/bin/bash-exec \ +# +# ktlint installation + && curl --retry 5 --retry-delay 5 -sSLO https://github.com/pinterest/ktlint/releases/latest/download/ktlint && \ + chmod a+x ktlint && \ + mv "ktlint" /usr/bin/ # #BUILD_PLATFORM_OTHER__END @@ -134,6 +139,7 @@ COPY --link --from=node_modules /node-deps /node-deps COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker COPY --link --from=dotenvlinter /dotenv-linter /usr/bin/dotenv-linter +COPY --link --from=build-platform /usr/bin/ktlint /usr/bin/ktlint COPY --link --from=kubeconform /kubeconform /usr/bin/ COPY --link --from=checkmake /checkmake /usr/bin/checkmake COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ @@ -485,11 +491,6 @@ esac \ # csharpier installation && /usr/share/dotnet/dotnet tool install -g csharpier \ # -# ktlint installation - && curl --retry 5 --retry-delay 5 -sSLO https://github.com/pinterest/ktlint/releases/latest/download/ktlint && \ - chmod a+x ktlint && \ - mv "ktlint" /usr/bin/ \ -# # kubescape installation && ln -s /lib/libc.so.6 /usr/lib/libresolv.so.2 && \ curl --retry 5 --retry-delay 5 -sLv https://raw.githubusercontent.com/kubescape/kubescape/master/install.sh | /bin/bash -s -- -v v2.3.6 \ diff --git a/flavors/dotnetweb/Dockerfile b/flavors/dotnetweb/Dockerfile index 9ad96892ce1..c994ac3678b 100644 --- a/flavors/dotnetweb/Dockerfile +++ b/flavors/dotnetweb/Dockerfile @@ -43,7 +43,12 @@ FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform #BUILD_PLATFORM_OTHER__START # bash-exec installation 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 + && chmod +x /usr/bin/bash-exec \ +# +# ktlint installation + && curl --retry 5 --retry-delay 5 -sSLO https://github.com/pinterest/ktlint/releases/latest/download/ktlint && \ + chmod a+x ktlint && \ + mv "ktlint" /usr/bin/ # #BUILD_PLATFORM_OTHER__END @@ -154,6 +159,7 @@ 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=dotenvlinter /dotenv-linter /usr/bin/dotenv-linter +COPY --link --from=build-platform /usr/bin/ktlint /usr/bin/ktlint COPY --link --from=kubeconform /kubeconform /usr/bin/ COPY --link --from=checkmake /checkmake /usr/bin/checkmake COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ @@ -505,11 +511,6 @@ esac \ # csharpier installation && /usr/share/dotnet/dotnet tool install -g csharpier \ # -# ktlint installation - && curl --retry 5 --retry-delay 5 -sSLO https://github.com/pinterest/ktlint/releases/latest/download/ktlint && \ - chmod a+x ktlint && \ - mv "ktlint" /usr/bin/ \ -# # kubescape installation && ln -s /lib/libc.so.6 /usr/lib/libresolv.so.2 && \ curl --retry 5 --retry-delay 5 -sLv https://raw.githubusercontent.com/kubescape/kubescape/master/install.sh | /bin/bash -s -- -v v2.3.6 \ diff --git a/flavors/go/Dockerfile b/flavors/go/Dockerfile index fb983ac3811..802e44e2172 100644 --- a/flavors/go/Dockerfile +++ b/flavors/go/Dockerfile @@ -57,7 +57,12 @@ FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform #BUILD_PLATFORM_OTHER__START # bash-exec installation 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 + && chmod +x /usr/bin/bash-exec \ +# +# ktlint installation + && curl --retry 5 --retry-delay 5 -sSLO https://github.com/pinterest/ktlint/releases/latest/download/ktlint && \ + chmod a+x ktlint && \ + mv "ktlint" /usr/bin/ # #BUILD_PLATFORM_OTHER__END @@ -146,6 +151,7 @@ COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker COPY --link --from=dotenvlinter /dotenv-linter /usr/bin/dotenv-linter COPY --link --from=revive /usr/bin/revive /usr/bin/revive +COPY --link --from=build-platform /usr/bin/ktlint /usr/bin/ktlint COPY --link --from=kubeconform /kubeconform /usr/bin/ COPY --link --from=checkmake /checkmake /usr/bin/checkmake COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ @@ -408,11 +414,6 @@ COPY --from=copy-collector / / RUN wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh \ && golangci-lint --version \ # -# ktlint installation - && curl --retry 5 --retry-delay 5 -sSLO https://github.com/pinterest/ktlint/releases/latest/download/ktlint && \ - chmod a+x ktlint && \ - mv "ktlint" /usr/bin/ \ -# # kubescape installation && ln -s /lib/libc.so.6 /usr/lib/libresolv.so.2 && \ curl --retry 5 --retry-delay 5 -sLv https://raw.githubusercontent.com/kubescape/kubescape/master/install.sh | /bin/bash -s -- -v v2.3.6 \ diff --git a/flavors/java/Dockerfile b/flavors/java/Dockerfile index 80c66dd063e..237a00ce3b0 100644 --- a/flavors/java/Dockerfile +++ b/flavors/java/Dockerfile @@ -45,6 +45,20 @@ FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform 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 +# +# pmd installation +ARG PMD_VERSION=6.55.0 +RUN wget --quiet https://github.com/pmd/pmd/releases/download/pmd_releases%2F${PMD_VERSION}/pmd-bin-${PMD_VERSION}.zip && \ + unzip pmd-bin-${PMD_VERSION}.zip && \ + rm pmd-bin-${PMD_VERSION}.zip && \ + mv pmd-bin-${PMD_VERSION} /usr/bin/pmd && \ + chmod +x /usr/bin/pmd/bin/run.sh \ +# +# ktlint installation + && curl --retry 5 --retry-delay 5 -sSLO https://github.com/pinterest/ktlint/releases/latest/download/ktlint && \ + chmod a+x ktlint && \ + mv "ktlint" /usr/bin/ + # #BUILD_PLATFORM_OTHER__END @@ -131,6 +145,8 @@ COPY --link --from=node_modules /node-deps /node-deps COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker COPY --link --from=dotenvlinter /dotenv-linter /usr/bin/dotenv-linter +COPY --link --from=build-platform /usr/bin/pmd /usr/bin/pmd +COPY --link --from=build-platform /usr/bin/ktlint /usr/bin/ktlint COPY --link --from=kubeconform /kubeconform /usr/bin/ COPY --link --from=checkmake /checkmake /usr/bin/checkmake COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ @@ -287,7 +303,7 @@ RUN apk add --update --no-cache libc6-compat \ ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #ARG__START -ARG PMD_VERSION=6.55.0 + #ARG__END #################### @@ -458,20 +474,8 @@ RUN --mount=type=secret,id=GITHUB_TOKEN CHECKSTYLE_LATEST=$(curl -s \ --output /usr/bin/checkstyle # -# pmd installation -RUN wget --quiet https://github.com/pmd/pmd/releases/download/pmd_releases%2F${PMD_VERSION}/pmd-bin-${PMD_VERSION}.zip && \ - unzip pmd-bin-${PMD_VERSION}.zip && \ - rm pmd-bin-${PMD_VERSION}.zip && \ - mv pmd-bin-${PMD_VERSION} /usr/bin/pmd && \ - chmod +x /usr/bin/pmd/bin/run.sh \ -# -# ktlint installation - && curl --retry 5 --retry-delay 5 -sSLO https://github.com/pinterest/ktlint/releases/latest/download/ktlint && \ - chmod a+x ktlint && \ - mv "ktlint" /usr/bin/ \ -# # kubescape installation - && ln -s /lib/libc.so.6 /usr/lib/libresolv.so.2 && \ +RUN ln -s /lib/libc.so.6 /usr/lib/libresolv.so.2 && \ curl --retry 5 --retry-delay 5 -sLv https://raw.githubusercontent.com/kubescape/kubescape/master/install.sh | /bin/bash -s -- -v v2.3.6 \ # # grype installation diff --git a/flavors/javascript/Dockerfile b/flavors/javascript/Dockerfile index fa173eb1601..3f2751d33be 100644 --- a/flavors/javascript/Dockerfile +++ b/flavors/javascript/Dockerfile @@ -42,7 +42,12 @@ FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform #BUILD_PLATFORM_OTHER__START # bash-exec installation 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 + && chmod +x /usr/bin/bash-exec \ +# +# ktlint installation + && curl --retry 5 --retry-delay 5 -sSLO https://github.com/pinterest/ktlint/releases/latest/download/ktlint && \ + chmod a+x ktlint && \ + mv "ktlint" /usr/bin/ # #BUILD_PLATFORM_OTHER__END @@ -152,6 +157,7 @@ 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=dotenvlinter /dotenv-linter /usr/bin/dotenv-linter +COPY --link --from=build-platform /usr/bin/ktlint /usr/bin/ktlint COPY --link --from=kubeconform /kubeconform /usr/bin/ COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ @@ -408,13 +414,8 @@ COPY --from=copy-collector / / ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #OTHER__START -# ktlint installation -RUN curl --retry 5 --retry-delay 5 -sSLO https://github.com/pinterest/ktlint/releases/latest/download/ktlint && \ - chmod a+x ktlint && \ - mv "ktlint" /usr/bin/ \ -# # kubescape installation - && ln -s /lib/libc.so.6 /usr/lib/libresolv.so.2 && \ +RUN ln -s /lib/libc.so.6 /usr/lib/libresolv.so.2 && \ curl --retry 5 --retry-delay 5 -sLv https://raw.githubusercontent.com/kubescape/kubescape/master/install.sh | /bin/bash -s -- -v v2.3.6 \ # # grype installation diff --git a/flavors/php/Dockerfile b/flavors/php/Dockerfile index 057fae74618..8beeb7bcb75 100644 --- a/flavors/php/Dockerfile +++ b/flavors/php/Dockerfile @@ -43,7 +43,12 @@ FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform #BUILD_PLATFORM_OTHER__START # bash-exec installation 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 + && chmod +x /usr/bin/bash-exec \ +# +# ktlint installation + && curl --retry 5 --retry-delay 5 -sSLO https://github.com/pinterest/ktlint/releases/latest/download/ktlint && \ + chmod a+x ktlint && \ + mv "ktlint" /usr/bin/ # #BUILD_PLATFORM_OTHER__END @@ -131,6 +136,7 @@ COPY --link --from=node_modules /node-deps /node-deps COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker COPY --link --from=dotenvlinter /dotenv-linter /usr/bin/dotenv-linter +COPY --link --from=build-platform /usr/bin/ktlint /usr/bin/ktlint COPY --link --from=kubeconform /kubeconform /usr/bin/ COPY --link --chmod=755 --from=phpstan /composer/vendor/phpstan/phpstan/phpstan.phar /usr/bin/phpstan COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ @@ -416,13 +422,8 @@ RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GI && update-alternatives --install /usr/bin/php php /usr/bin/php81 110 # -# ktlint installation -RUN curl --retry 5 --retry-delay 5 -sSLO https://github.com/pinterest/ktlint/releases/latest/download/ktlint && \ - chmod a+x ktlint && \ - mv "ktlint" /usr/bin/ \ -# # kubescape installation - && ln -s /lib/libc.so.6 /usr/lib/libresolv.so.2 && \ +RUN ln -s /lib/libc.so.6 /usr/lib/libresolv.so.2 && \ curl --retry 5 --retry-delay 5 -sLv https://raw.githubusercontent.com/kubescape/kubescape/master/install.sh | /bin/bash -s -- -v v2.3.6 # diff --git a/flavors/python/Dockerfile b/flavors/python/Dockerfile index 95e83eed911..f786db1ea74 100644 --- a/flavors/python/Dockerfile +++ b/flavors/python/Dockerfile @@ -52,7 +52,12 @@ FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform #BUILD_PLATFORM_OTHER__START # bash-exec installation 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 + && chmod +x /usr/bin/bash-exec \ +# +# ktlint installation + && curl --retry 5 --retry-delay 5 -sSLO https://github.com/pinterest/ktlint/releases/latest/download/ktlint && \ + chmod a+x ktlint && \ + mv "ktlint" /usr/bin/ # #BUILD_PLATFORM_OTHER__END @@ -140,6 +145,7 @@ COPY --link --from=node_modules /node-deps /node-deps COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker COPY --link --from=dotenvlinter /dotenv-linter /usr/bin/dotenv-linter +COPY --link --from=build-platform /usr/bin/ktlint /usr/bin/ktlint COPY --link --from=kubeconform /kubeconform /usr/bin/ COPY --link --from=checkmake /checkmake /usr/bin/checkmake COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ @@ -472,13 +478,8 @@ COPY --from=copy-collector / / ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #OTHER__START -# ktlint installation -RUN curl --retry 5 --retry-delay 5 -sSLO https://github.com/pinterest/ktlint/releases/latest/download/ktlint && \ - chmod a+x ktlint && \ - mv "ktlint" /usr/bin/ \ -# # kubescape installation - && ln -s /lib/libc.so.6 /usr/lib/libresolv.so.2 && \ +RUN ln -s /lib/libc.so.6 /usr/lib/libresolv.so.2 && \ curl --retry 5 --retry-delay 5 -sLv https://raw.githubusercontent.com/kubescape/kubescape/master/install.sh | /bin/bash -s -- -v v2.3.6 # diff --git a/flavors/ruby/Dockerfile b/flavors/ruby/Dockerfile index 90ab3e7a23e..b7e0422909e 100644 --- a/flavors/ruby/Dockerfile +++ b/flavors/ruby/Dockerfile @@ -42,7 +42,12 @@ FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform #BUILD_PLATFORM_OTHER__START # bash-exec installation 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 + && chmod +x /usr/bin/bash-exec \ +# +# ktlint installation + && curl --retry 5 --retry-delay 5 -sSLO https://github.com/pinterest/ktlint/releases/latest/download/ktlint && \ + chmod a+x ktlint && \ + mv "ktlint" /usr/bin/ # #BUILD_PLATFORM_OTHER__END @@ -130,6 +135,7 @@ COPY --link --from=node_modules /node-deps /node-deps COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker COPY --link --from=dotenvlinter /dotenv-linter /usr/bin/dotenv-linter +COPY --link --from=build-platform /usr/bin/ktlint /usr/bin/ktlint COPY --link --from=kubeconform /kubeconform /usr/bin/ COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ @@ -392,13 +398,8 @@ COPY --from=copy-collector / / ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #OTHER__START -# ktlint installation -RUN curl --retry 5 --retry-delay 5 -sSLO https://github.com/pinterest/ktlint/releases/latest/download/ktlint && \ - chmod a+x ktlint && \ - mv "ktlint" /usr/bin/ \ -# # kubescape installation - && ln -s /lib/libc.so.6 /usr/lib/libresolv.so.2 && \ +RUN ln -s /lib/libc.so.6 /usr/lib/libresolv.so.2 && \ curl --retry 5 --retry-delay 5 -sLv https://raw.githubusercontent.com/kubescape/kubescape/master/install.sh | /bin/bash -s -- -v v2.3.6 \ # # grype installation diff --git a/flavors/rust/Dockerfile b/flavors/rust/Dockerfile index 362a3382efd..b02adc78e04 100644 --- a/flavors/rust/Dockerfile +++ b/flavors/rust/Dockerfile @@ -79,7 +79,12 @@ FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform #BUILD_PLATFORM_OTHER__START # bash-exec installation 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 + && chmod +x /usr/bin/bash-exec \ +# +# ktlint installation + && curl --retry 5 --retry-delay 5 -sSLO https://github.com/pinterest/ktlint/releases/latest/download/ktlint && \ + chmod a+x ktlint && \ + mv "ktlint" /usr/bin/ # #BUILD_PLATFORM_OTHER__END @@ -167,6 +172,7 @@ COPY --link --from=node_modules /node-deps /node-deps COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker COPY --link --from=dotenvlinter /dotenv-linter /usr/bin/dotenv-linter +COPY --link --from=build-platform /usr/bin/ktlint /usr/bin/ktlint COPY --link --from=kubeconform /kubeconform /usr/bin/ COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ @@ -428,13 +434,8 @@ COPY --from=copy-collector / / ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #OTHER__START -# ktlint installation -RUN curl --retry 5 --retry-delay 5 -sSLO https://github.com/pinterest/ktlint/releases/latest/download/ktlint && \ - chmod a+x ktlint && \ - mv "ktlint" /usr/bin/ \ -# # kubescape installation - && ln -s /lib/libc.so.6 /usr/lib/libresolv.so.2 && \ +RUN ln -s /lib/libc.so.6 /usr/lib/libresolv.so.2 && \ curl --retry 5 --retry-delay 5 -sLv https://raw.githubusercontent.com/kubescape/kubescape/master/install.sh | /bin/bash -s -- -v v2.3.6 \ # # grype installation diff --git a/flavors/salesforce/Dockerfile b/flavors/salesforce/Dockerfile index 1e97228a2fb..9d188f1303f 100644 --- a/flavors/salesforce/Dockerfile +++ b/flavors/salesforce/Dockerfile @@ -42,7 +42,12 @@ FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform #BUILD_PLATFORM_OTHER__START # bash-exec installation 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 + && chmod +x /usr/bin/bash-exec \ +# +# ktlint installation + && curl --retry 5 --retry-delay 5 -sSLO https://github.com/pinterest/ktlint/releases/latest/download/ktlint && \ + chmod a+x ktlint && \ + mv "ktlint" /usr/bin/ # #BUILD_PLATFORM_OTHER__END @@ -133,6 +138,7 @@ 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=dotenvlinter /dotenv-linter /usr/bin/dotenv-linter +COPY --link --from=build-platform /usr/bin/ktlint /usr/bin/ktlint COPY --link --from=kubeconform /kubeconform /usr/bin/ COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ @@ -396,11 +402,6 @@ RUN echo y|sfdx plugins:install sfdx-hardis \ && npm cache clean --force || true \ && rm -rf /root/.npm/_cacache \ # -# ktlint installation - && curl --retry 5 --retry-delay 5 -sSLO https://github.com/pinterest/ktlint/releases/latest/download/ktlint && \ - chmod a+x ktlint && \ - mv "ktlint" /usr/bin/ \ -# # kubescape installation && ln -s /lib/libc.so.6 /usr/lib/libresolv.so.2 && \ curl --retry 5 --retry-delay 5 -sLv https://raw.githubusercontent.com/kubescape/kubescape/master/install.sh | /bin/bash -s -- -v v2.3.6 \ diff --git a/flavors/swift/Dockerfile b/flavors/swift/Dockerfile index 341f001b5a0..510d9c12c42 100644 --- a/flavors/swift/Dockerfile +++ b/flavors/swift/Dockerfile @@ -42,7 +42,12 @@ FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform #BUILD_PLATFORM_OTHER__START # bash-exec installation 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 + && chmod +x /usr/bin/bash-exec \ +# +# ktlint installation + && curl --retry 5 --retry-delay 5 -sSLO https://github.com/pinterest/ktlint/releases/latest/download/ktlint && \ + chmod a+x ktlint && \ + mv "ktlint" /usr/bin/ # #BUILD_PLATFORM_OTHER__END @@ -130,6 +135,7 @@ COPY --link --from=node_modules /node-deps /node-deps COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker COPY --link --from=dotenvlinter /dotenv-linter /usr/bin/dotenv-linter +COPY --link --from=build-platform /usr/bin/ktlint /usr/bin/ktlint COPY --link --from=kubeconform /kubeconform /usr/bin/ COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ @@ -389,11 +395,6 @@ COPY --from=copy-collector / / ############################################################################################# #OTHER__START RUN rc-update add docker boot && rc-service docker start || true \ -# ktlint installation - && curl --retry 5 --retry-delay 5 -sSLO https://github.com/pinterest/ktlint/releases/latest/download/ktlint && \ - chmod a+x ktlint && \ - mv "ktlint" /usr/bin/ \ -# # kubescape installation && ln -s /lib/libc.so.6 /usr/lib/libresolv.so.2 && \ curl --retry 5 --retry-delay 5 -sLv https://raw.githubusercontent.com/kubescape/kubescape/master/install.sh | /bin/bash -s -- -v v2.3.6 \ diff --git a/flavors/terraform/Dockerfile b/flavors/terraform/Dockerfile index 4ea1f59e8c4..f0e58cdd300 100644 --- a/flavors/terraform/Dockerfile +++ b/flavors/terraform/Dockerfile @@ -48,7 +48,12 @@ FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform #BUILD_PLATFORM_OTHER__START # bash-exec installation 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 + && chmod +x /usr/bin/bash-exec \ +# +# ktlint installation + && curl --retry 5 --retry-delay 5 -sSLO https://github.com/pinterest/ktlint/releases/latest/download/ktlint && \ + chmod a+x ktlint && \ + mv "ktlint" /usr/bin/ # #BUILD_PLATFORM_OTHER__END @@ -136,6 +141,7 @@ COPY --link --from=node_modules /node-deps /node-deps COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint COPY --link --from=editorconfig-checker /usr/bin/ec /usr/bin/editorconfig-checker COPY --link --from=dotenvlinter /dotenv-linter /usr/bin/dotenv-linter +COPY --link --from=build-platform /usr/bin/ktlint /usr/bin/ktlint COPY --link --from=kubeconform /kubeconform /usr/bin/ COPY --link --from=protolint /usr/local/bin/protolint /usr/bin/ COPY --link --from=gitleaks /usr/bin/gitleaks /usr/bin/ @@ -398,13 +404,8 @@ COPY --from=copy-collector / / ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #OTHER__START -# ktlint installation -RUN curl --retry 5 --retry-delay 5 -sSLO https://github.com/pinterest/ktlint/releases/latest/download/ktlint && \ - chmod a+x ktlint && \ - mv "ktlint" /usr/bin/ \ -# # kubescape installation - && ln -s /lib/libc.so.6 /usr/lib/libresolv.so.2 && \ +RUN ln -s /lib/libc.so.6 /usr/lib/libresolv.so.2 && \ curl --retry 5 --retry-delay 5 -sLv https://raw.githubusercontent.com/kubescape/kubescape/master/install.sh | /bin/bash -s -- -v v2.3.6 \ # # grype installation diff --git a/linters/java_pmd/Dockerfile b/linters/java_pmd/Dockerfile index 4761ce9597f..09a1cfd7b31 100644 --- a/linters/java_pmd/Dockerfile +++ b/linters/java_pmd/Dockerfile @@ -24,7 +24,15 @@ FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform #BUILD_PLATFORM_APK__END #BUILD_PLATFORM_OTHER__START +# pmd installation +ARG PMD_VERSION=6.55.0 +RUN wget --quiet https://github.com/pmd/pmd/releases/download/pmd_releases%2F${PMD_VERSION}/pmd-bin-${PMD_VERSION}.zip && \ + unzip pmd-bin-${PMD_VERSION}.zip && \ + rm pmd-bin-${PMD_VERSION}.zip && \ + mv pmd-bin-${PMD_VERSION} /usr/bin/pmd && \ + chmod +x /usr/bin/pmd/bin/run.sh +# #BUILD_PLATFORM_OTHER__END FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules @@ -54,7 +62,7 @@ FROM scratch AS copy-collector ############################################################################################# #COPY__START - +COPY --link --from=build-platform /usr/bin/pmd /usr/bin/pmd #COPY__END ####################################### @@ -134,7 +142,7 @@ RUN apk add --update --no-cache libc6-compat \ ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #ARG__START -ARG PMD_VERSION=6.55.0 + #ARG__END #################### @@ -219,14 +227,6 @@ COPY --from=copy-collector / / # JAVA installation ENV JAVA_HOME=/usr/lib/jvm/java-11-openjdk ENV PATH="$JAVA_HOME/bin:${PATH}" -# -# pmd installation -RUN wget --quiet https://github.com/pmd/pmd/releases/download/pmd_releases%2F${PMD_VERSION}/pmd-bin-${PMD_VERSION}.zip && \ - unzip pmd-bin-${PMD_VERSION}.zip && \ - rm pmd-bin-${PMD_VERSION}.zip && \ - mv pmd-bin-${PMD_VERSION} /usr/bin/pmd && \ - chmod +x /usr/bin/pmd/bin/run.sh - # #OTHER__END diff --git a/linters/kotlin_ktlint/Dockerfile b/linters/kotlin_ktlint/Dockerfile index 656a80ca205..29e2c883968 100644 --- a/linters/kotlin_ktlint/Dockerfile +++ b/linters/kotlin_ktlint/Dockerfile @@ -24,7 +24,12 @@ FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform #BUILD_PLATFORM_APK__END #BUILD_PLATFORM_OTHER__START +# ktlint installation +RUN curl --retry 5 --retry-delay 5 -sSLO https://github.com/pinterest/ktlint/releases/latest/download/ktlint && \ + chmod a+x ktlint && \ + mv "ktlint" /usr/bin/ +# #BUILD_PLATFORM_OTHER__END FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules @@ -54,7 +59,7 @@ FROM scratch AS copy-collector ############################################################################################# #COPY__START - +COPY --link --from=build-platform /usr/bin/ktlint /usr/bin/ktlint #COPY__END ####################################### @@ -216,12 +221,7 @@ COPY --from=copy-collector / / ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #OTHER__START -# ktlint installation -RUN curl --retry 5 --retry-delay 5 -sSLO https://github.com/pinterest/ktlint/releases/latest/download/ktlint && \ - chmod a+x ktlint && \ - mv "ktlint" /usr/bin/ -# #OTHER__END ########################### diff --git a/linters/lua_luacheck/Dockerfile b/linters/lua_luacheck/Dockerfile index 9b2f5913405..6243afdcf69 100644 --- a/linters/lua_luacheck/Dockerfile +++ b/linters/lua_luacheck/Dockerfile @@ -160,6 +160,8 @@ RUN apk add --no-cache \ openssh \ openssl \ readline-dev \ + lua \ + luarocks \ && git config --global core.autocrlf true #APK__END @@ -218,20 +220,7 @@ COPY --from=copy-collector / / ############################################################################################# #OTHER__START # luacheck installation -RUN wget --tries=5 https://www.lua.org/ftp/lua-5.3.5.tar.gz -O - -q | tar -xzf - \ - && cd lua-5.3.5 \ - && make linux \ - && make install \ - && cd .. && rm -r lua-5.3.5/ \ - && wget --tries=5 https://github.com/cvega/luarocks/archive/v3.3.1-super-linter.tar.gz -O - -q | tar -xzf - \ - && cd luarocks-3.3.1-super-linter \ - && ./configure --with-lua-include=/usr/local/include \ - && make \ - && make -b install \ - && cd .. && rm -r luarocks-3.3.1-super-linter/ \ - && luarocks install luacheck \ - && cd / - +RUN luarocks install luacheck # #OTHER__END diff --git a/megalinter/descriptors/java.megalinter-descriptor.yml b/megalinter/descriptors/java.megalinter-descriptor.yml index c3ba5a3eb59..26de25365e3 100644 --- a/megalinter/descriptors/java.megalinter-descriptor.yml +++ b/megalinter/descriptors/java.megalinter-descriptor.yml @@ -99,7 +99,7 @@ linters: - "pmd --rulesets java-pmd-ruleset.xml --file-list /tmp/list-off-files-generated-by-megalinter.txt" - "pmd --rulesets java-pmd-ruleset.xml --dir /path/to/sources" install: - dockerfile: + build_platform_dockerfile: - ARG PMD_VERSION=6.55.0 - | RUN wget --quiet https://github.com/pmd/pmd/releases/download/pmd_releases%2F${PMD_VERSION}/pmd-bin-${PMD_VERSION}.zip && \ @@ -107,6 +107,8 @@ linters: rm pmd-bin-${PMD_VERSION}.zip && \ mv pmd-bin-${PMD_VERSION} /usr/bin/pmd && \ chmod +x /usr/bin/pmd/bin/run.sh + dockerfile: + - COPY --link --from=build-platform /usr/bin/pmd /usr/bin/pmd supported_platforms: platform: - linux/amd64 diff --git a/megalinter/descriptors/kotlin.megalinter-descriptor.yml b/megalinter/descriptors/kotlin.megalinter-descriptor.yml index 8791b017056..fc21f07eee6 100644 --- a/megalinter/descriptors/kotlin.megalinter-descriptor.yml +++ b/megalinter/descriptors/kotlin.megalinter-descriptor.yml @@ -25,11 +25,13 @@ linters: - "ktlint myfile.kt" - "ktlint --format myfile.kt" install: - dockerfile: + build_platform_dockerfile: - | RUN curl --retry 5 --retry-delay 5 -sSLO https://github.com/pinterest/ktlint/releases/latest/download/ktlint && \ chmod a+x ktlint && \ mv "ktlint" /usr/bin/ + dockerfile: + - COPY --link --from=build-platform /usr/bin/ktlint /usr/bin/ktlint supported_platforms: platform: - linux/amd64 diff --git a/megalinter/descriptors/lua.megalinter-descriptor.yml b/megalinter/descriptors/lua.megalinter-descriptor.yml index a7fdd91c6da..7386fdadaf1 100644 --- a/megalinter/descriptors/lua.megalinter-descriptor.yml +++ b/megalinter/descriptors/lua.megalinter-descriptor.yml @@ -20,21 +20,10 @@ linters: apk: - openssl - readline-dev + - lua + - luarocks dockerfile: - - | - RUN wget --tries=5 https://www.lua.org/ftp/lua-5.3.5.tar.gz -O - -q | tar -xzf - \ - && cd lua-5.3.5 \ - && make linux \ - && make install \ - && cd .. && rm -r lua-5.3.5/ \ - && wget --tries=5 https://github.com/cvega/luarocks/archive/v3.3.1-super-linter.tar.gz -O - -q | tar -xzf - \ - && cd luarocks-3.3.1-super-linter \ - && ./configure --with-lua-include=/usr/local/include \ - && make \ - && make -b install \ - && cd .. && rm -r luarocks-3.3.1-super-linter/ \ - && luarocks install luacheck \ - && cd / + - RUN luarocks install luacheck supported_platforms: platform: - linux/amd64 From 4e568bd83b4ffafaed08ba590bc0c873272216ee Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Mon, 24 Jul 2023 16:27:08 -0500 Subject: [PATCH 089/105] Bugfix --- Dockerfile | 6 +++--- flavors/cupcake/Dockerfile | 4 ++-- flavors/rust/Dockerfile | 4 ++-- linters/lua_luacheck/Dockerfile | 2 +- megalinter/descriptors/lua.megalinter-descriptor.yml | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8e58a06d4c2..6df86456b7a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -100,12 +100,12 @@ RUN rustup-init -y --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-u RUN --mount=type=cache,id=cargo-${TARGETARCH},sharing=locked,target=/cargo/.cargo/registry/,uid=63425 \ . /cargo/.cargo/env \ - && cargo binstall --no-confirm --no-symlinks sarif-fmt shellcheck-sarif --root /tmp --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") + && cargo binstall --no-confirm --no-symlinks shellcheck-sarif sarif-fmt --root /tmp --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") FROM scratch AS cargo COPY --link --from=cargo-build /tmp/bin/* /bin/ -RUN ["/bin/sarif-fmt", "--help"] RUN ["/bin/shellcheck-sarif", "--help"] +RUN ["/bin/sarif-fmt", "--help"] #FROM__END @@ -902,7 +902,7 @@ RUN ln -s /lib/libc.so.6 /usr/lib/libresolv.so.2 && \ && cd ~ && touch .chktexrc && cd / \ # # luacheck installation - && luarocks install luacheck \ + && luarocks-5.4 install luacheck \ # # perlcritic installation && curl --retry 5 --retry-delay 5 -sL https://cpanmin.us/ | perl - -nq --no-wget Perl::Critic diff --git a/flavors/cupcake/Dockerfile b/flavors/cupcake/Dockerfile index 921d78099c5..4e9b165455e 100644 --- a/flavors/cupcake/Dockerfile +++ b/flavors/cupcake/Dockerfile @@ -87,12 +87,12 @@ RUN rustup-init -y --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-u RUN --mount=type=cache,id=cargo-${TARGETARCH},sharing=locked,target=/cargo/.cargo/registry/,uid=63425 \ . /cargo/.cargo/env \ - && cargo binstall --no-confirm --no-symlinks sarif-fmt shellcheck-sarif --root /tmp --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") + && cargo binstall --no-confirm --no-symlinks shellcheck-sarif sarif-fmt --root /tmp --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") FROM scratch AS cargo COPY --link --from=cargo-build /tmp/bin/* /bin/ -RUN ["/bin/sarif-fmt", "--help"] RUN ["/bin/shellcheck-sarif", "--help"] +RUN ["/bin/sarif-fmt", "--help"] #FROM__END diff --git a/flavors/rust/Dockerfile b/flavors/rust/Dockerfile index b02adc78e04..6a3e3ba709d 100644 --- a/flavors/rust/Dockerfile +++ b/flavors/rust/Dockerfile @@ -58,12 +58,12 @@ RUN rustup-init -y --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-u RUN --mount=type=cache,id=cargo-${TARGETARCH},sharing=locked,target=/cargo/.cargo/registry/,uid=63425 \ . /cargo/.cargo/env \ - && cargo binstall --no-confirm --no-symlinks sarif-fmt shellcheck-sarif --root /tmp --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") + && cargo binstall --no-confirm --no-symlinks shellcheck-sarif sarif-fmt --root /tmp --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") FROM scratch AS cargo COPY --link --from=cargo-build /tmp/bin/* /bin/ -RUN ["/bin/sarif-fmt", "--help"] RUN ["/bin/shellcheck-sarif", "--help"] +RUN ["/bin/sarif-fmt", "--help"] #FROM__END diff --git a/linters/lua_luacheck/Dockerfile b/linters/lua_luacheck/Dockerfile index 6243afdcf69..a277451b352 100644 --- a/linters/lua_luacheck/Dockerfile +++ b/linters/lua_luacheck/Dockerfile @@ -220,7 +220,7 @@ COPY --from=copy-collector / / ############################################################################################# #OTHER__START # luacheck installation -RUN luarocks install luacheck +RUN luarocks-5.4 install luacheck # #OTHER__END diff --git a/megalinter/descriptors/lua.megalinter-descriptor.yml b/megalinter/descriptors/lua.megalinter-descriptor.yml index 7386fdadaf1..9e47431eb32 100644 --- a/megalinter/descriptors/lua.megalinter-descriptor.yml +++ b/megalinter/descriptors/lua.megalinter-descriptor.yml @@ -23,7 +23,7 @@ linters: - lua - luarocks dockerfile: - - RUN luarocks install luacheck + - RUN luarocks-5.4 install luacheck supported_platforms: platform: - linux/amd64 From 77c91376fe7c14409086d2a37e34ab2d390fb7d1 Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Mon, 24 Jul 2023 17:13:30 -0500 Subject: [PATCH 090/105] Bugfix --- Dockerfile | 2 +- linters/lua_luacheck/Dockerfile | 2 +- megalinter/descriptors/lua.megalinter-descriptor.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6df86456b7a..c228c6c28b7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -902,7 +902,7 @@ RUN ln -s /lib/libc.so.6 /usr/lib/libresolv.so.2 && \ && cd ~ && touch .chktexrc && cd / \ # # luacheck installation - && luarocks-5.4 install luacheck \ + && luarocks5.4 install luacheck \ # # perlcritic installation && curl --retry 5 --retry-delay 5 -sL https://cpanmin.us/ | perl - -nq --no-wget Perl::Critic diff --git a/linters/lua_luacheck/Dockerfile b/linters/lua_luacheck/Dockerfile index a277451b352..a811bbe656b 100644 --- a/linters/lua_luacheck/Dockerfile +++ b/linters/lua_luacheck/Dockerfile @@ -220,7 +220,7 @@ COPY --from=copy-collector / / ############################################################################################# #OTHER__START # luacheck installation -RUN luarocks-5.4 install luacheck +RUN luarocks5.4 install luacheck # #OTHER__END diff --git a/megalinter/descriptors/lua.megalinter-descriptor.yml b/megalinter/descriptors/lua.megalinter-descriptor.yml index 9e47431eb32..26702792d00 100644 --- a/megalinter/descriptors/lua.megalinter-descriptor.yml +++ b/megalinter/descriptors/lua.megalinter-descriptor.yml @@ -23,7 +23,7 @@ linters: - lua - luarocks dockerfile: - - RUN luarocks-5.4 install luacheck + - RUN luarocks5.4 install luacheck supported_platforms: platform: - linux/amd64 From c127f101bee0c5aef751645e90fec7a3e270d65c Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Tue, 25 Jul 2023 08:18:14 -0500 Subject: [PATCH 091/105] Fix luacheck install --- Dockerfile | 11 ++++++----- flavors/cupcake/Dockerfile | 4 ++-- flavors/rust/Dockerfile | 4 ++-- linters/lua_luacheck/Dockerfile | 7 ++++--- megalinter/descriptors/lua.megalinter-descriptor.yml | 9 ++++++--- 5 files changed, 20 insertions(+), 15 deletions(-) diff --git a/Dockerfile b/Dockerfile index c228c6c28b7..ff7d887f5db 100644 --- a/Dockerfile +++ b/Dockerfile @@ -100,12 +100,12 @@ RUN rustup-init -y --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-u RUN --mount=type=cache,id=cargo-${TARGETARCH},sharing=locked,target=/cargo/.cargo/registry/,uid=63425 \ . /cargo/.cargo/env \ - && cargo binstall --no-confirm --no-symlinks shellcheck-sarif sarif-fmt --root /tmp --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") + && cargo binstall --no-confirm --no-symlinks sarif-fmt shellcheck-sarif --root /tmp --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") FROM scratch AS cargo COPY --link --from=cargo-build /tmp/bin/* /bin/ -RUN ["/bin/shellcheck-sarif", "--help"] RUN ["/bin/sarif-fmt", "--help"] +RUN ["/bin/shellcheck-sarif", "--help"] #FROM__END @@ -581,8 +581,9 @@ RUN apk add --no-cache \ libc6-compat \ openssl \ readline-dev \ - lua \ - luarocks \ + lua5.3 \ + lua5.3-dev \ + luarocks5.3 \ g++ \ libc-dev \ libgcc \ @@ -902,7 +903,7 @@ RUN ln -s /lib/libc.so.6 /usr/lib/libresolv.so.2 && \ && cd ~ && touch .chktexrc && cd / \ # # luacheck installation - && luarocks5.4 install luacheck \ + && luarocks-5.3 install luacheck \ # # perlcritic installation && curl --retry 5 --retry-delay 5 -sL https://cpanmin.us/ | perl - -nq --no-wget Perl::Critic diff --git a/flavors/cupcake/Dockerfile b/flavors/cupcake/Dockerfile index 4e9b165455e..921d78099c5 100644 --- a/flavors/cupcake/Dockerfile +++ b/flavors/cupcake/Dockerfile @@ -87,12 +87,12 @@ RUN rustup-init -y --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-u RUN --mount=type=cache,id=cargo-${TARGETARCH},sharing=locked,target=/cargo/.cargo/registry/,uid=63425 \ . /cargo/.cargo/env \ - && cargo binstall --no-confirm --no-symlinks shellcheck-sarif sarif-fmt --root /tmp --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") + && cargo binstall --no-confirm --no-symlinks sarif-fmt shellcheck-sarif --root /tmp --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") FROM scratch AS cargo COPY --link --from=cargo-build /tmp/bin/* /bin/ -RUN ["/bin/shellcheck-sarif", "--help"] RUN ["/bin/sarif-fmt", "--help"] +RUN ["/bin/shellcheck-sarif", "--help"] #FROM__END diff --git a/flavors/rust/Dockerfile b/flavors/rust/Dockerfile index 6a3e3ba709d..b02adc78e04 100644 --- a/flavors/rust/Dockerfile +++ b/flavors/rust/Dockerfile @@ -58,12 +58,12 @@ RUN rustup-init -y --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-u RUN --mount=type=cache,id=cargo-${TARGETARCH},sharing=locked,target=/cargo/.cargo/registry/,uid=63425 \ . /cargo/.cargo/env \ - && cargo binstall --no-confirm --no-symlinks shellcheck-sarif sarif-fmt --root /tmp --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") + && cargo binstall --no-confirm --no-symlinks sarif-fmt shellcheck-sarif --root /tmp --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") FROM scratch AS cargo COPY --link --from=cargo-build /tmp/bin/* /bin/ -RUN ["/bin/shellcheck-sarif", "--help"] RUN ["/bin/sarif-fmt", "--help"] +RUN ["/bin/shellcheck-sarif", "--help"] #FROM__END diff --git a/linters/lua_luacheck/Dockerfile b/linters/lua_luacheck/Dockerfile index a811bbe656b..4e7c2fdbc45 100644 --- a/linters/lua_luacheck/Dockerfile +++ b/linters/lua_luacheck/Dockerfile @@ -160,8 +160,9 @@ RUN apk add --no-cache \ openssh \ openssl \ readline-dev \ - lua \ - luarocks \ + lua5.3 \ + lua5.3-dev \ + luarocks5.3 \ && git config --global core.autocrlf true #APK__END @@ -220,7 +221,7 @@ COPY --from=copy-collector / / ############################################################################################# #OTHER__START # luacheck installation -RUN luarocks5.4 install luacheck +RUN luarocks-5.3 install luacheck # #OTHER__END diff --git a/megalinter/descriptors/lua.megalinter-descriptor.yml b/megalinter/descriptors/lua.megalinter-descriptor.yml index 26702792d00..aefe1cacdcc 100644 --- a/megalinter/descriptors/lua.megalinter-descriptor.yml +++ b/megalinter/descriptors/lua.megalinter-descriptor.yml @@ -20,10 +20,13 @@ linters: apk: - openssl - readline-dev - - lua - - luarocks + - lua5.3 + - lua5.3-dev + - luarocks5.3 + - gcc + - musl-dev dockerfile: - - RUN luarocks5.4 install luacheck + - RUN luarocks-5.3 install luacheck supported_platforms: platform: - linux/amd64 From db79f5ec0f70f79faa41311ac13003bc03f589c4 Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Tue, 25 Jul 2023 11:18:20 -0500 Subject: [PATCH 092/105] Splitting out the run command temporarially to check build times --- Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index ff7d887f5db..a4e9222c7c3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -900,13 +900,13 @@ RUN ln -s /lib/libc.so.6 /usr/lib/libresolv.so.2 && \ curl --retry 5 --retry-delay 5 -sLv https://raw.githubusercontent.com/kubescape/kubescape/master/install.sh | /bin/bash -s -- -v v2.3.6 \ # # chktex installation - && cd ~ && touch .chktexrc && cd / \ +RUN cd ~ && touch .chktexrc && cd / \ # # luacheck installation - && luarocks-5.3 install luacheck \ +RUN luarocks-5.3 install luacheck \ # # perlcritic installation - && curl --retry 5 --retry-delay 5 -sL https://cpanmin.us/ | perl - -nq --no-wget Perl::Critic +RUN curl --retry 5 --retry-delay 5 -sL https://cpanmin.us/ | perl - -nq --no-wget Perl::Critic # # 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 From 691ac589c091b82ead2d960a1e386121beb9b0b2 Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Tue, 25 Jul 2023 12:23:10 -0500 Subject: [PATCH 093/105] Attempting to update to new salesforce cli which should be smaller --- Dockerfile | 12 ++++++------ flavors/cupcake/Dockerfile | 4 ++-- flavors/rust/Dockerfile | 4 ++-- flavors/salesforce/Dockerfile | 2 +- linters/salesforce_sfdx_scanner_apex/Dockerfile | 2 +- linters/salesforce_sfdx_scanner_aura/Dockerfile | 2 +- linters/salesforce_sfdx_scanner_lwc/Dockerfile | 2 +- .../descriptors/salesforce.megalinter-descriptor.yml | 2 +- 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/Dockerfile b/Dockerfile index a4e9222c7c3..ff59fcb3dbf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -100,12 +100,12 @@ RUN rustup-init -y --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-u RUN --mount=type=cache,id=cargo-${TARGETARCH},sharing=locked,target=/cargo/.cargo/registry/,uid=63425 \ . /cargo/.cargo/env \ - && cargo binstall --no-confirm --no-symlinks sarif-fmt shellcheck-sarif --root /tmp --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") + && cargo binstall --no-confirm --no-symlinks shellcheck-sarif sarif-fmt --root /tmp --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") FROM scratch AS cargo COPY --link --from=cargo-build /tmp/bin/* /bin/ -RUN ["/bin/sarif-fmt", "--help"] RUN ["/bin/shellcheck-sarif", "--help"] +RUN ["/bin/sarif-fmt", "--help"] #FROM__END @@ -166,7 +166,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__START WORKDIR /node-deps RUN npm --no-cache install --ignore-scripts --omit=dev \ - sfdx-cli \ + @salesforce/cli \ typescript \ @coffeelint/cli \ jscpd \ @@ -900,13 +900,13 @@ RUN ln -s /lib/libc.so.6 /usr/lib/libresolv.so.2 && \ curl --retry 5 --retry-delay 5 -sLv https://raw.githubusercontent.com/kubescape/kubescape/master/install.sh | /bin/bash -s -- -v v2.3.6 \ # # chktex installation -RUN cd ~ && touch .chktexrc && cd / \ + && cd ~ && touch .chktexrc && cd / \ # # luacheck installation -RUN luarocks-5.3 install luacheck \ + && luarocks-5.3 install luacheck \ # # perlcritic installation -RUN curl --retry 5 --retry-delay 5 -sL https://cpanmin.us/ | perl - -nq --no-wget Perl::Critic + && curl --retry 5 --retry-delay 5 -sL https://cpanmin.us/ | perl - -nq --no-wget Perl::Critic # # 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 diff --git a/flavors/cupcake/Dockerfile b/flavors/cupcake/Dockerfile index 921d78099c5..4e9b165455e 100644 --- a/flavors/cupcake/Dockerfile +++ b/flavors/cupcake/Dockerfile @@ -87,12 +87,12 @@ RUN rustup-init -y --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-u RUN --mount=type=cache,id=cargo-${TARGETARCH},sharing=locked,target=/cargo/.cargo/registry/,uid=63425 \ . /cargo/.cargo/env \ - && cargo binstall --no-confirm --no-symlinks sarif-fmt shellcheck-sarif --root /tmp --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") + && cargo binstall --no-confirm --no-symlinks shellcheck-sarif sarif-fmt --root /tmp --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") FROM scratch AS cargo COPY --link --from=cargo-build /tmp/bin/* /bin/ -RUN ["/bin/sarif-fmt", "--help"] RUN ["/bin/shellcheck-sarif", "--help"] +RUN ["/bin/sarif-fmt", "--help"] #FROM__END diff --git a/flavors/rust/Dockerfile b/flavors/rust/Dockerfile index b02adc78e04..6a3e3ba709d 100644 --- a/flavors/rust/Dockerfile +++ b/flavors/rust/Dockerfile @@ -58,12 +58,12 @@ RUN rustup-init -y --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-u RUN --mount=type=cache,id=cargo-${TARGETARCH},sharing=locked,target=/cargo/.cargo/registry/,uid=63425 \ . /cargo/.cargo/env \ - && cargo binstall --no-confirm --no-symlinks sarif-fmt shellcheck-sarif --root /tmp --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") + && cargo binstall --no-confirm --no-symlinks shellcheck-sarif sarif-fmt --root /tmp --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") FROM scratch AS cargo COPY --link --from=cargo-build /tmp/bin/* /bin/ -RUN ["/bin/sarif-fmt", "--help"] RUN ["/bin/shellcheck-sarif", "--help"] +RUN ["/bin/sarif-fmt", "--help"] #FROM__END diff --git a/flavors/salesforce/Dockerfile b/flavors/salesforce/Dockerfile index 9d188f1303f..c511437b530 100644 --- a/flavors/salesforce/Dockerfile +++ b/flavors/salesforce/Dockerfile @@ -70,7 +70,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__START WORKDIR /node-deps RUN npm --no-cache install --ignore-scripts --omit=dev \ - sfdx-cli \ + @salesforce/cli \ jscpd \ stylelint \ stylelint-config-standard \ diff --git a/linters/salesforce_sfdx_scanner_apex/Dockerfile b/linters/salesforce_sfdx_scanner_apex/Dockerfile index 58579274783..28d064435e3 100644 --- a/linters/salesforce_sfdx_scanner_apex/Dockerfile +++ b/linters/salesforce_sfdx_scanner_apex/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__START WORKDIR /node-deps RUN npm --no-cache install --ignore-scripts --omit=dev \ - sfdx-cli && \ + @salesforce/cli && \ echo "Cleaning npm cache…" \ && npm cache clean --force || true \ && echo "Changing owner of node_modules files…" \ diff --git a/linters/salesforce_sfdx_scanner_aura/Dockerfile b/linters/salesforce_sfdx_scanner_aura/Dockerfile index c09d3cabc87..d9f9a9b2d31 100644 --- a/linters/salesforce_sfdx_scanner_aura/Dockerfile +++ b/linters/salesforce_sfdx_scanner_aura/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__START WORKDIR /node-deps RUN npm --no-cache install --ignore-scripts --omit=dev \ - sfdx-cli && \ + @salesforce/cli && \ echo "Cleaning npm cache…" \ && npm cache clean --force || true \ && echo "Changing owner of node_modules files…" \ diff --git a/linters/salesforce_sfdx_scanner_lwc/Dockerfile b/linters/salesforce_sfdx_scanner_lwc/Dockerfile index ff1a80b140e..e04a1d97fc9 100644 --- a/linters/salesforce_sfdx_scanner_lwc/Dockerfile +++ b/linters/salesforce_sfdx_scanner_lwc/Dockerfile @@ -45,7 +45,7 @@ ENV NODE_OPTIONS="--max-old-space-size=8192" \ #NPM__START WORKDIR /node-deps RUN npm --no-cache install --ignore-scripts --omit=dev \ - sfdx-cli && \ + @salesforce/cli && \ echo "Cleaning npm cache…" \ && npm cache clean --force || true \ && echo "Changing owner of node_modules files…" \ diff --git a/megalinter/descriptors/salesforce.megalinter-descriptor.yml b/megalinter/descriptors/salesforce.megalinter-descriptor.yml index 6d5838524f2..14347108084 100644 --- a/megalinter/descriptors/salesforce.megalinter-descriptor.yml +++ b/megalinter/descriptors/salesforce.megalinter-descriptor.yml @@ -16,7 +16,7 @@ install: && rm -rf /root/.npm/_cacache # Salesforce DX npm: - - sfdx-cli + - "@salesforce/cli" supported_platforms: platform: - linux/amd64 From 3db704db3b726fc8429636a43491ef3a3d4bd748 Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Tue, 25 Jul 2023 13:34:53 -0500 Subject: [PATCH 094/105] Move phive to build platform --- Dockerfile | 39 +++++++++-------- flavors/cupcake/Dockerfile | 43 ++++++++++--------- flavors/php/Dockerfile | 39 +++++++++-------- flavors/rust/Dockerfile | 4 +- linters/php_phpcs/Dockerfile | 37 ++++++++-------- linters/php_phplint/Dockerfile | 37 ++++++++-------- linters/php_phpstan/Dockerfile | 36 ++++++++-------- linters/php_psalm/Dockerfile | 37 ++++++++-------- .../descriptors/php.megalinter-descriptor.yml | 11 +++-- 9 files changed, 150 insertions(+), 133 deletions(-) diff --git a/Dockerfile b/Dockerfile index ff59fcb3dbf..ed41c973ecd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -100,12 +100,12 @@ RUN rustup-init -y --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-u RUN --mount=type=cache,id=cargo-${TARGETARCH},sharing=locked,target=/cargo/.cargo/registry/,uid=63425 \ . /cargo/.cargo/env \ - && cargo binstall --no-confirm --no-symlinks shellcheck-sarif sarif-fmt --root /tmp --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") + && cargo binstall --no-confirm --no-symlinks sarif-fmt shellcheck-sarif --root /tmp --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") FROM scratch AS cargo COPY --link --from=cargo-build /tmp/bin/* /bin/ -RUN ["/bin/shellcheck-sarif", "--help"] RUN ["/bin/sarif-fmt", "--help"] +RUN ["/bin/shellcheck-sarif", "--help"] #FROM__END @@ -116,11 +116,28 @@ FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform ############################################################################################# #BUILD_PLATFORM_APK__START RUN apk add --update --no-cache \ + gnupg \ curl \ openjdk11 #BUILD_PLATFORM_APK__END #BUILD_PLATFORM_OTHER__START +# PHP installation +RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GITHUB_TOKEN)" \ + && export GITHUB_AUTH_TOKEN \ + && wget --tries=5 -q -O phive.phar https://phar.io/releases/phive.phar \ + && wget --tries=5 -q -O phive.phar.asc https://phar.io/releases/phive.phar.asc \ + && PHAR_KEY_ID="0x9D8A98B29B2D5D79" \ + && ( gpg --keyserver keyserver.pgp.com --recv-keys "$PHAR_KEY_ID" \ + || gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$PHAR_KEY_ID" \ + || gpg --keyserver pgp.mit.edu --recv-keys "$PHAR_KEY_ID" \ + || gpg --keyserver hkps://keyserver.ubuntu.com --recv-keys "$PHAR_KEY_ID" ) \ + && gpg --verify phive.phar.asc phive.phar \ + && chmod +x phive.phar \ + && mv phive.phar /usr/local/bin/phive \ + && rm phive.phar.asc + +# # SCALA installation RUN curl --retry-all-errors --retry 10 -fLo coursier https://git.io/coursier-cli && \ chmod +x coursier \ @@ -243,6 +260,7 @@ FROM scratch AS copy-collector ############################################################################################# #COPY__START +COPY --link --from=build-platform /usr/local/bin/phive /usr/local/bin/phive COPY --link --from=node_modules /node-deps /node-deps COPY --link --from=actionlint /usr/local/bin/actionlint /usr/bin/actionlint # shellcheck is a dependency for actionlint @@ -560,7 +578,6 @@ RUN apk add --no-cache \ openjdk11 \ perl \ perl-dev \ - gnupg \ php81 \ php81-phar \ php81-mbstring \ @@ -785,21 +802,7 @@ ENV JAVA_HOME=/usr/lib/jvm/java-11-openjdk ENV PATH="$JAVA_HOME/bin:${PATH}" # # PHP installation -RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GITHUB_TOKEN)" \ - && export GITHUB_AUTH_TOKEN \ - && wget --tries=5 -q -O phive.phar https://phar.io/releases/phive.phar \ - && wget --tries=5 -q -O phive.phar.asc https://phar.io/releases/phive.phar.asc \ - && PHAR_KEY_ID="0x9D8A98B29B2D5D79" \ - && ( gpg --keyserver keyserver.pgp.com --recv-keys "$PHAR_KEY_ID" \ - || gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$PHAR_KEY_ID" \ - || gpg --keyserver pgp.mit.edu --recv-keys "$PHAR_KEY_ID" \ - || gpg --keyserver hkps://keyserver.ubuntu.com --recv-keys "$PHAR_KEY_ID" ) \ - && gpg --verify phive.phar.asc phive.phar \ - && chmod +x phive.phar \ - && mv phive.phar /usr/local/bin/phive \ - && rm phive.phar.asc \ - && update-alternatives --install /usr/bin/php php /usr/bin/php81 110 - +RUN update-alternatives --install /usr/bin/php php /usr/bin/php81 110 # # POWERSHELL installation RUN --mount=type=secret,id=GITHUB_TOKEN case ${TARGETPLATFORM} in \ diff --git a/flavors/cupcake/Dockerfile b/flavors/cupcake/Dockerfile index 4e9b165455e..ae463a7e927 100644 --- a/flavors/cupcake/Dockerfile +++ b/flavors/cupcake/Dockerfile @@ -87,12 +87,12 @@ RUN rustup-init -y --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-u RUN --mount=type=cache,id=cargo-${TARGETARCH},sharing=locked,target=/cargo/.cargo/registry/,uid=63425 \ . /cargo/.cargo/env \ - && cargo binstall --no-confirm --no-symlinks shellcheck-sarif sarif-fmt --root /tmp --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") + && cargo binstall --no-confirm --no-symlinks sarif-fmt shellcheck-sarif --root /tmp --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") FROM scratch AS cargo COPY --link --from=cargo-build /tmp/bin/* /bin/ -RUN ["/bin/shellcheck-sarif", "--help"] RUN ["/bin/sarif-fmt", "--help"] +RUN ["/bin/shellcheck-sarif", "--help"] #FROM__END @@ -102,10 +102,27 @@ FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #BUILD_PLATFORM_APK__START - +RUN apk add --update --no-cache \ + gnupg #BUILD_PLATFORM_APK__END #BUILD_PLATFORM_OTHER__START +# PHP installation +RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GITHUB_TOKEN)" \ + && export GITHUB_AUTH_TOKEN \ + && wget --tries=5 -q -O phive.phar https://phar.io/releases/phive.phar \ + && wget --tries=5 -q -O phive.phar.asc https://phar.io/releases/phive.phar.asc \ + && PHAR_KEY_ID="0x9D8A98B29B2D5D79" \ + && ( gpg --keyserver keyserver.pgp.com --recv-keys "$PHAR_KEY_ID" \ + || gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$PHAR_KEY_ID" \ + || gpg --keyserver pgp.mit.edu --recv-keys "$PHAR_KEY_ID" \ + || gpg --keyserver hkps://keyserver.ubuntu.com --recv-keys "$PHAR_KEY_ID" ) \ + && gpg --verify phive.phar.asc phive.phar \ + && chmod +x phive.phar \ + && mv phive.phar /usr/local/bin/phive \ + && rm phive.phar.asc + +# # bash-exec installation 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 @@ -217,6 +234,7 @@ FROM scratch AS copy-collector ############################################################################################# #COPY__START +COPY --link --from=build-platform /usr/local/bin/phive /usr/local/bin/phive COPY --link --from=node_modules /node-deps /node-deps COPY --link --from=actionlint /usr/local/bin/actionlint /usr/bin/actionlint # shellcheck is a dependency for actionlint @@ -487,7 +505,6 @@ RUN apk add --no-cache \ docker \ openrc \ openjdk11 \ - gnupg \ php81 \ php81-phar \ php81-mbstring \ @@ -634,24 +651,10 @@ ENV JAVA_HOME=/usr/lib/jvm/java-11-openjdk ENV PATH="$JAVA_HOME/bin:${PATH}" # # PHP installation -RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GITHUB_TOKEN)" \ - && export GITHUB_AUTH_TOKEN \ - && wget --tries=5 -q -O phive.phar https://phar.io/releases/phive.phar \ - && wget --tries=5 -q -O phive.phar.asc https://phar.io/releases/phive.phar.asc \ - && PHAR_KEY_ID="0x9D8A98B29B2D5D79" \ - && ( gpg --keyserver keyserver.pgp.com --recv-keys "$PHAR_KEY_ID" \ - || gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$PHAR_KEY_ID" \ - || gpg --keyserver pgp.mit.edu --recv-keys "$PHAR_KEY_ID" \ - || gpg --keyserver hkps://keyserver.ubuntu.com --recv-keys "$PHAR_KEY_ID" ) \ - && gpg --verify phive.phar.asc phive.phar \ - && chmod +x phive.phar \ - && mv phive.phar /usr/local/bin/phive \ - && rm phive.phar.asc \ - && update-alternatives --install /usr/bin/php php /usr/bin/php81 110 - +RUN update-alternatives --install /usr/bin/php php /usr/bin/php81 110 \ # # clj-kondo installation -RUN curl --retry 5 --retry-delay 5 -sLO https://raw.githubusercontent.com/clj-kondo/clj-kondo/master/script/install-clj-kondo \ + && curl --retry 5 --retry-delay 5 -sLO https://raw.githubusercontent.com/clj-kondo/clj-kondo/master/script/install-clj-kondo \ && chmod +x install-clj-kondo \ && ./install-clj-kondo \ # diff --git a/flavors/php/Dockerfile b/flavors/php/Dockerfile index 8beeb7bcb75..636643ecc81 100644 --- a/flavors/php/Dockerfile +++ b/flavors/php/Dockerfile @@ -37,10 +37,27 @@ FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #BUILD_PLATFORM_APK__START - +RUN apk add --update --no-cache \ + gnupg #BUILD_PLATFORM_APK__END #BUILD_PLATFORM_OTHER__START +# PHP installation +RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GITHUB_TOKEN)" \ + && export GITHUB_AUTH_TOKEN \ + && wget --tries=5 -q -O phive.phar https://phar.io/releases/phive.phar \ + && wget --tries=5 -q -O phive.phar.asc https://phar.io/releases/phive.phar.asc \ + && PHAR_KEY_ID="0x9D8A98B29B2D5D79" \ + && ( gpg --keyserver keyserver.pgp.com --recv-keys "$PHAR_KEY_ID" \ + || gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$PHAR_KEY_ID" \ + || gpg --keyserver pgp.mit.edu --recv-keys "$PHAR_KEY_ID" \ + || gpg --keyserver hkps://keyserver.ubuntu.com --recv-keys "$PHAR_KEY_ID" ) \ + && gpg --verify phive.phar.asc phive.phar \ + && chmod +x phive.phar \ + && mv phive.phar /usr/local/bin/phive \ + && rm phive.phar.asc + +# # bash-exec installation 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 \ @@ -124,6 +141,7 @@ FROM scratch AS copy-collector ############################################################################################# #COPY__START +COPY --link --from=build-platform /usr/local/bin/phive /usr/local/bin/phive COPY --link --from=actionlint /usr/local/bin/actionlint /usr/bin/actionlint # shellcheck is a dependency for actionlint @@ -318,7 +336,6 @@ RUN apk add --no-cache \ musl-dev \ openssh \ openjdk11 \ - gnupg \ php81 \ php81-phar \ php81-mbstring \ @@ -406,24 +423,10 @@ COPY --from=copy-collector / / ############################################################################################# #OTHER__START # PHP installation -RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GITHUB_TOKEN)" \ - && export GITHUB_AUTH_TOKEN \ - && wget --tries=5 -q -O phive.phar https://phar.io/releases/phive.phar \ - && wget --tries=5 -q -O phive.phar.asc https://phar.io/releases/phive.phar.asc \ - && PHAR_KEY_ID="0x9D8A98B29B2D5D79" \ - && ( gpg --keyserver keyserver.pgp.com --recv-keys "$PHAR_KEY_ID" \ - || gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$PHAR_KEY_ID" \ - || gpg --keyserver pgp.mit.edu --recv-keys "$PHAR_KEY_ID" \ - || gpg --keyserver hkps://keyserver.ubuntu.com --recv-keys "$PHAR_KEY_ID" ) \ - && gpg --verify phive.phar.asc phive.phar \ - && chmod +x phive.phar \ - && mv phive.phar /usr/local/bin/phive \ - && rm phive.phar.asc \ - && update-alternatives --install /usr/bin/php php /usr/bin/php81 110 - +RUN update-alternatives --install /usr/bin/php php /usr/bin/php81 110 \ # # kubescape installation -RUN ln -s /lib/libc.so.6 /usr/lib/libresolv.so.2 && \ + && ln -s /lib/libc.so.6 /usr/lib/libresolv.so.2 && \ curl --retry 5 --retry-delay 5 -sLv https://raw.githubusercontent.com/kubescape/kubescape/master/install.sh | /bin/bash -s -- -v v2.3.6 # diff --git a/flavors/rust/Dockerfile b/flavors/rust/Dockerfile index 6a3e3ba709d..b02adc78e04 100644 --- a/flavors/rust/Dockerfile +++ b/flavors/rust/Dockerfile @@ -58,12 +58,12 @@ RUN rustup-init -y --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-u RUN --mount=type=cache,id=cargo-${TARGETARCH},sharing=locked,target=/cargo/.cargo/registry/,uid=63425 \ . /cargo/.cargo/env \ - && cargo binstall --no-confirm --no-symlinks shellcheck-sarif sarif-fmt --root /tmp --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") + && cargo binstall --no-confirm --no-symlinks sarif-fmt shellcheck-sarif --root /tmp --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") FROM scratch AS cargo COPY --link --from=cargo-build /tmp/bin/* /bin/ -RUN ["/bin/shellcheck-sarif", "--help"] RUN ["/bin/sarif-fmt", "--help"] +RUN ["/bin/shellcheck-sarif", "--help"] #FROM__END diff --git a/linters/php_phpcs/Dockerfile b/linters/php_phpcs/Dockerfile index c13e7a29573..fd386eca58f 100644 --- a/linters/php_phpcs/Dockerfile +++ b/linters/php_phpcs/Dockerfile @@ -20,11 +20,27 @@ FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #BUILD_PLATFORM_APK__START - +RUN apk add --update --no-cache \ + gnupg #BUILD_PLATFORM_APK__END #BUILD_PLATFORM_OTHER__START +# PHP installation +RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GITHUB_TOKEN)" \ + && export GITHUB_AUTH_TOKEN \ + && wget --tries=5 -q -O phive.phar https://phar.io/releases/phive.phar \ + && wget --tries=5 -q -O phive.phar.asc https://phar.io/releases/phive.phar.asc \ + && PHAR_KEY_ID="0x9D8A98B29B2D5D79" \ + && ( gpg --keyserver keyserver.pgp.com --recv-keys "$PHAR_KEY_ID" \ + || gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$PHAR_KEY_ID" \ + || gpg --keyserver pgp.mit.edu --recv-keys "$PHAR_KEY_ID" \ + || gpg --keyserver hkps://keyserver.ubuntu.com --recv-keys "$PHAR_KEY_ID" ) \ + && gpg --verify phive.phar.asc phive.phar \ + && chmod +x phive.phar \ + && mv phive.phar /usr/local/bin/phive \ + && rm phive.phar.asc +# #BUILD_PLATFORM_OTHER__END FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules @@ -54,7 +70,7 @@ FROM scratch AS copy-collector ############################################################################################# #COPY__START - +COPY --link --from=build-platform /usr/local/bin/phive /usr/local/bin/phive #COPY__END ####################################### @@ -158,7 +174,6 @@ RUN apk add --no-cache \ make \ musl-dev \ openssh \ - gnupg \ php81 \ php81-phar \ php81-mbstring \ @@ -227,21 +242,7 @@ COPY --from=copy-collector / / ############################################################################################# #OTHER__START # PHP installation -RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GITHUB_TOKEN)" \ - && export GITHUB_AUTH_TOKEN \ - && wget --tries=5 -q -O phive.phar https://phar.io/releases/phive.phar \ - && wget --tries=5 -q -O phive.phar.asc https://phar.io/releases/phive.phar.asc \ - && PHAR_KEY_ID="0x9D8A98B29B2D5D79" \ - && ( gpg --keyserver keyserver.pgp.com --recv-keys "$PHAR_KEY_ID" \ - || gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$PHAR_KEY_ID" \ - || gpg --keyserver pgp.mit.edu --recv-keys "$PHAR_KEY_ID" \ - || gpg --keyserver hkps://keyserver.ubuntu.com --recv-keys "$PHAR_KEY_ID" ) \ - && gpg --verify phive.phar.asc phive.phar \ - && chmod +x phive.phar \ - && mv phive.phar /usr/local/bin/phive \ - && rm phive.phar.asc \ - && update-alternatives --install /usr/bin/php php /usr/bin/php81 110 - +RUN update-alternatives --install /usr/bin/php php /usr/bin/php81 110 # # 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 diff --git a/linters/php_phplint/Dockerfile b/linters/php_phplint/Dockerfile index e8aae692e4d..1f5bb45b0a3 100644 --- a/linters/php_phplint/Dockerfile +++ b/linters/php_phplint/Dockerfile @@ -20,11 +20,27 @@ FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #BUILD_PLATFORM_APK__START - +RUN apk add --update --no-cache \ + gnupg #BUILD_PLATFORM_APK__END #BUILD_PLATFORM_OTHER__START +# PHP installation +RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GITHUB_TOKEN)" \ + && export GITHUB_AUTH_TOKEN \ + && wget --tries=5 -q -O phive.phar https://phar.io/releases/phive.phar \ + && wget --tries=5 -q -O phive.phar.asc https://phar.io/releases/phive.phar.asc \ + && PHAR_KEY_ID="0x9D8A98B29B2D5D79" \ + && ( gpg --keyserver keyserver.pgp.com --recv-keys "$PHAR_KEY_ID" \ + || gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$PHAR_KEY_ID" \ + || gpg --keyserver pgp.mit.edu --recv-keys "$PHAR_KEY_ID" \ + || gpg --keyserver hkps://keyserver.ubuntu.com --recv-keys "$PHAR_KEY_ID" ) \ + && gpg --verify phive.phar.asc phive.phar \ + && chmod +x phive.phar \ + && mv phive.phar /usr/local/bin/phive \ + && rm phive.phar.asc +# #BUILD_PLATFORM_OTHER__END FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules @@ -54,7 +70,7 @@ FROM scratch AS copy-collector ############################################################################################# #COPY__START - +COPY --link --from=build-platform /usr/local/bin/phive /usr/local/bin/phive #COPY__END ####################################### @@ -158,7 +174,6 @@ RUN apk add --no-cache \ make \ musl-dev \ openssh \ - gnupg \ php81 \ php81-phar \ php81-mbstring \ @@ -227,21 +242,7 @@ COPY --from=copy-collector / / ############################################################################################# #OTHER__START # PHP installation -RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GITHUB_TOKEN)" \ - && export GITHUB_AUTH_TOKEN \ - && wget --tries=5 -q -O phive.phar https://phar.io/releases/phive.phar \ - && wget --tries=5 -q -O phive.phar.asc https://phar.io/releases/phive.phar.asc \ - && PHAR_KEY_ID="0x9D8A98B29B2D5D79" \ - && ( gpg --keyserver keyserver.pgp.com --recv-keys "$PHAR_KEY_ID" \ - || gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$PHAR_KEY_ID" \ - || gpg --keyserver pgp.mit.edu --recv-keys "$PHAR_KEY_ID" \ - || gpg --keyserver hkps://keyserver.ubuntu.com --recv-keys "$PHAR_KEY_ID" ) \ - && gpg --verify phive.phar.asc phive.phar \ - && chmod +x phive.phar \ - && mv phive.phar /usr/local/bin/phive \ - && rm phive.phar.asc \ - && update-alternatives --install /usr/bin/php php /usr/bin/php81 110 - +RUN update-alternatives --install /usr/bin/php php /usr/bin/php81 110 # # phplint installation RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GITHUB_TOKEN)" && export GITHUB_AUTH_TOKEN && phive --no-progress install overtrue/phplint --force-accept-unsigned -g diff --git a/linters/php_phpstan/Dockerfile b/linters/php_phpstan/Dockerfile index 9de32cffcf4..dfc9938ad97 100644 --- a/linters/php_phpstan/Dockerfile +++ b/linters/php_phpstan/Dockerfile @@ -20,11 +20,27 @@ FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #BUILD_PLATFORM_APK__START - +RUN apk add --update --no-cache \ + gnupg #BUILD_PLATFORM_APK__END #BUILD_PLATFORM_OTHER__START +# PHP installation +RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GITHUB_TOKEN)" \ + && export GITHUB_AUTH_TOKEN \ + && wget --tries=5 -q -O phive.phar https://phar.io/releases/phive.phar \ + && wget --tries=5 -q -O phive.phar.asc https://phar.io/releases/phive.phar.asc \ + && PHAR_KEY_ID="0x9D8A98B29B2D5D79" \ + && ( gpg --keyserver keyserver.pgp.com --recv-keys "$PHAR_KEY_ID" \ + || gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$PHAR_KEY_ID" \ + || gpg --keyserver pgp.mit.edu --recv-keys "$PHAR_KEY_ID" \ + || gpg --keyserver hkps://keyserver.ubuntu.com --recv-keys "$PHAR_KEY_ID" ) \ + && gpg --verify phive.phar.asc phive.phar \ + && chmod +x phive.phar \ + && mv phive.phar /usr/local/bin/phive \ + && rm phive.phar.asc +# #BUILD_PLATFORM_OTHER__END FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules @@ -54,6 +70,7 @@ FROM scratch AS copy-collector ############################################################################################# #COPY__START +COPY --link --from=build-platform /usr/local/bin/phive /usr/local/bin/phive COPY --link --chmod=755 --from=phpstan /composer/vendor/phpstan/phpstan/phpstan.phar /usr/bin/phpstan #COPY__END @@ -158,7 +175,6 @@ RUN apk add --no-cache \ make \ musl-dev \ openssh \ - gnupg \ php81 \ php81-phar \ php81-mbstring \ @@ -227,21 +243,7 @@ COPY --from=copy-collector / / ############################################################################################# #OTHER__START # PHP installation -RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GITHUB_TOKEN)" \ - && export GITHUB_AUTH_TOKEN \ - && wget --tries=5 -q -O phive.phar https://phar.io/releases/phive.phar \ - && wget --tries=5 -q -O phive.phar.asc https://phar.io/releases/phive.phar.asc \ - && PHAR_KEY_ID="0x9D8A98B29B2D5D79" \ - && ( gpg --keyserver keyserver.pgp.com --recv-keys "$PHAR_KEY_ID" \ - || gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$PHAR_KEY_ID" \ - || gpg --keyserver pgp.mit.edu --recv-keys "$PHAR_KEY_ID" \ - || gpg --keyserver hkps://keyserver.ubuntu.com --recv-keys "$PHAR_KEY_ID" ) \ - && gpg --verify phive.phar.asc phive.phar \ - && chmod +x phive.phar \ - && mv phive.phar /usr/local/bin/phive \ - && rm phive.phar.asc \ - && update-alternatives --install /usr/bin/php php /usr/bin/php81 110 - +RUN update-alternatives --install /usr/bin/php php /usr/bin/php81 110 # #OTHER__END diff --git a/linters/php_psalm/Dockerfile b/linters/php_psalm/Dockerfile index c50f0281d22..6ed632d3eb8 100644 --- a/linters/php_psalm/Dockerfile +++ b/linters/php_psalm/Dockerfile @@ -20,11 +20,27 @@ FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform ## @generated by .automation/build.py using descriptor files, please do not update manually ## ############################################################################################# #BUILD_PLATFORM_APK__START - +RUN apk add --update --no-cache \ + gnupg #BUILD_PLATFORM_APK__END #BUILD_PLATFORM_OTHER__START +# PHP installation +RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GITHUB_TOKEN)" \ + && export GITHUB_AUTH_TOKEN \ + && wget --tries=5 -q -O phive.phar https://phar.io/releases/phive.phar \ + && wget --tries=5 -q -O phive.phar.asc https://phar.io/releases/phive.phar.asc \ + && PHAR_KEY_ID="0x9D8A98B29B2D5D79" \ + && ( gpg --keyserver keyserver.pgp.com --recv-keys "$PHAR_KEY_ID" \ + || gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$PHAR_KEY_ID" \ + || gpg --keyserver pgp.mit.edu --recv-keys "$PHAR_KEY_ID" \ + || gpg --keyserver hkps://keyserver.ubuntu.com --recv-keys "$PHAR_KEY_ID" ) \ + && gpg --verify phive.phar.asc phive.phar \ + && chmod +x phive.phar \ + && mv phive.phar /usr/local/bin/phive \ + && rm phive.phar.asc +# #BUILD_PLATFORM_OTHER__END FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules @@ -54,7 +70,7 @@ FROM scratch AS copy-collector ############################################################################################# #COPY__START - +COPY --link --from=build-platform /usr/local/bin/phive /usr/local/bin/phive #COPY__END ####################################### @@ -158,7 +174,6 @@ RUN apk add --no-cache \ make \ musl-dev \ openssh \ - gnupg \ php81 \ php81-phar \ php81-mbstring \ @@ -227,21 +242,7 @@ COPY --from=copy-collector / / ############################################################################################# #OTHER__START # PHP installation -RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GITHUB_TOKEN)" \ - && export GITHUB_AUTH_TOKEN \ - && wget --tries=5 -q -O phive.phar https://phar.io/releases/phive.phar \ - && wget --tries=5 -q -O phive.phar.asc https://phar.io/releases/phive.phar.asc \ - && PHAR_KEY_ID="0x9D8A98B29B2D5D79" \ - && ( gpg --keyserver keyserver.pgp.com --recv-keys "$PHAR_KEY_ID" \ - || gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$PHAR_KEY_ID" \ - || gpg --keyserver pgp.mit.edu --recv-keys "$PHAR_KEY_ID" \ - || gpg --keyserver hkps://keyserver.ubuntu.com --recv-keys "$PHAR_KEY_ID" ) \ - && gpg --verify phive.phar.asc phive.phar \ - && chmod +x phive.phar \ - && mv phive.phar /usr/local/bin/phive \ - && rm phive.phar.asc \ - && update-alternatives --install /usr/bin/php php /usr/bin/php81 110 - +RUN update-alternatives --install /usr/bin/php php /usr/bin/php81 110 # # psalm installation RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GITHUB_TOKEN)" && export GITHUB_AUTH_TOKEN && phive --no-progress install psalm -g --trust-gpg-keys 8A03EA3B385DBAA1,12CE0F1D262429A5 diff --git a/megalinter/descriptors/php.megalinter-descriptor.yml b/megalinter/descriptors/php.megalinter-descriptor.yml index d8631fed22b..8baf56c995a 100644 --- a/megalinter/descriptors/php.megalinter-descriptor.yml +++ b/megalinter/descriptors/php.megalinter-descriptor.yml @@ -6,8 +6,9 @@ descriptor_flavors: file_extensions: - ".php" install: - apk: + build_platform_apk: - gnupg + apk: - php81 - php81-phar - php81-mbstring @@ -18,7 +19,7 @@ install: - php81-dom - php81-simplexml - dpkg - dockerfile: + build_platform_dockerfile: - | RUN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GITHUB_TOKEN)" \ && export GITHUB_AUTH_TOKEN \ @@ -32,8 +33,10 @@ install: && gpg --verify phive.phar.asc phive.phar \ && chmod +x phive.phar \ && mv phive.phar /usr/local/bin/phive \ - && rm phive.phar.asc \ - && update-alternatives --install /usr/bin/php php /usr/bin/php81 110 + && rm phive.phar.asc + dockerfile: + - COPY --link --from=build-platform /usr/local/bin/phive /usr/local/bin/phive + - RUN update-alternatives --install /usr/bin/php php /usr/bin/php81 110 supported_platforms: platform: - linux/amd64 From d24b5ba2835c156e4b7c9cb28c8fbe1ebbc48cbe Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Tue, 25 Jul 2023 13:45:25 -0500 Subject: [PATCH 095/105] Move arm-ttk to build platform --- Dockerfile | 30 ++++++++++--------- flavors/cupcake/Dockerfile | 1 + flavors/dotnet/Dockerfile | 27 +++++++++-------- flavors/dotnetweb/Dockerfile | 27 +++++++++-------- flavors/go/Dockerfile | 1 + linters/arm_arm_ttk/Dockerfile | 25 ++++++++-------- linters/go_revive/Dockerfile | 1 + .../descriptors/arm.megalinter-descriptor.yml | 4 ++- .../descriptors/go.megalinter-descriptor.yml | 4 +-- 9 files changed, 63 insertions(+), 57 deletions(-) diff --git a/Dockerfile b/Dockerfile index ed41c973ecd..97618002633 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,6 +25,7 @@ FROM --platform=$BUILDPLATFORM golang:1-alpine as revive-build ## 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 +## See https://github.com/mgechev/revive/issues/787 RUN mkdir temp && cd temp && go mod init temp && go get -d github.com/mgechev/revive@latest ARG BUILDARCH ARG TARGETARCH @@ -140,7 +141,19 @@ RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GI # # SCALA installation RUN curl --retry-all-errors --retry 10 -fLo coursier https://git.io/coursier-cli && \ - chmod +x coursier \ + chmod +x coursier + +# +# arm-ttk installation +ARG ARM_TTK_NAME='master.zip' +ARG ARM_TTK_URI='https://github.com/Azure/arm-ttk/archive/master.zip' +ARG ARM_TTK_DIRECTORY='/opt/microsoft' +ENV ARM_TTK_PSD1="${ARM_TTK_DIRECTORY}/arm-ttk-master/arm-ttk/arm-ttk.psd1" +RUN curl --retry 5 --retry-delay 5 -sLO "${ARM_TTK_URI}" \ + && unzip "${ARM_TTK_NAME}" -d "${ARM_TTK_DIRECTORY}" \ + && rm "${ARM_TTK_NAME}" \ + && ln -sTf "${ARM_TTK_PSD1}" /usr/bin/arm-ttk \ + && chmod a+x /usr/bin/arm-ttk \ # # 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 \ @@ -266,6 +279,7 @@ 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 --link --from=build-platform /usr/bin/arm-ttk /usr/bin/arm-ttk COPY --link --from=build-platform /usr/bin/bash-exec /usr/bin/bash-exec # Next COPY line commented because already managed by another linter # COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck @@ -535,9 +549,6 @@ RUN apk add --update --no-cache libc6-compat \ ARG TARGETPLATFORM ARG PWSH_VERSION='latest' ARG PWSH_DIRECTORY='/opt/microsoft/powershell' -ARG ARM_TTK_NAME='master.zip' -ARG ARM_TTK_URI='https://github.com/Azure/arm-ttk/archive/master.zip' -ARG ARM_TTK_DIRECTORY='/opt/microsoft' ARG BICEP_EXE='bicep' ARG BICEP_DIR='/usr/local/bin' ARG DART_VERSION='2.8.4' @@ -830,8 +841,7 @@ RUN --mount=type=secret,id=GITHUB_TOKEN case ${TARGETPLATFORM} in \ # 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 \ # # VBDOTNET installation # Next line commented because already managed by another linter @@ -841,14 +851,6 @@ RUN echo y|sfdx plugins:install sfdx-hardis \ # Next line commented because already managed by another linter # ENV PATH="${PATH}:/root/.dotnet/tools:/usr/share/dotnet" # -# arm-ttk installation -ENV ARM_TTK_PSD1="${ARM_TTK_DIRECTORY}/arm-ttk-master/arm-ttk/arm-ttk.psd1" -RUN curl --retry 5 --retry-delay 5 -sLO "${ARM_TTK_URI}" \ - && unzip "${ARM_TTK_NAME}" -d "${ARM_TTK_DIRECTORY}" \ - && rm "${ARM_TTK_NAME}" \ - && ln -sTf "${ARM_TTK_PSD1}" /usr/bin/arm-ttk \ - && chmod a+x /usr/bin/arm-ttk \ -# # bicep_linter installation && case ${TARGETPLATFORM} in \ "linux/amd64") POWERSHELL_ARCH=musl-x64 ;; \ diff --git a/flavors/cupcake/Dockerfile b/flavors/cupcake/Dockerfile index ae463a7e927..fe9690fa2dd 100644 --- a/flavors/cupcake/Dockerfile +++ b/flavors/cupcake/Dockerfile @@ -26,6 +26,7 @@ FROM --platform=$BUILDPLATFORM golang:1-alpine as revive-build ## 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 +## See https://github.com/mgechev/revive/issues/787 RUN mkdir temp && cd temp && go mod init temp && go get -d github.com/mgechev/revive@latest ARG BUILDARCH ARG TARGETARCH diff --git a/flavors/dotnet/Dockerfile b/flavors/dotnet/Dockerfile index f15f04151cf..5329f5cc7fa 100644 --- a/flavors/dotnet/Dockerfile +++ b/flavors/dotnet/Dockerfile @@ -41,8 +41,19 @@ FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform #BUILD_PLATFORM_APK__END #BUILD_PLATFORM_OTHER__START +# arm-ttk installation +ARG ARM_TTK_NAME='master.zip' +ARG ARM_TTK_URI='https://github.com/Azure/arm-ttk/archive/master.zip' +ARG ARM_TTK_DIRECTORY='/opt/microsoft' +ENV ARM_TTK_PSD1="${ARM_TTK_DIRECTORY}/arm-ttk-master/arm-ttk/arm-ttk.psd1" +RUN curl --retry 5 --retry-delay 5 -sLO "${ARM_TTK_URI}" \ + && unzip "${ARM_TTK_NAME}" -d "${ARM_TTK_DIRECTORY}" \ + && rm "${ARM_TTK_NAME}" \ + && ln -sTf "${ARM_TTK_PSD1}" /usr/bin/arm-ttk \ + && chmod a+x /usr/bin/arm-ttk \ +# # bash-exec installation -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 \ + && 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 \ # # ktlint installation @@ -131,6 +142,7 @@ 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 --link --from=build-platform /usr/bin/arm-ttk /usr/bin/arm-ttk COPY --link --from=build-platform /usr/bin/bash-exec /usr/bin/bash-exec # Next COPY line commented because already managed by another linter # COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck @@ -306,9 +318,6 @@ RUN apk add --update --no-cache libc6-compat \ ARG TARGETPLATFORM ARG PWSH_VERSION='latest' ARG PWSH_DIRECTORY='/opt/microsoft/powershell' -ARG ARM_TTK_NAME='master.zip' -ARG ARM_TTK_URI='https://github.com/Azure/arm-ttk/archive/master.zip' -ARG ARM_TTK_DIRECTORY='/opt/microsoft' ARG BICEP_EXE='bicep' ARG BICEP_DIR='/usr/local/bin' ARG PSSA_VERSION='latest' @@ -471,16 +480,8 @@ RUN --mount=type=secret,id=GITHUB_TOKEN case ${TARGETPLATFORM} in \ # Next line commented because already managed by another linter # ENV PATH="${PATH}:/root/.dotnet/tools:/usr/share/dotnet" # -# arm-ttk installation -ENV ARM_TTK_PSD1="${ARM_TTK_DIRECTORY}/arm-ttk-master/arm-ttk/arm-ttk.psd1" -RUN curl --retry 5 --retry-delay 5 -sLO "${ARM_TTK_URI}" \ - && unzip "${ARM_TTK_NAME}" -d "${ARM_TTK_DIRECTORY}" \ - && rm "${ARM_TTK_NAME}" \ - && ln -sTf "${ARM_TTK_PSD1}" /usr/bin/arm-ttk \ - && chmod a+x /usr/bin/arm-ttk \ -# # bicep_linter installation - && case ${TARGETPLATFORM} in \ +RUN case ${TARGETPLATFORM} in \ "linux/amd64") POWERSHELL_ARCH=musl-x64 ;; \ "linux/arm64") POWERSHELL_ARCH=arm64 ;; \ esac \ diff --git a/flavors/dotnetweb/Dockerfile b/flavors/dotnetweb/Dockerfile index c994ac3678b..13df9d146db 100644 --- a/flavors/dotnetweb/Dockerfile +++ b/flavors/dotnetweb/Dockerfile @@ -41,8 +41,19 @@ FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform #BUILD_PLATFORM_APK__END #BUILD_PLATFORM_OTHER__START +# arm-ttk installation +ARG ARM_TTK_NAME='master.zip' +ARG ARM_TTK_URI='https://github.com/Azure/arm-ttk/archive/master.zip' +ARG ARM_TTK_DIRECTORY='/opt/microsoft' +ENV ARM_TTK_PSD1="${ARM_TTK_DIRECTORY}/arm-ttk-master/arm-ttk/arm-ttk.psd1" +RUN curl --retry 5 --retry-delay 5 -sLO "${ARM_TTK_URI}" \ + && unzip "${ARM_TTK_NAME}" -d "${ARM_TTK_DIRECTORY}" \ + && rm "${ARM_TTK_NAME}" \ + && ln -sTf "${ARM_TTK_PSD1}" /usr/bin/arm-ttk \ + && chmod a+x /usr/bin/arm-ttk \ +# # bash-exec installation -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 \ + && 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 \ # # ktlint installation @@ -152,6 +163,7 @@ 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 --link --from=build-platform /usr/bin/arm-ttk /usr/bin/arm-ttk COPY --link --from=build-platform /usr/bin/bash-exec /usr/bin/bash-exec # Next COPY line commented because already managed by another linter # COPY --link --from=shellcheck /bin/shellcheck /usr/bin/shellcheck @@ -326,9 +338,6 @@ RUN apk add --update --no-cache libc6-compat \ ARG TARGETPLATFORM ARG PWSH_VERSION='latest' ARG PWSH_DIRECTORY='/opt/microsoft/powershell' -ARG ARM_TTK_NAME='master.zip' -ARG ARM_TTK_URI='https://github.com/Azure/arm-ttk/archive/master.zip' -ARG ARM_TTK_DIRECTORY='/opt/microsoft' ARG BICEP_EXE='bicep' ARG BICEP_DIR='/usr/local/bin' ARG PSSA_VERSION='latest' @@ -491,16 +500,8 @@ RUN --mount=type=secret,id=GITHUB_TOKEN case ${TARGETPLATFORM} in \ # Next line commented because already managed by another linter # ENV PATH="${PATH}:/root/.dotnet/tools:/usr/share/dotnet" # -# arm-ttk installation -ENV ARM_TTK_PSD1="${ARM_TTK_DIRECTORY}/arm-ttk-master/arm-ttk/arm-ttk.psd1" -RUN curl --retry 5 --retry-delay 5 -sLO "${ARM_TTK_URI}" \ - && unzip "${ARM_TTK_NAME}" -d "${ARM_TTK_DIRECTORY}" \ - && rm "${ARM_TTK_NAME}" \ - && ln -sTf "${ARM_TTK_PSD1}" /usr/bin/arm-ttk \ - && chmod a+x /usr/bin/arm-ttk \ -# # bicep_linter installation - && case ${TARGETPLATFORM} in \ +RUN case ${TARGETPLATFORM} in \ "linux/amd64") POWERSHELL_ARCH=musl-x64 ;; \ "linux/arm64") POWERSHELL_ARCH=arm64 ;; \ esac \ diff --git a/flavors/go/Dockerfile b/flavors/go/Dockerfile index 802e44e2172..9e507da4d93 100644 --- a/flavors/go/Dockerfile +++ b/flavors/go/Dockerfile @@ -26,6 +26,7 @@ FROM --platform=$BUILDPLATFORM golang:1-alpine as revive-build ## 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 +## See https://github.com/mgechev/revive/issues/787 RUN mkdir temp && cd temp && go mod init temp && go get -d github.com/mgechev/revive@latest ARG BUILDARCH ARG TARGETARCH diff --git a/linters/arm_arm_ttk/Dockerfile b/linters/arm_arm_ttk/Dockerfile index 481552de20e..1371ecf8304 100644 --- a/linters/arm_arm_ttk/Dockerfile +++ b/linters/arm_arm_ttk/Dockerfile @@ -24,7 +24,18 @@ FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS build-platform #BUILD_PLATFORM_APK__END #BUILD_PLATFORM_OTHER__START +# arm-ttk installation +ARG ARM_TTK_NAME='master.zip' +ARG ARM_TTK_URI='https://github.com/Azure/arm-ttk/archive/master.zip' +ARG ARM_TTK_DIRECTORY='/opt/microsoft' +ENV ARM_TTK_PSD1="${ARM_TTK_DIRECTORY}/arm-ttk-master/arm-ttk/arm-ttk.psd1" +RUN curl --retry 5 --retry-delay 5 -sLO "${ARM_TTK_URI}" \ + && unzip "${ARM_TTK_NAME}" -d "${ARM_TTK_DIRECTORY}" \ + && rm "${ARM_TTK_NAME}" \ + && ln -sTf "${ARM_TTK_PSD1}" /usr/bin/arm-ttk \ + && chmod a+x /usr/bin/arm-ttk +# #BUILD_PLATFORM_OTHER__END FROM --platform=$BUILDPLATFORM python:3.11.3-alpine3.17 AS node_modules @@ -54,7 +65,7 @@ FROM scratch AS copy-collector ############################################################################################# #COPY__START - +COPY --link --from=build-platform /usr/bin/arm-ttk /usr/bin/arm-ttk #COPY__END ####################################### @@ -137,9 +148,6 @@ RUN apk add --update --no-cache libc6-compat \ ARG TARGETPLATFORM ARG PWSH_VERSION='latest' ARG PWSH_DIRECTORY='/opt/microsoft/powershell' -ARG ARM_TTK_NAME='master.zip' -ARG ARM_TTK_URI='https://github.com/Azure/arm-ttk/archive/master.zip' -ARG ARM_TTK_DIRECTORY='/opt/microsoft' #ARG__END #################### @@ -238,15 +246,6 @@ RUN --mount=type=secret,id=GITHUB_TOKEN case ${TARGETPLATFORM} in \ | tar -xzC ${PWSH_DIRECTORY} \ && ln -sf ${PWSH_DIRECTORY}/pwsh /usr/bin/pwsh -# -# arm-ttk installation -ENV ARM_TTK_PSD1="${ARM_TTK_DIRECTORY}/arm-ttk-master/arm-ttk/arm-ttk.psd1" -RUN curl --retry 5 --retry-delay 5 -sLO "${ARM_TTK_URI}" \ - && unzip "${ARM_TTK_NAME}" -d "${ARM_TTK_DIRECTORY}" \ - && rm "${ARM_TTK_NAME}" \ - && ln -sTf "${ARM_TTK_PSD1}" /usr/bin/arm-ttk \ - && chmod a+x /usr/bin/arm-ttk - # #OTHER__END diff --git a/linters/go_revive/Dockerfile b/linters/go_revive/Dockerfile index 96545050131..8dfc9d8f26e 100644 --- a/linters/go_revive/Dockerfile +++ b/linters/go_revive/Dockerfile @@ -15,6 +15,7 @@ FROM --platform=$BUILDPLATFORM golang:1-alpine as revive-build ## 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 +## See https://github.com/mgechev/revive/issues/787 RUN mkdir temp && cd temp && go mod init temp && go get -d github.com/mgechev/revive@latest ARG BUILDARCH ARG TARGETARCH diff --git a/megalinter/descriptors/arm.megalinter-descriptor.yml b/megalinter/descriptors/arm.megalinter-descriptor.yml index 52e8ccc4b9e..89225421e69 100644 --- a/megalinter/descriptors/arm.megalinter-descriptor.yml +++ b/megalinter/descriptors/arm.megalinter-descriptor.yml @@ -54,7 +54,7 @@ linters: if (${Error}.Count) {exit 1} " install: - dockerfile: + build_platform_dockerfile: - ARG ARM_TTK_NAME='master.zip' - ARG ARM_TTK_URI='https://github.com/Azure/arm-ttk/archive/master.zip' - ARG ARM_TTK_DIRECTORY='/opt/microsoft' @@ -65,6 +65,8 @@ linters: && rm "${ARM_TTK_NAME}" \ && ln -sTf "${ARM_TTK_PSD1}" /usr/bin/arm-ttk \ && chmod a+x /usr/bin/arm-ttk + dockerfile: + - COPY --link --from=build-platform /usr/bin/arm-ttk /usr/bin/arm-ttk supported_platforms: platform: - linux/amd64 diff --git a/megalinter/descriptors/go.megalinter-descriptor.yml b/megalinter/descriptors/go.megalinter-descriptor.yml index d904f5ebf06..e547b4a4a15 100644 --- a/megalinter/descriptors/go.megalinter-descriptor.yml +++ b/megalinter/descriptors/go.megalinter-descriptor.yml @@ -81,14 +81,12 @@ linters: - "revive -config myfile.go" install: dockerfile: - ## 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 --platform=$BUILDPLATFORM golang:1-alpine as revive-build ## 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 + ## See https://github.com/mgechev/revive/issues/787 RUN mkdir temp && cd temp && go mod init temp && go get -d github.com/mgechev/revive@latest ARG BUILDARCH ARG TARGETARCH From 3e3d4df5613201d4e06ef63ae83265133c4ebce3 Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Tue, 25 Jul 2023 13:56:45 -0500 Subject: [PATCH 096/105] Bugfix --- Dockerfile | 1 + flavors/cupcake/Dockerfile | 1 + flavors/php/Dockerfile | 1 + linters/php_phpcs/Dockerfile | 1 + linters/php_phplint/Dockerfile | 1 + linters/php_phpstan/Dockerfile | 1 + linters/php_psalm/Dockerfile | 1 + megalinter/descriptors/php.megalinter-descriptor.yml | 1 + 8 files changed, 8 insertions(+) diff --git a/Dockerfile b/Dockerfile index 97618002633..94c7a71d2a6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -589,6 +589,7 @@ RUN apk add --no-cache \ openjdk11 \ perl \ perl-dev \ + gnupg \ php81 \ php81-phar \ php81-mbstring \ diff --git a/flavors/cupcake/Dockerfile b/flavors/cupcake/Dockerfile index fe9690fa2dd..aec731a192e 100644 --- a/flavors/cupcake/Dockerfile +++ b/flavors/cupcake/Dockerfile @@ -506,6 +506,7 @@ RUN apk add --no-cache \ docker \ openrc \ openjdk11 \ + gnupg \ php81 \ php81-phar \ php81-mbstring \ diff --git a/flavors/php/Dockerfile b/flavors/php/Dockerfile index 636643ecc81..1e78d387cbe 100644 --- a/flavors/php/Dockerfile +++ b/flavors/php/Dockerfile @@ -336,6 +336,7 @@ RUN apk add --no-cache \ musl-dev \ openssh \ openjdk11 \ + gnupg \ php81 \ php81-phar \ php81-mbstring \ diff --git a/linters/php_phpcs/Dockerfile b/linters/php_phpcs/Dockerfile index fd386eca58f..a9bdb468055 100644 --- a/linters/php_phpcs/Dockerfile +++ b/linters/php_phpcs/Dockerfile @@ -174,6 +174,7 @@ RUN apk add --no-cache \ make \ musl-dev \ openssh \ + gnupg \ php81 \ php81-phar \ php81-mbstring \ diff --git a/linters/php_phplint/Dockerfile b/linters/php_phplint/Dockerfile index 1f5bb45b0a3..fe8cf18f556 100644 --- a/linters/php_phplint/Dockerfile +++ b/linters/php_phplint/Dockerfile @@ -174,6 +174,7 @@ RUN apk add --no-cache \ make \ musl-dev \ openssh \ + gnupg \ php81 \ php81-phar \ php81-mbstring \ diff --git a/linters/php_phpstan/Dockerfile b/linters/php_phpstan/Dockerfile index dfc9938ad97..e36efafa20e 100644 --- a/linters/php_phpstan/Dockerfile +++ b/linters/php_phpstan/Dockerfile @@ -175,6 +175,7 @@ RUN apk add --no-cache \ make \ musl-dev \ openssh \ + gnupg \ php81 \ php81-phar \ php81-mbstring \ diff --git a/linters/php_psalm/Dockerfile b/linters/php_psalm/Dockerfile index 6ed632d3eb8..c3c0496bd24 100644 --- a/linters/php_psalm/Dockerfile +++ b/linters/php_psalm/Dockerfile @@ -174,6 +174,7 @@ RUN apk add --no-cache \ make \ musl-dev \ openssh \ + gnupg \ php81 \ php81-phar \ php81-mbstring \ diff --git a/megalinter/descriptors/php.megalinter-descriptor.yml b/megalinter/descriptors/php.megalinter-descriptor.yml index 8baf56c995a..db77587f12d 100644 --- a/megalinter/descriptors/php.megalinter-descriptor.yml +++ b/megalinter/descriptors/php.megalinter-descriptor.yml @@ -9,6 +9,7 @@ install: build_platform_apk: - gnupg apk: + - gnupg - php81 - php81-phar - php81-mbstring From 460bc765aafca6b75c752834015cf455bd6ac437 Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Tue, 25 Jul 2023 15:44:45 -0500 Subject: [PATCH 097/105] Fixed musl wheels --- .automation/build.py | 4 +- Dockerfile | 67 ++++++++++++++-------- flavors/ci_light/Dockerfile | 3 +- flavors/cupcake/Dockerfile | 58 ++++++++++++------- flavors/documentation/Dockerfile | 27 ++++++--- flavors/dotnet/Dockerfile | 30 ++++++---- flavors/dotnetweb/Dockerfile | 30 ++++++---- flavors/go/Dockerfile | 27 ++++++--- flavors/java/Dockerfile | 27 ++++++--- flavors/javascript/Dockerfile | 27 ++++++--- flavors/php/Dockerfile | 27 ++++++--- flavors/python/Dockerfile | 57 ++++++++++++------ flavors/ruby/Dockerfile | 27 ++++++--- flavors/rust/Dockerfile | 31 ++++++---- flavors/salesforce/Dockerfile | 27 ++++++--- flavors/security/Dockerfile | 15 +++-- flavors/swift/Dockerfile | 27 ++++++--- flavors/terraform/Dockerfile | 27 ++++++--- linters/ansible_ansible_lint/Dockerfile | 3 +- linters/c_cpplint/Dockerfile | 3 +- linters/cloudformation_cfn_lint/Dockerfile | 3 +- linters/cpp_cpplint/Dockerfile | 3 +- linters/html_djlint/Dockerfile | 3 +- linters/python_bandit/Dockerfile | 3 +- linters/python_black/Dockerfile | 3 +- linters/python_flake8/Dockerfile | 3 +- linters/python_isort/Dockerfile | 3 +- linters/python_mypy/Dockerfile | 3 +- linters/python_pylint/Dockerfile | 3 +- linters/python_pyright/Dockerfile | 3 +- linters/repository_checkov/Dockerfile | 3 +- linters/repository_semgrep/Dockerfile | 3 +- linters/rst_rst_lint/Dockerfile | 3 +- linters/rst_rstcheck/Dockerfile | 3 +- linters/rst_rstfmt/Dockerfile | 3 +- linters/snakemake_lint/Dockerfile | 3 +- linters/snakemake_snakefmt/Dockerfile | 3 +- linters/spell_proselint/Dockerfile | 3 +- linters/sql_sqlfluff/Dockerfile | 3 +- linters/yaml_yamllint/Dockerfile | 3 +- 40 files changed, 401 insertions(+), 203 deletions(-) diff --git a/.automation/build.py b/.automation/build.py index 841735ddf59..076b15a8aa9 100644 --- a/.automation/build.py +++ b/.automation/build.py @@ -658,7 +658,9 @@ def build_dockerfile( 'RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \\\n' f' mkdir -p "/venvs/{pip_linter}" \\\n' + f' && cd "/venvs/{pip_linter}" \\\n' - + " && python3 -m crossenv /usr/local/bin/target-python3 . \\\n" + + " && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ \"${TARGETPLATFORM}\" == \"linux/arm64\" ]] && echo \"aarch64\" || echo \"x86_64\") . \\\n" + # See https://github.com/benfogle/crossenv/issues/107 + + " && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\\\\0\\\\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \\\n" + " && source bin/activate \\\n" + f" && PYTHONDONTWRITEBYTECODE=1 {pip_linter_env} pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip " + (" ".join(pip_linter_packages)) diff --git a/Dockerfile b/Dockerfile index 94c7a71d2a6..c554d34785e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -101,12 +101,12 @@ RUN rustup-init -y --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-u RUN --mount=type=cache,id=cargo-${TARGETARCH},sharing=locked,target=/cargo/.cargo/registry/,uid=63425 \ . /cargo/.cargo/env \ - && cargo binstall --no-confirm --no-symlinks sarif-fmt shellcheck-sarif --root /tmp --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") + && cargo binstall --no-confirm --no-symlinks shellcheck-sarif sarif-fmt --root /tmp --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") FROM scratch AS cargo COPY --link --from=cargo-build /tmp/bin/* /bin/ -RUN ["/bin/sarif-fmt", "--help"] RUN ["/bin/shellcheck-sarif", "--help"] +RUN ["/bin/sarif-fmt", "--help"] #FROM__END @@ -398,127 +398,148 @@ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/ansible-lint" \ && cd "/venvs/ansible-lint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip ansible-lint RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/cpplint" \ && cd "/venvs/cpplint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip cpplint RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/cfn-lint" \ && cd "/venvs/cfn-lint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip cfn-lint RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/djlint" \ && cd "/venvs/djlint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip djlint RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/pylint" \ && cd "/venvs/pylint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip pylint typing-extensions RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/black" \ && cd "/venvs/black" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip black RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/flake8" \ && cd "/venvs/flake8" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip flake8 RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/isort" \ && cd "/venvs/isort" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip isort black RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/bandit" \ && cd "/venvs/bandit" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip bandit bandit_sarif_formatter bandit[toml] RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/mypy" \ && cd "/venvs/mypy" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip mypy RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/pyright" \ && cd "/venvs/pyright" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip pyright RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/checkov" \ && cd "/venvs/checkov" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip packaging checkov RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/semgrep" \ && cd "/venvs/semgrep" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip semgrep RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/rst-lint" \ && cd "/venvs/rst-lint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip restructuredtext_lint RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/rstcheck" \ && cd "/venvs/rstcheck" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip rstcheck RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/rstfmt" \ && cd "/venvs/rstfmt" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip rstfmt RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/snakemake" \ && cd "/venvs/snakemake" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakemake RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/snakefmt" \ && cd "/venvs/snakefmt" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakefmt RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/proselint" \ && cd "/venvs/proselint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip proselint RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/sqlfluff" \ && cd "/venvs/sqlfluff" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip sqlfluff RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/yamllint" \ && cd "/venvs/yamllint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip yamllint diff --git a/flavors/ci_light/Dockerfile b/flavors/ci_light/Dockerfile index c0d0486ecc2..363c7109051 100644 --- a/flavors/ci_light/Dockerfile +++ b/flavors/ci_light/Dockerfile @@ -161,7 +161,8 @@ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/yamllint" \ && cd "/venvs/yamllint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip yamllint diff --git a/flavors/cupcake/Dockerfile b/flavors/cupcake/Dockerfile index aec731a192e..57aa8f2d8b9 100644 --- a/flavors/cupcake/Dockerfile +++ b/flavors/cupcake/Dockerfile @@ -88,12 +88,12 @@ RUN rustup-init -y --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-u RUN --mount=type=cache,id=cargo-${TARGETARCH},sharing=locked,target=/cargo/.cargo/registry/,uid=63425 \ . /cargo/.cargo/env \ - && cargo binstall --no-confirm --no-symlinks sarif-fmt shellcheck-sarif --root /tmp --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") + && cargo binstall --no-confirm --no-symlinks shellcheck-sarif sarif-fmt --root /tmp --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") FROM scratch AS cargo COPY --link --from=cargo-build /tmp/bin/* /bin/ -RUN ["/bin/sarif-fmt", "--help"] RUN ["/bin/shellcheck-sarif", "--help"] +RUN ["/bin/sarif-fmt", "--help"] #FROM__END @@ -349,109 +349,127 @@ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/ansible-lint" \ && cd "/venvs/ansible-lint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip ansible-lint RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/cpplint" \ && cd "/venvs/cpplint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip cpplint RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/cfn-lint" \ && cd "/venvs/cfn-lint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip cfn-lint RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/djlint" \ && cd "/venvs/djlint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip djlint RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/pylint" \ && cd "/venvs/pylint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip pylint typing-extensions RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/black" \ && cd "/venvs/black" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip black RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/flake8" \ && cd "/venvs/flake8" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip flake8 RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/isort" \ && cd "/venvs/isort" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip isort black RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/mypy" \ && cd "/venvs/mypy" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip mypy RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/pyright" \ && cd "/venvs/pyright" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip pyright RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/checkov" \ && cd "/venvs/checkov" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip packaging checkov RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/semgrep" \ && cd "/venvs/semgrep" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip semgrep RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/rst-lint" \ && cd "/venvs/rst-lint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip restructuredtext_lint RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/rstcheck" \ && cd "/venvs/rstcheck" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip rstcheck RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/rstfmt" \ && cd "/venvs/rstfmt" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip rstfmt RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/proselint" \ && cd "/venvs/proselint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip proselint RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/sqlfluff" \ && cd "/venvs/sqlfluff" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip sqlfluff RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/yamllint" \ && cd "/venvs/yamllint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip yamllint diff --git a/flavors/documentation/Dockerfile b/flavors/documentation/Dockerfile index e492ccfd8af..0702009594b 100644 --- a/flavors/documentation/Dockerfile +++ b/flavors/documentation/Dockerfile @@ -217,55 +217,64 @@ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/ansible-lint" \ && cd "/venvs/ansible-lint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip ansible-lint RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/djlint" \ && cd "/venvs/djlint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip djlint RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/checkov" \ && cd "/venvs/checkov" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip packaging checkov RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/semgrep" \ && cd "/venvs/semgrep" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip semgrep RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/snakemake" \ && cd "/venvs/snakemake" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakemake RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/snakefmt" \ && cd "/venvs/snakefmt" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakefmt RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/proselint" \ && cd "/venvs/proselint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip proselint RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/sqlfluff" \ && cd "/venvs/sqlfluff" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip sqlfluff RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/yamllint" \ && cd "/venvs/yamllint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip yamllint diff --git a/flavors/dotnet/Dockerfile b/flavors/dotnet/Dockerfile index 5329f5cc7fa..22727cc2255 100644 --- a/flavors/dotnet/Dockerfile +++ b/flavors/dotnet/Dockerfile @@ -233,61 +233,71 @@ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/ansible-lint" \ && cd "/venvs/ansible-lint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip ansible-lint RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/cpplint" \ && cd "/venvs/cpplint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip cpplint RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/djlint" \ && cd "/venvs/djlint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip djlint RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/checkov" \ && cd "/venvs/checkov" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip packaging checkov RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/semgrep" \ && cd "/venvs/semgrep" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip semgrep RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/snakemake" \ && cd "/venvs/snakemake" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakemake RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/snakefmt" \ && cd "/venvs/snakefmt" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakefmt RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/proselint" \ && cd "/venvs/proselint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip proselint RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/sqlfluff" \ && cd "/venvs/sqlfluff" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip sqlfluff RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/yamllint" \ && cd "/venvs/yamllint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip yamllint diff --git a/flavors/dotnetweb/Dockerfile b/flavors/dotnetweb/Dockerfile index 13df9d146db..b2e8b9261ce 100644 --- a/flavors/dotnetweb/Dockerfile +++ b/flavors/dotnetweb/Dockerfile @@ -253,61 +253,71 @@ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/ansible-lint" \ && cd "/venvs/ansible-lint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip ansible-lint RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/cpplint" \ && cd "/venvs/cpplint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip cpplint RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/djlint" \ && cd "/venvs/djlint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip djlint RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/checkov" \ && cd "/venvs/checkov" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip packaging checkov RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/semgrep" \ && cd "/venvs/semgrep" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip semgrep RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/snakemake" \ && cd "/venvs/snakemake" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakemake RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/snakefmt" \ && cd "/venvs/snakefmt" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakefmt RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/proselint" \ && cd "/venvs/proselint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip proselint RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/sqlfluff" \ && cd "/venvs/sqlfluff" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip sqlfluff RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/yamllint" \ && cd "/venvs/yamllint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip yamllint diff --git a/flavors/go/Dockerfile b/flavors/go/Dockerfile index 9e507da4d93..14ffe2d2b1b 100644 --- a/flavors/go/Dockerfile +++ b/flavors/go/Dockerfile @@ -233,55 +233,64 @@ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/ansible-lint" \ && cd "/venvs/ansible-lint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip ansible-lint RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/djlint" \ && cd "/venvs/djlint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip djlint RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/checkov" \ && cd "/venvs/checkov" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip packaging checkov RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/semgrep" \ && cd "/venvs/semgrep" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip semgrep RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/snakemake" \ && cd "/venvs/snakemake" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakemake RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/snakefmt" \ && cd "/venvs/snakefmt" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakefmt RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/proselint" \ && cd "/venvs/proselint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip proselint RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/sqlfluff" \ && cd "/venvs/sqlfluff" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip sqlfluff RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/yamllint" \ && cd "/venvs/yamllint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip yamllint diff --git a/flavors/java/Dockerfile b/flavors/java/Dockerfile index 237a00ce3b0..cdfadee3fd6 100644 --- a/flavors/java/Dockerfile +++ b/flavors/java/Dockerfile @@ -227,55 +227,64 @@ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/ansible-lint" \ && cd "/venvs/ansible-lint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip ansible-lint RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/djlint" \ && cd "/venvs/djlint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip djlint RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/checkov" \ && cd "/venvs/checkov" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip packaging checkov RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/semgrep" \ && cd "/venvs/semgrep" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip semgrep RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/snakemake" \ && cd "/venvs/snakemake" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakemake RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/snakefmt" \ && cd "/venvs/snakefmt" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakefmt RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/proselint" \ && cd "/venvs/proselint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip proselint RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/sqlfluff" \ && cd "/venvs/sqlfluff" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip sqlfluff RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/yamllint" \ && cd "/venvs/yamllint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip yamllint diff --git a/flavors/javascript/Dockerfile b/flavors/javascript/Dockerfile index 3f2751d33be..07900ea8ff1 100644 --- a/flavors/javascript/Dockerfile +++ b/flavors/javascript/Dockerfile @@ -237,55 +237,64 @@ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/ansible-lint" \ && cd "/venvs/ansible-lint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip ansible-lint RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/djlint" \ && cd "/venvs/djlint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip djlint RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/checkov" \ && cd "/venvs/checkov" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip packaging checkov RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/semgrep" \ && cd "/venvs/semgrep" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip semgrep RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/snakemake" \ && cd "/venvs/snakemake" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakemake RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/snakefmt" \ && cd "/venvs/snakefmt" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakefmt RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/proselint" \ && cd "/venvs/proselint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip proselint RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/sqlfluff" \ && cd "/venvs/sqlfluff" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip sqlfluff RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/yamllint" \ && cd "/venvs/yamllint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip yamllint diff --git a/flavors/php/Dockerfile b/flavors/php/Dockerfile index 1e78d387cbe..0686f020cbf 100644 --- a/flavors/php/Dockerfile +++ b/flavors/php/Dockerfile @@ -235,55 +235,64 @@ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/ansible-lint" \ && cd "/venvs/ansible-lint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip ansible-lint RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/djlint" \ && cd "/venvs/djlint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip djlint RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/checkov" \ && cd "/venvs/checkov" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip packaging checkov RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/semgrep" \ && cd "/venvs/semgrep" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip semgrep RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/snakemake" \ && cd "/venvs/snakemake" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakemake RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/snakefmt" \ && cd "/venvs/snakefmt" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakefmt RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/proselint" \ && cd "/venvs/proselint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip proselint RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/sqlfluff" \ && cd "/venvs/sqlfluff" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip sqlfluff RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/yamllint" \ && cd "/venvs/yamllint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip yamllint diff --git a/flavors/python/Dockerfile b/flavors/python/Dockerfile index f786db1ea74..170c599b553 100644 --- a/flavors/python/Dockerfile +++ b/flavors/python/Dockerfile @@ -241,115 +241,134 @@ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/ansible-lint" \ && cd "/venvs/ansible-lint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip ansible-lint RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/djlint" \ && cd "/venvs/djlint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip djlint RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/pylint" \ && cd "/venvs/pylint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip pylint typing-extensions RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/black" \ && cd "/venvs/black" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip black RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/flake8" \ && cd "/venvs/flake8" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip flake8 RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/isort" \ && cd "/venvs/isort" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip isort black RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/bandit" \ && cd "/venvs/bandit" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip bandit bandit_sarif_formatter bandit[toml] RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/mypy" \ && cd "/venvs/mypy" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip mypy RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/pyright" \ && cd "/venvs/pyright" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip pyright RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/checkov" \ && cd "/venvs/checkov" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip packaging checkov RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/semgrep" \ && cd "/venvs/semgrep" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip semgrep RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/rst-lint" \ && cd "/venvs/rst-lint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip restructuredtext_lint RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/rstcheck" \ && cd "/venvs/rstcheck" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip rstcheck RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/rstfmt" \ && cd "/venvs/rstfmt" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip rstfmt RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/snakemake" \ && cd "/venvs/snakemake" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakemake RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/snakefmt" \ && cd "/venvs/snakefmt" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakefmt RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/proselint" \ && cd "/venvs/proselint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip proselint RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/sqlfluff" \ && cd "/venvs/sqlfluff" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip sqlfluff RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/yamllint" \ && cd "/venvs/yamllint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip yamllint diff --git a/flavors/ruby/Dockerfile b/flavors/ruby/Dockerfile index b7e0422909e..a4cfdb31252 100644 --- a/flavors/ruby/Dockerfile +++ b/flavors/ruby/Dockerfile @@ -215,55 +215,64 @@ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/ansible-lint" \ && cd "/venvs/ansible-lint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip ansible-lint RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/djlint" \ && cd "/venvs/djlint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip djlint RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/checkov" \ && cd "/venvs/checkov" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip packaging checkov RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/semgrep" \ && cd "/venvs/semgrep" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip semgrep RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/snakemake" \ && cd "/venvs/snakemake" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakemake RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/snakefmt" \ && cd "/venvs/snakefmt" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakefmt RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/proselint" \ && cd "/venvs/proselint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip proselint RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/sqlfluff" \ && cd "/venvs/sqlfluff" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip sqlfluff RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/yamllint" \ && cd "/venvs/yamllint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip yamllint diff --git a/flavors/rust/Dockerfile b/flavors/rust/Dockerfile index b02adc78e04..7fc65e3bd31 100644 --- a/flavors/rust/Dockerfile +++ b/flavors/rust/Dockerfile @@ -58,12 +58,12 @@ RUN rustup-init -y --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-u RUN --mount=type=cache,id=cargo-${TARGETARCH},sharing=locked,target=/cargo/.cargo/registry/,uid=63425 \ . /cargo/.cargo/env \ - && cargo binstall --no-confirm --no-symlinks sarif-fmt shellcheck-sarif --root /tmp --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") + && cargo binstall --no-confirm --no-symlinks shellcheck-sarif sarif-fmt --root /tmp --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") FROM scratch AS cargo COPY --link --from=cargo-build /tmp/bin/* /bin/ -RUN ["/bin/sarif-fmt", "--help"] RUN ["/bin/shellcheck-sarif", "--help"] +RUN ["/bin/sarif-fmt", "--help"] #FROM__END @@ -253,55 +253,64 @@ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/ansible-lint" \ && cd "/venvs/ansible-lint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip ansible-lint RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/djlint" \ && cd "/venvs/djlint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip djlint RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/checkov" \ && cd "/venvs/checkov" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip packaging checkov RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/semgrep" \ && cd "/venvs/semgrep" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip semgrep RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/snakemake" \ && cd "/venvs/snakemake" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakemake RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/snakefmt" \ && cd "/venvs/snakefmt" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakefmt RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/proselint" \ && cd "/venvs/proselint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip proselint RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/sqlfluff" \ && cd "/venvs/sqlfluff" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip sqlfluff RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/yamllint" \ && cd "/venvs/yamllint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip yamllint diff --git a/flavors/salesforce/Dockerfile b/flavors/salesforce/Dockerfile index c511437b530..6c2dd369a87 100644 --- a/flavors/salesforce/Dockerfile +++ b/flavors/salesforce/Dockerfile @@ -218,55 +218,64 @@ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/ansible-lint" \ && cd "/venvs/ansible-lint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip ansible-lint RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/djlint" \ && cd "/venvs/djlint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip djlint RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/checkov" \ && cd "/venvs/checkov" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip packaging checkov RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/semgrep" \ && cd "/venvs/semgrep" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip semgrep RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/snakemake" \ && cd "/venvs/snakemake" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakemake RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/snakefmt" \ && cd "/venvs/snakefmt" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakefmt RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/proselint" \ && cd "/venvs/proselint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip proselint RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/sqlfluff" \ && cd "/venvs/sqlfluff" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip sqlfluff RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/yamllint" \ && cd "/venvs/yamllint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip yamllint diff --git a/flavors/security/Dockerfile b/flavors/security/Dockerfile index 42bb88d7b09..07b5438d2d0 100644 --- a/flavors/security/Dockerfile +++ b/flavors/security/Dockerfile @@ -184,31 +184,36 @@ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/ansible-lint" \ && cd "/venvs/ansible-lint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip ansible-lint RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/cfn-lint" \ && cd "/venvs/cfn-lint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip cfn-lint RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/bandit" \ && cd "/venvs/bandit" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip bandit bandit_sarif_formatter bandit[toml] RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/checkov" \ && cd "/venvs/checkov" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip packaging checkov RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/semgrep" \ && cd "/venvs/semgrep" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip semgrep diff --git a/flavors/swift/Dockerfile b/flavors/swift/Dockerfile index 510d9c12c42..e9eb8b5b94d 100644 --- a/flavors/swift/Dockerfile +++ b/flavors/swift/Dockerfile @@ -215,55 +215,64 @@ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/ansible-lint" \ && cd "/venvs/ansible-lint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip ansible-lint RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/djlint" \ && cd "/venvs/djlint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip djlint RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/checkov" \ && cd "/venvs/checkov" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip packaging checkov RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/semgrep" \ && cd "/venvs/semgrep" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip semgrep RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/snakemake" \ && cd "/venvs/snakemake" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakemake RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/snakefmt" \ && cd "/venvs/snakefmt" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakefmt RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/proselint" \ && cd "/venvs/proselint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip proselint RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/sqlfluff" \ && cd "/venvs/sqlfluff" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip sqlfluff RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/yamllint" \ && cd "/venvs/yamllint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip yamllint diff --git a/flavors/terraform/Dockerfile b/flavors/terraform/Dockerfile index f0e58cdd300..4ff36e81050 100644 --- a/flavors/terraform/Dockerfile +++ b/flavors/terraform/Dockerfile @@ -227,55 +227,64 @@ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/ansible-lint" \ && cd "/venvs/ansible-lint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip ansible-lint RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/djlint" \ && cd "/venvs/djlint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip djlint RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/checkov" \ && cd "/venvs/checkov" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip packaging checkov RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/semgrep" \ && cd "/venvs/semgrep" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip semgrep RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/snakemake" \ && cd "/venvs/snakemake" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakemake RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/snakefmt" \ && cd "/venvs/snakefmt" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakefmt RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/proselint" \ && cd "/venvs/proselint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip proselint RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/sqlfluff" \ && cd "/venvs/sqlfluff" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip sqlfluff RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/yamllint" \ && cd "/venvs/yamllint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip yamllint diff --git a/linters/ansible_ansible_lint/Dockerfile b/linters/ansible_ansible_lint/Dockerfile index 0261eb7a782..32384b6e78a 100644 --- a/linters/ansible_ansible_lint/Dockerfile +++ b/linters/ansible_ansible_lint/Dockerfile @@ -117,7 +117,8 @@ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/ansible-lint" \ && cd "/venvs/ansible-lint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip ansible-lint diff --git a/linters/c_cpplint/Dockerfile b/linters/c_cpplint/Dockerfile index c0dec231a4e..5bb2871aca6 100644 --- a/linters/c_cpplint/Dockerfile +++ b/linters/c_cpplint/Dockerfile @@ -117,7 +117,8 @@ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/cpplint" \ && cd "/venvs/cpplint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip cpplint diff --git a/linters/cloudformation_cfn_lint/Dockerfile b/linters/cloudformation_cfn_lint/Dockerfile index d23fd9ed079..c57a85a2477 100644 --- a/linters/cloudformation_cfn_lint/Dockerfile +++ b/linters/cloudformation_cfn_lint/Dockerfile @@ -117,7 +117,8 @@ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/cfn-lint" \ && cd "/venvs/cfn-lint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip cfn-lint diff --git a/linters/cpp_cpplint/Dockerfile b/linters/cpp_cpplint/Dockerfile index 478f5928f89..04301dc323e 100644 --- a/linters/cpp_cpplint/Dockerfile +++ b/linters/cpp_cpplint/Dockerfile @@ -117,7 +117,8 @@ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/cpplint" \ && cd "/venvs/cpplint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip cpplint diff --git a/linters/html_djlint/Dockerfile b/linters/html_djlint/Dockerfile index a4cf4f436d0..5a1701d8c72 100644 --- a/linters/html_djlint/Dockerfile +++ b/linters/html_djlint/Dockerfile @@ -117,7 +117,8 @@ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/djlint" \ && cd "/venvs/djlint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip djlint diff --git a/linters/python_bandit/Dockerfile b/linters/python_bandit/Dockerfile index 7ff7c1a886d..b15b5de7421 100644 --- a/linters/python_bandit/Dockerfile +++ b/linters/python_bandit/Dockerfile @@ -119,7 +119,8 @@ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/bandit" \ && cd "/venvs/bandit" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip bandit bandit_sarif_formatter bandit[toml] diff --git a/linters/python_black/Dockerfile b/linters/python_black/Dockerfile index 1ac3c84a6f6..6d818026f20 100644 --- a/linters/python_black/Dockerfile +++ b/linters/python_black/Dockerfile @@ -117,7 +117,8 @@ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/black" \ && cd "/venvs/black" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip black diff --git a/linters/python_flake8/Dockerfile b/linters/python_flake8/Dockerfile index a87e5998bb2..b541d54ffcb 100644 --- a/linters/python_flake8/Dockerfile +++ b/linters/python_flake8/Dockerfile @@ -117,7 +117,8 @@ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/flake8" \ && cd "/venvs/flake8" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip flake8 diff --git a/linters/python_isort/Dockerfile b/linters/python_isort/Dockerfile index a9a9f70db2c..c42dea240a2 100644 --- a/linters/python_isort/Dockerfile +++ b/linters/python_isort/Dockerfile @@ -118,7 +118,8 @@ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/isort" \ && cd "/venvs/isort" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip isort black diff --git a/linters/python_mypy/Dockerfile b/linters/python_mypy/Dockerfile index 8c06ec54f7d..daea3b05547 100644 --- a/linters/python_mypy/Dockerfile +++ b/linters/python_mypy/Dockerfile @@ -117,7 +117,8 @@ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/mypy" \ && cd "/venvs/mypy" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip mypy diff --git a/linters/python_pylint/Dockerfile b/linters/python_pylint/Dockerfile index ce8d335c069..d1afbbd9020 100644 --- a/linters/python_pylint/Dockerfile +++ b/linters/python_pylint/Dockerfile @@ -118,7 +118,8 @@ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/pylint" \ && cd "/venvs/pylint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip pylint typing-extensions diff --git a/linters/python_pyright/Dockerfile b/linters/python_pyright/Dockerfile index 3a4ef247f98..a3e07fbea50 100644 --- a/linters/python_pyright/Dockerfile +++ b/linters/python_pyright/Dockerfile @@ -117,7 +117,8 @@ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/pyright" \ && cd "/venvs/pyright" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip pyright diff --git a/linters/repository_checkov/Dockerfile b/linters/repository_checkov/Dockerfile index 8748e27267e..6a197a1288b 100644 --- a/linters/repository_checkov/Dockerfile +++ b/linters/repository_checkov/Dockerfile @@ -120,7 +120,8 @@ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/checkov" \ && cd "/venvs/checkov" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip packaging checkov diff --git a/linters/repository_semgrep/Dockerfile b/linters/repository_semgrep/Dockerfile index 53b6c8d0ef2..cdc016006fd 100644 --- a/linters/repository_semgrep/Dockerfile +++ b/linters/repository_semgrep/Dockerfile @@ -119,7 +119,8 @@ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/semgrep" \ && cd "/venvs/semgrep" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip semgrep diff --git a/linters/rst_rst_lint/Dockerfile b/linters/rst_rst_lint/Dockerfile index 03eac6b130d..4bdede4d618 100644 --- a/linters/rst_rst_lint/Dockerfile +++ b/linters/rst_rst_lint/Dockerfile @@ -117,7 +117,8 @@ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/rst-lint" \ && cd "/venvs/rst-lint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip restructuredtext_lint diff --git a/linters/rst_rstcheck/Dockerfile b/linters/rst_rstcheck/Dockerfile index 106879d2ffe..992146e822e 100644 --- a/linters/rst_rstcheck/Dockerfile +++ b/linters/rst_rstcheck/Dockerfile @@ -117,7 +117,8 @@ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/rstcheck" \ && cd "/venvs/rstcheck" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip rstcheck diff --git a/linters/rst_rstfmt/Dockerfile b/linters/rst_rstfmt/Dockerfile index 01460883b8d..aaaa69464db 100644 --- a/linters/rst_rstfmt/Dockerfile +++ b/linters/rst_rstfmt/Dockerfile @@ -117,7 +117,8 @@ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/rstfmt" \ && cd "/venvs/rstfmt" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip rstfmt diff --git a/linters/snakemake_lint/Dockerfile b/linters/snakemake_lint/Dockerfile index dad7ff39629..d87377fcf7b 100644 --- a/linters/snakemake_lint/Dockerfile +++ b/linters/snakemake_lint/Dockerfile @@ -117,7 +117,8 @@ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/snakemake" \ && cd "/venvs/snakemake" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakemake diff --git a/linters/snakemake_snakefmt/Dockerfile b/linters/snakemake_snakefmt/Dockerfile index 05b4c7cce11..9eeb4df2cc3 100644 --- a/linters/snakemake_snakefmt/Dockerfile +++ b/linters/snakemake_snakefmt/Dockerfile @@ -117,7 +117,8 @@ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/snakefmt" \ && cd "/venvs/snakefmt" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip snakefmt diff --git a/linters/spell_proselint/Dockerfile b/linters/spell_proselint/Dockerfile index db74a1cf4e9..c7a7465d878 100644 --- a/linters/spell_proselint/Dockerfile +++ b/linters/spell_proselint/Dockerfile @@ -117,7 +117,8 @@ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/proselint" \ && cd "/venvs/proselint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip proselint diff --git a/linters/sql_sqlfluff/Dockerfile b/linters/sql_sqlfluff/Dockerfile index 41a5e3b6569..a54b5752d00 100644 --- a/linters/sql_sqlfluff/Dockerfile +++ b/linters/sql_sqlfluff/Dockerfile @@ -117,7 +117,8 @@ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/sqlfluff" \ && cd "/venvs/sqlfluff" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip sqlfluff diff --git a/linters/yaml_yamllint/Dockerfile b/linters/yaml_yamllint/Dockerfile index 3e8581ad91f..e2a795e535c 100644 --- a/linters/yaml_yamllint/Dockerfile +++ b/linters/yaml_yamllint/Dockerfile @@ -117,7 +117,8 @@ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/yamllint" \ && cd "/venvs/yamllint" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && source bin/activate \ && PYTHONDONTWRITEBYTECODE=1 pip3 --disable-pip-version-check install --find-links=/download --cache-dir=/var/cache/pip yamllint From f7ee3cb33a08eeb504da06473ff7bf019cc302c2 Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Wed, 26 Jul 2023 08:34:12 -0500 Subject: [PATCH 098/105] Break down a run command to see wqhere the time is being spent --- Dockerfile | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index c554d34785e..83500bc75f3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -376,6 +376,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -386,8 +387,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# @@ -927,13 +928,13 @@ RUN ln -s /lib/libc.so.6 /usr/lib/libresolv.so.2 && \ curl --retry 5 --retry-delay 5 -sLv https://raw.githubusercontent.com/kubescape/kubescape/master/install.sh | /bin/bash -s -- -v v2.3.6 \ # # chktex installation - && cd ~ && touch .chktexrc && cd / \ +RUN cd ~ && touch .chktexrc && cd / \ # # luacheck installation - && luarocks-5.3 install luacheck \ +RUN luarocks-5.3 install luacheck \ # # perlcritic installation - && curl --retry 5 --retry-delay 5 -sL https://cpanmin.us/ | perl - -nq --no-wget Perl::Critic +RUN curl --retry 5 --retry-delay 5 -sL https://cpanmin.us/ | perl - -nq --no-wget Perl::Critic # # 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 From f171b77e0322ef28add319d53c96534872d3ef06 Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Wed, 26 Jul 2023 08:59:29 -0500 Subject: [PATCH 099/105] Remove sdfx-hardis --- Dockerfile | 11 ++++------- flavors/ci_light/Dockerfile | 5 +++-- flavors/cupcake/Dockerfile | 5 +++-- flavors/documentation/Dockerfile | 5 +++-- flavors/dotnet/Dockerfile | 5 +++-- flavors/dotnetweb/Dockerfile | 5 +++-- flavors/go/Dockerfile | 5 +++-- flavors/java/Dockerfile | 5 +++-- flavors/javascript/Dockerfile | 5 +++-- flavors/php/Dockerfile | 5 +++-- flavors/python/Dockerfile | 5 +++-- flavors/ruby/Dockerfile | 5 +++-- flavors/rust/Dockerfile | 5 +++-- flavors/salesforce/Dockerfile | 10 ++++------ flavors/security/Dockerfile | 5 +++-- flavors/swift/Dockerfile | 5 +++-- flavors/terraform/Dockerfile | 5 +++-- linters/action_actionlint/Dockerfile | 5 +++-- linters/ansible_ansible_lint/Dockerfile | 5 +++-- linters/arm_arm_ttk/Dockerfile | 5 +++-- linters/bash_exec/Dockerfile | 5 +++-- linters/bash_shellcheck/Dockerfile | 5 +++-- linters/bash_shfmt/Dockerfile | 5 +++-- linters/bicep_bicep_linter/Dockerfile | 5 +++-- linters/c_cpplint/Dockerfile | 5 +++-- linters/clojure_clj_kondo/Dockerfile | 5 +++-- linters/clojure_cljstyle/Dockerfile | 5 +++-- linters/cloudformation_cfn_lint/Dockerfile | 5 +++-- linters/coffee_coffeelint/Dockerfile | 5 +++-- linters/copypaste_jscpd/Dockerfile | 5 +++-- linters/cpp_cpplint/Dockerfile | 5 +++-- linters/csharp_csharpier/Dockerfile | 5 +++-- linters/csharp_dotnet_format/Dockerfile | 5 +++-- linters/css_scss_lint/Dockerfile | 5 +++-- linters/css_stylelint/Dockerfile | 5 +++-- linters/dart_dartanalyzer/Dockerfile | 5 +++-- linters/dockerfile_hadolint/Dockerfile | 5 +++-- .../editorconfig_editorconfig_checker/Dockerfile | 5 +++-- linters/env_dotenv_linter/Dockerfile | 5 +++-- linters/gherkin_gherkin_lint/Dockerfile | 5 +++-- linters/go_golangci_lint/Dockerfile | 5 +++-- linters/go_revive/Dockerfile | 5 +++-- linters/graphql_graphql_schema_linter/Dockerfile | 5 +++-- linters/groovy_npm_groovy_lint/Dockerfile | 5 +++-- linters/html_djlint/Dockerfile | 5 +++-- linters/html_htmlhint/Dockerfile | 5 +++-- linters/java_checkstyle/Dockerfile | 5 +++-- linters/java_pmd/Dockerfile | 5 +++-- linters/javascript_es/Dockerfile | 5 +++-- linters/javascript_prettier/Dockerfile | 5 +++-- linters/javascript_standard/Dockerfile | 5 +++-- linters/json_eslint_plugin_jsonc/Dockerfile | 5 +++-- linters/json_jsonlint/Dockerfile | 5 +++-- linters/json_npm_package_json_lint/Dockerfile | 5 +++-- linters/json_prettier/Dockerfile | 5 +++-- linters/json_v8r/Dockerfile | 5 +++-- linters/jsx_eslint/Dockerfile | 5 +++-- linters/kotlin_ktlint/Dockerfile | 5 +++-- linters/kubernetes_helm/Dockerfile | 5 +++-- linters/kubernetes_kubeconform/Dockerfile | 5 +++-- linters/kubernetes_kubescape/Dockerfile | 5 +++-- linters/latex_chktex/Dockerfile | 5 +++-- linters/lua_luacheck/Dockerfile | 5 +++-- linters/makefile_checkmake/Dockerfile | 5 +++-- linters/markdown_markdown_link_check/Dockerfile | 5 +++-- .../markdown_markdown_table_formatter/Dockerfile | 5 +++-- linters/markdown_markdownlint/Dockerfile | 5 +++-- linters/markdown_remark_lint/Dockerfile | 5 +++-- linters/openapi_spectral/Dockerfile | 5 +++-- linters/perl_perlcritic/Dockerfile | 5 +++-- linters/php_phpcs/Dockerfile | 5 +++-- linters/php_phplint/Dockerfile | 5 +++-- linters/php_phpstan/Dockerfile | 5 +++-- linters/php_psalm/Dockerfile | 5 +++-- linters/powershell_powershell/Dockerfile | 5 +++-- .../powershell_powershell_formatter/Dockerfile | 5 +++-- linters/protobuf_protolint/Dockerfile | 5 +++-- linters/puppet_puppet_lint/Dockerfile | 5 +++-- linters/python_bandit/Dockerfile | 5 +++-- linters/python_black/Dockerfile | 5 +++-- linters/python_flake8/Dockerfile | 5 +++-- linters/python_isort/Dockerfile | 5 +++-- linters/python_mypy/Dockerfile | 5 +++-- linters/python_pylint/Dockerfile | 5 +++-- linters/python_pyright/Dockerfile | 5 +++-- linters/python_ruff/Dockerfile | 5 +++-- linters/r_lintr/Dockerfile | 5 +++-- linters/raku_raku/Dockerfile | 5 +++-- linters/repository_checkov/Dockerfile | 5 +++-- linters/repository_devskim/Dockerfile | 5 +++-- linters/repository_dustilock/Dockerfile | 5 +++-- linters/repository_git_diff/Dockerfile | 5 +++-- linters/repository_gitleaks/Dockerfile | 5 +++-- linters/repository_grype/Dockerfile | 5 +++-- linters/repository_kics/Dockerfile | 5 +++-- linters/repository_secretlint/Dockerfile | 5 +++-- linters/repository_semgrep/Dockerfile | 5 +++-- linters/repository_syft/Dockerfile | 5 +++-- linters/repository_trivy/Dockerfile | 5 +++-- linters/repository_trivy_sbom/Dockerfile | 5 +++-- linters/repository_trufflehog/Dockerfile | 5 +++-- linters/rst_rst_lint/Dockerfile | 5 +++-- linters/rst_rstcheck/Dockerfile | 5 +++-- linters/rst_rstfmt/Dockerfile | 5 +++-- linters/ruby_rubocop/Dockerfile | 5 +++-- linters/rust_clippy/Dockerfile | 5 +++-- linters/salesforce_sfdx_scanner_apex/Dockerfile | 10 ++++------ linters/salesforce_sfdx_scanner_aura/Dockerfile | 10 ++++------ linters/salesforce_sfdx_scanner_lwc/Dockerfile | 10 ++++------ linters/scala_scalafix/Dockerfile | 5 +++-- linters/snakemake_lint/Dockerfile | 5 +++-- linters/snakemake_snakefmt/Dockerfile | 5 +++-- linters/spell_cspell/Dockerfile | 5 +++-- linters/spell_lychee/Dockerfile | 5 +++-- linters/spell_proselint/Dockerfile | 5 +++-- linters/spell_vale/Dockerfile | 5 +++-- linters/sql_sql_lint/Dockerfile | 5 +++-- linters/sql_sqlfluff/Dockerfile | 5 +++-- linters/sql_tsqllint/Dockerfile | 5 +++-- linters/swift_swiftlint/Dockerfile | 5 +++-- linters/tekton_tekton_lint/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 | 5 +++-- linters/typescript_es/Dockerfile | 5 +++-- linters/typescript_prettier/Dockerfile | 5 +++-- linters/typescript_standard/Dockerfile | 5 +++-- linters/vbdotnet_dotnet_format/Dockerfile | 5 +++-- linters/xml_xmllint/Dockerfile | 5 +++-- linters/yaml_prettier/Dockerfile | 5 +++-- linters/yaml_v8r/Dockerfile | 5 +++-- linters/yaml_yamllint/Dockerfile | 5 +++-- .../salesforce.megalinter-descriptor.yml | 16 ---------------- 135 files changed, 407 insertions(+), 305 deletions(-) diff --git a/Dockerfile b/Dockerfile index 83500bc75f3..d2edb8ca4a8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -862,9 +862,6 @@ RUN --mount=type=secret,id=GITHUB_TOKEN case ${TARGETPLATFORM} in \ # ENV JAVA_HOME=/usr/lib/jvm/java-11-openjdk # Next line commented because already managed by another linter # ENV PATH="$JAVA_HOME/bin:${PATH}" -RUN echo y|sfdx plugins:install sfdx-hardis \ - && npm cache clean --force || true \ - && rm -rf /root/.npm/_cacache \ # # VBDOTNET installation # Next line commented because already managed by another linter @@ -875,7 +872,7 @@ RUN echo y|sfdx plugins:install sfdx-hardis \ # ENV PATH="${PATH}:/root/.dotnet/tools:/usr/share/dotnet" # # bicep_linter installation - && case ${TARGETPLATFORM} in \ +RUN case ${TARGETPLATFORM} in \ "linux/amd64") POWERSHELL_ARCH=musl-x64 ;; \ "linux/arm64") POWERSHELL_ARCH=arm64 ;; \ esac \ @@ -928,13 +925,13 @@ RUN ln -s /lib/libc.so.6 /usr/lib/libresolv.so.2 && \ curl --retry 5 --retry-delay 5 -sLv https://raw.githubusercontent.com/kubescape/kubescape/master/install.sh | /bin/bash -s -- -v v2.3.6 \ # # chktex installation -RUN cd ~ && touch .chktexrc && cd / \ + && cd ~ && touch .chktexrc && cd / \ # # luacheck installation -RUN luarocks-5.3 install luacheck \ + && luarocks-5.3 install luacheck \ # # perlcritic installation -RUN curl --retry 5 --retry-delay 5 -sL https://cpanmin.us/ | perl - -nq --no-wget Perl::Critic + && curl --retry 5 --retry-delay 5 -sL https://cpanmin.us/ | perl - -nq --no-wget Perl::Critic # # 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 diff --git a/flavors/ci_light/Dockerfile b/flavors/ci_light/Dockerfile index 363c7109051..cddd863ef82 100644 --- a/flavors/ci_light/Dockerfile +++ b/flavors/ci_light/Dockerfile @@ -139,6 +139,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -149,8 +150,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/flavors/cupcake/Dockerfile b/flavors/cupcake/Dockerfile index 57aa8f2d8b9..f874a18d230 100644 --- a/flavors/cupcake/Dockerfile +++ b/flavors/cupcake/Dockerfile @@ -327,6 +327,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -337,8 +338,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/flavors/documentation/Dockerfile b/flavors/documentation/Dockerfile index 0702009594b..82490179599 100644 --- a/flavors/documentation/Dockerfile +++ b/flavors/documentation/Dockerfile @@ -195,6 +195,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -205,8 +206,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/flavors/dotnet/Dockerfile b/flavors/dotnet/Dockerfile index 22727cc2255..256ecb45e0b 100644 --- a/flavors/dotnet/Dockerfile +++ b/flavors/dotnet/Dockerfile @@ -211,6 +211,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -221,8 +222,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/flavors/dotnetweb/Dockerfile b/flavors/dotnetweb/Dockerfile index b2e8b9261ce..19cb801192d 100644 --- a/flavors/dotnetweb/Dockerfile +++ b/flavors/dotnetweb/Dockerfile @@ -231,6 +231,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -241,8 +242,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/flavors/go/Dockerfile b/flavors/go/Dockerfile index 14ffe2d2b1b..3353b741101 100644 --- a/flavors/go/Dockerfile +++ b/flavors/go/Dockerfile @@ -211,6 +211,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -221,8 +222,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/flavors/java/Dockerfile b/flavors/java/Dockerfile index cdfadee3fd6..d11b0c5897c 100644 --- a/flavors/java/Dockerfile +++ b/flavors/java/Dockerfile @@ -205,6 +205,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -215,8 +216,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/flavors/javascript/Dockerfile b/flavors/javascript/Dockerfile index 07900ea8ff1..0b29aed945d 100644 --- a/flavors/javascript/Dockerfile +++ b/flavors/javascript/Dockerfile @@ -215,6 +215,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -225,8 +226,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/flavors/php/Dockerfile b/flavors/php/Dockerfile index 0686f020cbf..7434771dbb9 100644 --- a/flavors/php/Dockerfile +++ b/flavors/php/Dockerfile @@ -213,6 +213,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -223,8 +224,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/flavors/python/Dockerfile b/flavors/python/Dockerfile index 170c599b553..c4e86e3c3f3 100644 --- a/flavors/python/Dockerfile +++ b/flavors/python/Dockerfile @@ -219,6 +219,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -229,8 +230,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/flavors/ruby/Dockerfile b/flavors/ruby/Dockerfile index a4cfdb31252..f736318e845 100644 --- a/flavors/ruby/Dockerfile +++ b/flavors/ruby/Dockerfile @@ -193,6 +193,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -203,8 +204,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/flavors/rust/Dockerfile b/flavors/rust/Dockerfile index 7fc65e3bd31..ab92e499445 100644 --- a/flavors/rust/Dockerfile +++ b/flavors/rust/Dockerfile @@ -231,6 +231,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -241,8 +242,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/flavors/salesforce/Dockerfile b/flavors/salesforce/Dockerfile index 6c2dd369a87..4236667cc9f 100644 --- a/flavors/salesforce/Dockerfile +++ b/flavors/salesforce/Dockerfile @@ -196,6 +196,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -206,8 +207,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# @@ -407,12 +408,9 @@ COPY --from=copy-collector / / # SALESFORCE installation 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 \ # # kubescape installation - && ln -s /lib/libc.so.6 /usr/lib/libresolv.so.2 && \ +RUN ln -s /lib/libc.so.6 /usr/lib/libresolv.so.2 && \ curl --retry 5 --retry-delay 5 -sLv https://raw.githubusercontent.com/kubescape/kubescape/master/install.sh | /bin/bash -s -- -v v2.3.6 \ # # grype installation diff --git a/flavors/security/Dockerfile b/flavors/security/Dockerfile index 07b5438d2d0..7cca4d546ed 100644 --- a/flavors/security/Dockerfile +++ b/flavors/security/Dockerfile @@ -162,6 +162,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -172,8 +173,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/flavors/swift/Dockerfile b/flavors/swift/Dockerfile index e9eb8b5b94d..06968d75ada 100644 --- a/flavors/swift/Dockerfile +++ b/flavors/swift/Dockerfile @@ -193,6 +193,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -203,8 +204,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/flavors/terraform/Dockerfile b/flavors/terraform/Dockerfile index 4ff36e81050..5af3c89d78f 100644 --- a/flavors/terraform/Dockerfile +++ b/flavors/terraform/Dockerfile @@ -205,6 +205,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -215,8 +216,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/action_actionlint/Dockerfile b/linters/action_actionlint/Dockerfile index 0b1f02a8a0e..33aa363d9bc 100644 --- a/linters/action_actionlint/Dockerfile +++ b/linters/action_actionlint/Dockerfile @@ -96,6 +96,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -106,8 +107,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/ansible_ansible_lint/Dockerfile b/linters/ansible_ansible_lint/Dockerfile index 32384b6e78a..e869bacb90e 100644 --- a/linters/ansible_ansible_lint/Dockerfile +++ b/linters/ansible_ansible_lint/Dockerfile @@ -95,6 +95,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -105,8 +106,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/arm_arm_ttk/Dockerfile b/linters/arm_arm_ttk/Dockerfile index 1371ecf8304..513a0b6f1f5 100644 --- a/linters/arm_arm_ttk/Dockerfile +++ b/linters/arm_arm_ttk/Dockerfile @@ -101,6 +101,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -111,8 +112,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/bash_exec/Dockerfile b/linters/bash_exec/Dockerfile index 51412ef0eb1..0ded0db172a 100644 --- a/linters/bash_exec/Dockerfile +++ b/linters/bash_exec/Dockerfile @@ -94,6 +94,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -104,8 +105,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/bash_shellcheck/Dockerfile b/linters/bash_shellcheck/Dockerfile index 98e6c6f8a6b..cc7eda56e83 100644 --- a/linters/bash_shellcheck/Dockerfile +++ b/linters/bash_shellcheck/Dockerfile @@ -90,6 +90,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -100,8 +101,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/bash_shfmt/Dockerfile b/linters/bash_shfmt/Dockerfile index 02e5b4dd65a..42ee718564a 100644 --- a/linters/bash_shfmt/Dockerfile +++ b/linters/bash_shfmt/Dockerfile @@ -90,6 +90,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -100,8 +101,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/bicep_bicep_linter/Dockerfile b/linters/bicep_bicep_linter/Dockerfile index b8afa2544d2..d402a1469e6 100644 --- a/linters/bicep_bicep_linter/Dockerfile +++ b/linters/bicep_bicep_linter/Dockerfile @@ -90,6 +90,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -100,8 +101,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/c_cpplint/Dockerfile b/linters/c_cpplint/Dockerfile index 5bb2871aca6..28265a98180 100644 --- a/linters/c_cpplint/Dockerfile +++ b/linters/c_cpplint/Dockerfile @@ -95,6 +95,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -105,8 +106,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/clojure_clj_kondo/Dockerfile b/linters/clojure_clj_kondo/Dockerfile index 9c15b3d74a9..f3df8200c86 100644 --- a/linters/clojure_clj_kondo/Dockerfile +++ b/linters/clojure_clj_kondo/Dockerfile @@ -90,6 +90,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -100,8 +101,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/clojure_cljstyle/Dockerfile b/linters/clojure_cljstyle/Dockerfile index 2306f908c4c..9c574d365ee 100644 --- a/linters/clojure_cljstyle/Dockerfile +++ b/linters/clojure_cljstyle/Dockerfile @@ -90,6 +90,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -100,8 +101,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/cloudformation_cfn_lint/Dockerfile b/linters/cloudformation_cfn_lint/Dockerfile index c57a85a2477..343ee289590 100644 --- a/linters/cloudformation_cfn_lint/Dockerfile +++ b/linters/cloudformation_cfn_lint/Dockerfile @@ -95,6 +95,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -105,8 +106,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/coffee_coffeelint/Dockerfile b/linters/coffee_coffeelint/Dockerfile index dfa3dee5dc9..500ec75aae6 100644 --- a/linters/coffee_coffeelint/Dockerfile +++ b/linters/coffee_coffeelint/Dockerfile @@ -110,6 +110,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -120,8 +121,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/copypaste_jscpd/Dockerfile b/linters/copypaste_jscpd/Dockerfile index 6fac5511f08..68500dba150 100644 --- a/linters/copypaste_jscpd/Dockerfile +++ b/linters/copypaste_jscpd/Dockerfile @@ -110,6 +110,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -120,8 +121,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/cpp_cpplint/Dockerfile b/linters/cpp_cpplint/Dockerfile index 04301dc323e..7a929455fe4 100644 --- a/linters/cpp_cpplint/Dockerfile +++ b/linters/cpp_cpplint/Dockerfile @@ -95,6 +95,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -105,8 +106,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/csharp_csharpier/Dockerfile b/linters/csharp_csharpier/Dockerfile index b07600ddb61..5fa1a375ecb 100644 --- a/linters/csharp_csharpier/Dockerfile +++ b/linters/csharp_csharpier/Dockerfile @@ -90,6 +90,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -100,8 +101,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/csharp_dotnet_format/Dockerfile b/linters/csharp_dotnet_format/Dockerfile index d9af19769fd..cdf6ed2dfab 100644 --- a/linters/csharp_dotnet_format/Dockerfile +++ b/linters/csharp_dotnet_format/Dockerfile @@ -90,6 +90,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -100,8 +101,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/css_scss_lint/Dockerfile b/linters/css_scss_lint/Dockerfile index 1fd48691cb3..cb64493771b 100644 --- a/linters/css_scss_lint/Dockerfile +++ b/linters/css_scss_lint/Dockerfile @@ -90,6 +90,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -100,8 +101,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/css_stylelint/Dockerfile b/linters/css_stylelint/Dockerfile index a5af6b20f4e..99913ee4070 100644 --- a/linters/css_stylelint/Dockerfile +++ b/linters/css_stylelint/Dockerfile @@ -113,6 +113,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -123,8 +124,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/dart_dartanalyzer/Dockerfile b/linters/dart_dartanalyzer/Dockerfile index 032255582ec..e79b7842ada 100644 --- a/linters/dart_dartanalyzer/Dockerfile +++ b/linters/dart_dartanalyzer/Dockerfile @@ -90,6 +90,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -100,8 +101,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/dockerfile_hadolint/Dockerfile b/linters/dockerfile_hadolint/Dockerfile index e0013f13ea4..21f591f477d 100644 --- a/linters/dockerfile_hadolint/Dockerfile +++ b/linters/dockerfile_hadolint/Dockerfile @@ -90,6 +90,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -100,8 +101,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/editorconfig_editorconfig_checker/Dockerfile b/linters/editorconfig_editorconfig_checker/Dockerfile index 6c67c4bced7..cc260accccd 100644 --- a/linters/editorconfig_editorconfig_checker/Dockerfile +++ b/linters/editorconfig_editorconfig_checker/Dockerfile @@ -90,6 +90,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -100,8 +101,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/env_dotenv_linter/Dockerfile b/linters/env_dotenv_linter/Dockerfile index 8416a54c282..44fb24ba605 100644 --- a/linters/env_dotenv_linter/Dockerfile +++ b/linters/env_dotenv_linter/Dockerfile @@ -90,6 +90,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -100,8 +101,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/gherkin_gherkin_lint/Dockerfile b/linters/gherkin_gherkin_lint/Dockerfile index 59f73148c8f..fb02f7f44df 100644 --- a/linters/gherkin_gherkin_lint/Dockerfile +++ b/linters/gherkin_gherkin_lint/Dockerfile @@ -110,6 +110,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -120,8 +121,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/go_golangci_lint/Dockerfile b/linters/go_golangci_lint/Dockerfile index 0fdf6641640..3ea391d858e 100644 --- a/linters/go_golangci_lint/Dockerfile +++ b/linters/go_golangci_lint/Dockerfile @@ -90,6 +90,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -100,8 +101,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/go_revive/Dockerfile b/linters/go_revive/Dockerfile index 8dfc9d8f26e..b627a38dcb9 100644 --- a/linters/go_revive/Dockerfile +++ b/linters/go_revive/Dockerfile @@ -104,6 +104,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -114,8 +115,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/graphql_graphql_schema_linter/Dockerfile b/linters/graphql_graphql_schema_linter/Dockerfile index fc01f4bc67c..cc6d356c553 100644 --- a/linters/graphql_graphql_schema_linter/Dockerfile +++ b/linters/graphql_graphql_schema_linter/Dockerfile @@ -111,6 +111,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -121,8 +122,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/groovy_npm_groovy_lint/Dockerfile b/linters/groovy_npm_groovy_lint/Dockerfile index d4f03a127d6..8410e630263 100644 --- a/linters/groovy_npm_groovy_lint/Dockerfile +++ b/linters/groovy_npm_groovy_lint/Dockerfile @@ -110,6 +110,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -120,8 +121,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/html_djlint/Dockerfile b/linters/html_djlint/Dockerfile index 5a1701d8c72..0796f134084 100644 --- a/linters/html_djlint/Dockerfile +++ b/linters/html_djlint/Dockerfile @@ -95,6 +95,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -105,8 +106,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/html_htmlhint/Dockerfile b/linters/html_htmlhint/Dockerfile index d9ffb453399..0c46c23fcd7 100644 --- a/linters/html_htmlhint/Dockerfile +++ b/linters/html_htmlhint/Dockerfile @@ -110,6 +110,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -120,8 +121,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/java_checkstyle/Dockerfile b/linters/java_checkstyle/Dockerfile index 49b52e6cc32..a746e120a0f 100644 --- a/linters/java_checkstyle/Dockerfile +++ b/linters/java_checkstyle/Dockerfile @@ -90,6 +90,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -100,8 +101,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/java_pmd/Dockerfile b/linters/java_pmd/Dockerfile index 09a1cfd7b31..5d53b501b0d 100644 --- a/linters/java_pmd/Dockerfile +++ b/linters/java_pmd/Dockerfile @@ -98,6 +98,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -108,8 +109,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/javascript_es/Dockerfile b/linters/javascript_es/Dockerfile index 2537e4ef05a..835d627ea44 100644 --- a/linters/javascript_es/Dockerfile +++ b/linters/javascript_es/Dockerfile @@ -122,6 +122,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -132,8 +133,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/javascript_prettier/Dockerfile b/linters/javascript_prettier/Dockerfile index 83843bf1ced..604686ed83c 100644 --- a/linters/javascript_prettier/Dockerfile +++ b/linters/javascript_prettier/Dockerfile @@ -110,6 +110,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -120,8 +121,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/javascript_standard/Dockerfile b/linters/javascript_standard/Dockerfile index 953c7bbc3af..7724925c955 100644 --- a/linters/javascript_standard/Dockerfile +++ b/linters/javascript_standard/Dockerfile @@ -110,6 +110,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -120,8 +121,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/json_eslint_plugin_jsonc/Dockerfile b/linters/json_eslint_plugin_jsonc/Dockerfile index 111b043258e..f6141f8790b 100644 --- a/linters/json_eslint_plugin_jsonc/Dockerfile +++ b/linters/json_eslint_plugin_jsonc/Dockerfile @@ -112,6 +112,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -122,8 +123,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/json_jsonlint/Dockerfile b/linters/json_jsonlint/Dockerfile index 21338459b1d..aa0f8705151 100644 --- a/linters/json_jsonlint/Dockerfile +++ b/linters/json_jsonlint/Dockerfile @@ -110,6 +110,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -120,8 +121,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/json_npm_package_json_lint/Dockerfile b/linters/json_npm_package_json_lint/Dockerfile index 982b0f6fb41..93057bcdc7d 100644 --- a/linters/json_npm_package_json_lint/Dockerfile +++ b/linters/json_npm_package_json_lint/Dockerfile @@ -111,6 +111,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -121,8 +122,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/json_prettier/Dockerfile b/linters/json_prettier/Dockerfile index 5dd5188d808..ad02a6cc43e 100644 --- a/linters/json_prettier/Dockerfile +++ b/linters/json_prettier/Dockerfile @@ -110,6 +110,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -120,8 +121,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/json_v8r/Dockerfile b/linters/json_v8r/Dockerfile index 5fe27c3220c..769d0fe2ea4 100644 --- a/linters/json_v8r/Dockerfile +++ b/linters/json_v8r/Dockerfile @@ -110,6 +110,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -120,8 +121,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/jsx_eslint/Dockerfile b/linters/jsx_eslint/Dockerfile index baf403327c2..1dd5db24a11 100644 --- a/linters/jsx_eslint/Dockerfile +++ b/linters/jsx_eslint/Dockerfile @@ -113,6 +113,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -123,8 +124,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/kotlin_ktlint/Dockerfile b/linters/kotlin_ktlint/Dockerfile index 29e2c883968..7aa45c6ed1d 100644 --- a/linters/kotlin_ktlint/Dockerfile +++ b/linters/kotlin_ktlint/Dockerfile @@ -95,6 +95,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -105,8 +106,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/kubernetes_helm/Dockerfile b/linters/kubernetes_helm/Dockerfile index b677fec9a50..1b7eeb88113 100644 --- a/linters/kubernetes_helm/Dockerfile +++ b/linters/kubernetes_helm/Dockerfile @@ -90,6 +90,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -100,8 +101,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/kubernetes_kubeconform/Dockerfile b/linters/kubernetes_kubeconform/Dockerfile index 495b0084424..f38b82e0012 100644 --- a/linters/kubernetes_kubeconform/Dockerfile +++ b/linters/kubernetes_kubeconform/Dockerfile @@ -90,6 +90,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -100,8 +101,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/kubernetes_kubescape/Dockerfile b/linters/kubernetes_kubescape/Dockerfile index d1ebb2c4448..6e6c27ac864 100644 --- a/linters/kubernetes_kubescape/Dockerfile +++ b/linters/kubernetes_kubescape/Dockerfile @@ -90,6 +90,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -100,8 +101,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/latex_chktex/Dockerfile b/linters/latex_chktex/Dockerfile index be9b93a075d..fe38ebd82d1 100644 --- a/linters/latex_chktex/Dockerfile +++ b/linters/latex_chktex/Dockerfile @@ -90,6 +90,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -100,8 +101,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/lua_luacheck/Dockerfile b/linters/lua_luacheck/Dockerfile index 4e7c2fdbc45..0cd69b95d37 100644 --- a/linters/lua_luacheck/Dockerfile +++ b/linters/lua_luacheck/Dockerfile @@ -90,6 +90,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -100,8 +101,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/makefile_checkmake/Dockerfile b/linters/makefile_checkmake/Dockerfile index f828adb510f..fccc5c50109 100644 --- a/linters/makefile_checkmake/Dockerfile +++ b/linters/makefile_checkmake/Dockerfile @@ -90,6 +90,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -100,8 +101,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/markdown_markdown_link_check/Dockerfile b/linters/markdown_markdown_link_check/Dockerfile index c7c50347393..4ee0750903d 100644 --- a/linters/markdown_markdown_link_check/Dockerfile +++ b/linters/markdown_markdown_link_check/Dockerfile @@ -110,6 +110,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -120,8 +121,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/markdown_markdown_table_formatter/Dockerfile b/linters/markdown_markdown_table_formatter/Dockerfile index ddf97293c0e..ce05b900559 100644 --- a/linters/markdown_markdown_table_formatter/Dockerfile +++ b/linters/markdown_markdown_table_formatter/Dockerfile @@ -110,6 +110,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -120,8 +121,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/markdown_markdownlint/Dockerfile b/linters/markdown_markdownlint/Dockerfile index 605a90daa1e..0ee4433e23c 100644 --- a/linters/markdown_markdownlint/Dockerfile +++ b/linters/markdown_markdownlint/Dockerfile @@ -110,6 +110,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -120,8 +121,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/markdown_remark_lint/Dockerfile b/linters/markdown_remark_lint/Dockerfile index 3063e179ed2..bade6799f25 100644 --- a/linters/markdown_remark_lint/Dockerfile +++ b/linters/markdown_remark_lint/Dockerfile @@ -111,6 +111,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -121,8 +122,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/openapi_spectral/Dockerfile b/linters/openapi_spectral/Dockerfile index a1e6825585d..29a264dccc1 100644 --- a/linters/openapi_spectral/Dockerfile +++ b/linters/openapi_spectral/Dockerfile @@ -110,6 +110,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -120,8 +121,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/perl_perlcritic/Dockerfile b/linters/perl_perlcritic/Dockerfile index 2523fe07401..19ca523806d 100644 --- a/linters/perl_perlcritic/Dockerfile +++ b/linters/perl_perlcritic/Dockerfile @@ -90,6 +90,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -100,8 +101,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/php_phpcs/Dockerfile b/linters/php_phpcs/Dockerfile index a9bdb468055..0e7bdc48126 100644 --- a/linters/php_phpcs/Dockerfile +++ b/linters/php_phpcs/Dockerfile @@ -106,6 +106,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -116,8 +117,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/php_phplint/Dockerfile b/linters/php_phplint/Dockerfile index fe8cf18f556..d2ffed0ff2b 100644 --- a/linters/php_phplint/Dockerfile +++ b/linters/php_phplint/Dockerfile @@ -106,6 +106,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -116,8 +117,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/php_phpstan/Dockerfile b/linters/php_phpstan/Dockerfile index e36efafa20e..94fbc7ec4f4 100644 --- a/linters/php_phpstan/Dockerfile +++ b/linters/php_phpstan/Dockerfile @@ -107,6 +107,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -117,8 +118,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/php_psalm/Dockerfile b/linters/php_psalm/Dockerfile index c3c0496bd24..d02b5754e3a 100644 --- a/linters/php_psalm/Dockerfile +++ b/linters/php_psalm/Dockerfile @@ -106,6 +106,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -116,8 +117,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/powershell_powershell/Dockerfile b/linters/powershell_powershell/Dockerfile index b05f3860b99..9959f93b780 100644 --- a/linters/powershell_powershell/Dockerfile +++ b/linters/powershell_powershell/Dockerfile @@ -90,6 +90,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -100,8 +101,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/powershell_powershell_formatter/Dockerfile b/linters/powershell_powershell_formatter/Dockerfile index eef9b8c5897..1f616ca897f 100644 --- a/linters/powershell_powershell_formatter/Dockerfile +++ b/linters/powershell_powershell_formatter/Dockerfile @@ -90,6 +90,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -100,8 +101,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/protobuf_protolint/Dockerfile b/linters/protobuf_protolint/Dockerfile index ba5193a1c1b..9f2ff8115bd 100644 --- a/linters/protobuf_protolint/Dockerfile +++ b/linters/protobuf_protolint/Dockerfile @@ -90,6 +90,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -100,8 +101,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/puppet_puppet_lint/Dockerfile b/linters/puppet_puppet_lint/Dockerfile index b6cd6a5b16a..fdaa5736521 100644 --- a/linters/puppet_puppet_lint/Dockerfile +++ b/linters/puppet_puppet_lint/Dockerfile @@ -90,6 +90,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -100,8 +101,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/python_bandit/Dockerfile b/linters/python_bandit/Dockerfile index b15b5de7421..2ed00f5e3f6 100644 --- a/linters/python_bandit/Dockerfile +++ b/linters/python_bandit/Dockerfile @@ -97,6 +97,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -107,8 +108,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/python_black/Dockerfile b/linters/python_black/Dockerfile index 6d818026f20..c2ac3d52bf4 100644 --- a/linters/python_black/Dockerfile +++ b/linters/python_black/Dockerfile @@ -95,6 +95,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -105,8 +106,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/python_flake8/Dockerfile b/linters/python_flake8/Dockerfile index b541d54ffcb..67a2c21a584 100644 --- a/linters/python_flake8/Dockerfile +++ b/linters/python_flake8/Dockerfile @@ -95,6 +95,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -105,8 +106,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/python_isort/Dockerfile b/linters/python_isort/Dockerfile index c42dea240a2..4de3152120c 100644 --- a/linters/python_isort/Dockerfile +++ b/linters/python_isort/Dockerfile @@ -96,6 +96,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -106,8 +107,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/python_mypy/Dockerfile b/linters/python_mypy/Dockerfile index daea3b05547..f715d33c9a4 100644 --- a/linters/python_mypy/Dockerfile +++ b/linters/python_mypy/Dockerfile @@ -95,6 +95,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -105,8 +106,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/python_pylint/Dockerfile b/linters/python_pylint/Dockerfile index d1afbbd9020..421edc418c0 100644 --- a/linters/python_pylint/Dockerfile +++ b/linters/python_pylint/Dockerfile @@ -96,6 +96,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -106,8 +107,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/python_pyright/Dockerfile b/linters/python_pyright/Dockerfile index a3e07fbea50..07487bafd7f 100644 --- a/linters/python_pyright/Dockerfile +++ b/linters/python_pyright/Dockerfile @@ -95,6 +95,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -105,8 +106,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/python_ruff/Dockerfile b/linters/python_ruff/Dockerfile index 2f29aee27df..5e20d03e9a8 100644 --- a/linters/python_ruff/Dockerfile +++ b/linters/python_ruff/Dockerfile @@ -98,6 +98,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -108,8 +109,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/r_lintr/Dockerfile b/linters/r_lintr/Dockerfile index c3885b296e8..8fbaa55d125 100644 --- a/linters/r_lintr/Dockerfile +++ b/linters/r_lintr/Dockerfile @@ -90,6 +90,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -100,8 +101,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/raku_raku/Dockerfile b/linters/raku_raku/Dockerfile index b93c3832bef..fa5dd193db9 100644 --- a/linters/raku_raku/Dockerfile +++ b/linters/raku_raku/Dockerfile @@ -90,6 +90,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -100,8 +101,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/repository_checkov/Dockerfile b/linters/repository_checkov/Dockerfile index 6a197a1288b..0e9cf40e4fd 100644 --- a/linters/repository_checkov/Dockerfile +++ b/linters/repository_checkov/Dockerfile @@ -98,6 +98,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -108,8 +109,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/repository_devskim/Dockerfile b/linters/repository_devskim/Dockerfile index ae589eedd02..93c703bbdff 100644 --- a/linters/repository_devskim/Dockerfile +++ b/linters/repository_devskim/Dockerfile @@ -90,6 +90,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -100,8 +101,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/repository_dustilock/Dockerfile b/linters/repository_dustilock/Dockerfile index b786828294d..bef2ce59dc7 100644 --- a/linters/repository_dustilock/Dockerfile +++ b/linters/repository_dustilock/Dockerfile @@ -100,6 +100,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -110,8 +111,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/repository_git_diff/Dockerfile b/linters/repository_git_diff/Dockerfile index f5d3c9f83dd..dea63f3967c 100644 --- a/linters/repository_git_diff/Dockerfile +++ b/linters/repository_git_diff/Dockerfile @@ -90,6 +90,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -100,8 +101,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/repository_gitleaks/Dockerfile b/linters/repository_gitleaks/Dockerfile index ec391365c7a..e79b564cd94 100644 --- a/linters/repository_gitleaks/Dockerfile +++ b/linters/repository_gitleaks/Dockerfile @@ -90,6 +90,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -100,8 +101,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/repository_grype/Dockerfile b/linters/repository_grype/Dockerfile index b3c2d206704..864ecf6df56 100644 --- a/linters/repository_grype/Dockerfile +++ b/linters/repository_grype/Dockerfile @@ -90,6 +90,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -100,8 +101,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/repository_kics/Dockerfile b/linters/repository_kics/Dockerfile index d0613b7ce77..d50aa8c347f 100644 --- a/linters/repository_kics/Dockerfile +++ b/linters/repository_kics/Dockerfile @@ -91,6 +91,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -101,8 +102,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/repository_secretlint/Dockerfile b/linters/repository_secretlint/Dockerfile index abb7fe64c60..72f4cdb1166 100644 --- a/linters/repository_secretlint/Dockerfile +++ b/linters/repository_secretlint/Dockerfile @@ -112,6 +112,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -122,8 +123,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/repository_semgrep/Dockerfile b/linters/repository_semgrep/Dockerfile index cdc016006fd..1db248bdd87 100644 --- a/linters/repository_semgrep/Dockerfile +++ b/linters/repository_semgrep/Dockerfile @@ -97,6 +97,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -107,8 +108,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/repository_syft/Dockerfile b/linters/repository_syft/Dockerfile index ad080cd43d7..3f5c8fa7c3a 100644 --- a/linters/repository_syft/Dockerfile +++ b/linters/repository_syft/Dockerfile @@ -90,6 +90,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -100,8 +101,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/repository_trivy/Dockerfile b/linters/repository_trivy/Dockerfile index 0b738fc8885..b14130e58f8 100644 --- a/linters/repository_trivy/Dockerfile +++ b/linters/repository_trivy/Dockerfile @@ -90,6 +90,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -100,8 +101,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/repository_trivy_sbom/Dockerfile b/linters/repository_trivy_sbom/Dockerfile index 45e81f0bc59..d9fbb4390a1 100644 --- a/linters/repository_trivy_sbom/Dockerfile +++ b/linters/repository_trivy_sbom/Dockerfile @@ -90,6 +90,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -100,8 +101,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/repository_trufflehog/Dockerfile b/linters/repository_trufflehog/Dockerfile index 86ed107eaf7..e41bb8bb00b 100644 --- a/linters/repository_trufflehog/Dockerfile +++ b/linters/repository_trufflehog/Dockerfile @@ -90,6 +90,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -100,8 +101,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/rst_rst_lint/Dockerfile b/linters/rst_rst_lint/Dockerfile index 4bdede4d618..bfc5ad89430 100644 --- a/linters/rst_rst_lint/Dockerfile +++ b/linters/rst_rst_lint/Dockerfile @@ -95,6 +95,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -105,8 +106,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/rst_rstcheck/Dockerfile b/linters/rst_rstcheck/Dockerfile index 992146e822e..6920a9ed41b 100644 --- a/linters/rst_rstcheck/Dockerfile +++ b/linters/rst_rstcheck/Dockerfile @@ -95,6 +95,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -105,8 +106,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/rst_rstfmt/Dockerfile b/linters/rst_rstfmt/Dockerfile index aaaa69464db..cb396572128 100644 --- a/linters/rst_rstfmt/Dockerfile +++ b/linters/rst_rstfmt/Dockerfile @@ -95,6 +95,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -105,8 +106,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/ruby_rubocop/Dockerfile b/linters/ruby_rubocop/Dockerfile index cb67c58223c..d1aa671f91d 100644 --- a/linters/ruby_rubocop/Dockerfile +++ b/linters/ruby_rubocop/Dockerfile @@ -90,6 +90,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -100,8 +101,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/rust_clippy/Dockerfile b/linters/rust_clippy/Dockerfile index 15254c100ca..6818fcc4272 100644 --- a/linters/rust_clippy/Dockerfile +++ b/linters/rust_clippy/Dockerfile @@ -125,6 +125,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -135,8 +136,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/salesforce_sfdx_scanner_apex/Dockerfile b/linters/salesforce_sfdx_scanner_apex/Dockerfile index 28d064435e3..9d2d1af35be 100644 --- a/linters/salesforce_sfdx_scanner_apex/Dockerfile +++ b/linters/salesforce_sfdx_scanner_apex/Dockerfile @@ -110,6 +110,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -120,8 +121,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# @@ -242,12 +243,9 @@ COPY --from=copy-collector / / # SALESFORCE installation 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 \ # # sfdx-scanner-apex installation - && sfdx plugins:install @salesforce/sfdx-scanner \ +RUN sfdx plugins:install @salesforce/sfdx-scanner \ && npm cache clean --force || true \ && rm -rf /root/.npm/_cacache diff --git a/linters/salesforce_sfdx_scanner_aura/Dockerfile b/linters/salesforce_sfdx_scanner_aura/Dockerfile index d9f9a9b2d31..79318da43ff 100644 --- a/linters/salesforce_sfdx_scanner_aura/Dockerfile +++ b/linters/salesforce_sfdx_scanner_aura/Dockerfile @@ -110,6 +110,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -120,8 +121,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# @@ -242,12 +243,9 @@ COPY --from=copy-collector / / # SALESFORCE installation 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 \ # # sfdx-scanner-aura installation - && sfdx plugins:install @salesforce/sfdx-scanner \ +RUN sfdx plugins:install @salesforce/sfdx-scanner \ && npm cache clean --force || true \ && rm -rf /root/.npm/_cacache diff --git a/linters/salesforce_sfdx_scanner_lwc/Dockerfile b/linters/salesforce_sfdx_scanner_lwc/Dockerfile index e04a1d97fc9..82624825e97 100644 --- a/linters/salesforce_sfdx_scanner_lwc/Dockerfile +++ b/linters/salesforce_sfdx_scanner_lwc/Dockerfile @@ -110,6 +110,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -120,8 +121,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# @@ -242,12 +243,9 @@ COPY --from=copy-collector / / # SALESFORCE installation 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 \ # # sfdx-scanner-lwc installation - && sfdx plugins:install @salesforce/sfdx-scanner \ +RUN sfdx plugins:install @salesforce/sfdx-scanner \ && npm cache clean --force || true \ && rm -rf /root/.npm/_cacache diff --git a/linters/scala_scalafix/Dockerfile b/linters/scala_scalafix/Dockerfile index cb494650fea..35b95d3d2b3 100644 --- a/linters/scala_scalafix/Dockerfile +++ b/linters/scala_scalafix/Dockerfile @@ -98,6 +98,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -108,8 +109,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/snakemake_lint/Dockerfile b/linters/snakemake_lint/Dockerfile index d87377fcf7b..4dd49ab117b 100644 --- a/linters/snakemake_lint/Dockerfile +++ b/linters/snakemake_lint/Dockerfile @@ -95,6 +95,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -105,8 +106,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/snakemake_snakefmt/Dockerfile b/linters/snakemake_snakefmt/Dockerfile index 9eeb4df2cc3..9ff5e6d3987 100644 --- a/linters/snakemake_snakefmt/Dockerfile +++ b/linters/snakemake_snakefmt/Dockerfile @@ -95,6 +95,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -105,8 +106,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/spell_cspell/Dockerfile b/linters/spell_cspell/Dockerfile index 47f5ef0b53f..045d74ec36d 100644 --- a/linters/spell_cspell/Dockerfile +++ b/linters/spell_cspell/Dockerfile @@ -110,6 +110,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -120,8 +121,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/spell_lychee/Dockerfile b/linters/spell_lychee/Dockerfile index 5cb797b81b1..4d28838dc49 100644 --- a/linters/spell_lychee/Dockerfile +++ b/linters/spell_lychee/Dockerfile @@ -90,6 +90,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -100,8 +101,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/spell_proselint/Dockerfile b/linters/spell_proselint/Dockerfile index c7a7465d878..a3ceaf7b784 100644 --- a/linters/spell_proselint/Dockerfile +++ b/linters/spell_proselint/Dockerfile @@ -95,6 +95,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -105,8 +106,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/spell_vale/Dockerfile b/linters/spell_vale/Dockerfile index e8dafbdd9f2..d916444a284 100644 --- a/linters/spell_vale/Dockerfile +++ b/linters/spell_vale/Dockerfile @@ -90,6 +90,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -100,8 +101,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/sql_sql_lint/Dockerfile b/linters/sql_sql_lint/Dockerfile index 0ee3cee0251..69686288519 100644 --- a/linters/sql_sql_lint/Dockerfile +++ b/linters/sql_sql_lint/Dockerfile @@ -110,6 +110,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -120,8 +121,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/sql_sqlfluff/Dockerfile b/linters/sql_sqlfluff/Dockerfile index a54b5752d00..7aa0bfddf12 100644 --- a/linters/sql_sqlfluff/Dockerfile +++ b/linters/sql_sqlfluff/Dockerfile @@ -95,6 +95,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -105,8 +106,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/sql_tsqllint/Dockerfile b/linters/sql_tsqllint/Dockerfile index 422171d282c..36c76c783fb 100644 --- a/linters/sql_tsqllint/Dockerfile +++ b/linters/sql_tsqllint/Dockerfile @@ -90,6 +90,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -100,8 +101,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/swift_swiftlint/Dockerfile b/linters/swift_swiftlint/Dockerfile index fb4bf16e218..6292da31f1c 100644 --- a/linters/swift_swiftlint/Dockerfile +++ b/linters/swift_swiftlint/Dockerfile @@ -90,6 +90,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -100,8 +101,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/tekton_tekton_lint/Dockerfile b/linters/tekton_tekton_lint/Dockerfile index ea1c9889e00..6b825818b72 100644 --- a/linters/tekton_tekton_lint/Dockerfile +++ b/linters/tekton_tekton_lint/Dockerfile @@ -110,6 +110,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -120,8 +121,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/terraform_terraform_fmt/Dockerfile b/linters/terraform_terraform_fmt/Dockerfile index 08539859ca2..b36fa8393fe 100644 --- a/linters/terraform_terraform_fmt/Dockerfile +++ b/linters/terraform_terraform_fmt/Dockerfile @@ -90,6 +90,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -100,8 +101,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/terraform_terragrunt/Dockerfile b/linters/terraform_terragrunt/Dockerfile index c228ed12b78..768dac51ba9 100644 --- a/linters/terraform_terragrunt/Dockerfile +++ b/linters/terraform_terragrunt/Dockerfile @@ -90,6 +90,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -100,8 +101,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/terraform_terrascan/Dockerfile b/linters/terraform_terrascan/Dockerfile index b2d1576b37e..047bb7f5868 100644 --- a/linters/terraform_terrascan/Dockerfile +++ b/linters/terraform_terrascan/Dockerfile @@ -90,6 +90,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -100,8 +101,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/terraform_tflint/Dockerfile b/linters/terraform_tflint/Dockerfile index df6dd2fd6ed..ac472aad4e1 100644 --- a/linters/terraform_tflint/Dockerfile +++ b/linters/terraform_tflint/Dockerfile @@ -90,6 +90,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -100,8 +101,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/tsx_eslint/Dockerfile b/linters/tsx_eslint/Dockerfile index 7242aea5219..695e7636c5f 100644 --- a/linters/tsx_eslint/Dockerfile +++ b/linters/tsx_eslint/Dockerfile @@ -122,6 +122,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -132,8 +133,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/typescript_es/Dockerfile b/linters/typescript_es/Dockerfile index 860c354fb7e..7d632f792e8 100644 --- a/linters/typescript_es/Dockerfile +++ b/linters/typescript_es/Dockerfile @@ -125,6 +125,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -135,8 +136,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/typescript_prettier/Dockerfile b/linters/typescript_prettier/Dockerfile index 0ca9c6d0cd9..cdc3c617815 100644 --- a/linters/typescript_prettier/Dockerfile +++ b/linters/typescript_prettier/Dockerfile @@ -111,6 +111,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -121,8 +122,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/typescript_standard/Dockerfile b/linters/typescript_standard/Dockerfile index 8bf01d53f94..e9404329ad1 100644 --- a/linters/typescript_standard/Dockerfile +++ b/linters/typescript_standard/Dockerfile @@ -111,6 +111,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -121,8 +122,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/vbdotnet_dotnet_format/Dockerfile b/linters/vbdotnet_dotnet_format/Dockerfile index 4ff89a7e37d..021af1f10d8 100644 --- a/linters/vbdotnet_dotnet_format/Dockerfile +++ b/linters/vbdotnet_dotnet_format/Dockerfile @@ -90,6 +90,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -100,8 +101,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/xml_xmllint/Dockerfile b/linters/xml_xmllint/Dockerfile index 33f76275476..075441c6f21 100644 --- a/linters/xml_xmllint/Dockerfile +++ b/linters/xml_xmllint/Dockerfile @@ -90,6 +90,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -100,8 +101,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/yaml_prettier/Dockerfile b/linters/yaml_prettier/Dockerfile index d5f00a86ac6..3bda50221a7 100644 --- a/linters/yaml_prettier/Dockerfile +++ b/linters/yaml_prettier/Dockerfile @@ -110,6 +110,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -120,8 +121,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/yaml_v8r/Dockerfile b/linters/yaml_v8r/Dockerfile index bf97bd4d596..bbd652e0139 100644 --- a/linters/yaml_v8r/Dockerfile +++ b/linters/yaml_v8r/Dockerfile @@ -110,6 +110,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -120,8 +121,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/linters/yaml_yamllint/Dockerfile b/linters/yaml_yamllint/Dockerfile index e2a795e535c..7e228275b9e 100644 --- a/linters/yaml_yamllint/Dockerfile +++ b/linters/yaml_yamllint/Dockerfile @@ -95,6 +95,7 @@ ENV PATH=${PATH}:/root/.cargo/bin RUN mkdir /venvs +# Enforce seperation ARG TARGETPLATFORM COPY --link --from=target-python /usr/local/bin/python3 /usr/local/bin/target-python3 @@ -105,8 +106,8 @@ COPY --link megalinter /megalinter RUN --mount=type=cache,id=pip,sharing=shared,target=/var/cache/pip,uid=0 \ mkdir -p "/venvs/megalinter" \ && cd "/venvs/megalinter" \ - && python3 -m crossenv /usr/local/bin/target-python3 . \ - && source bin/activate \ + && python3 -m crossenv /usr/local/bin/target-python3 --machine $([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && echo "aarch64" || echo "x86_64") . \ + && find . -type f -name _musllinux.py -exec sed -i 's|def _get_musl_version.*:|\0\n return _MuslVersion(major=1, minor=2)|g' \{\} \; \ && PYTHONDONTWRITEBYTECODE=1 pip3 install --cache-dir=/var/cache/pip /megalinter ############################################################################################# diff --git a/megalinter/descriptors/salesforce.megalinter-descriptor.yml b/megalinter/descriptors/salesforce.megalinter-descriptor.yml index 14347108084..d85f34e6784 100644 --- a/megalinter/descriptors/salesforce.megalinter-descriptor.yml +++ b/megalinter/descriptors/salesforce.megalinter-descriptor.yml @@ -10,25 +10,9 @@ install: dockerfile: - 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 # Salesforce DX npm: - "@salesforce/cli" -supported_platforms: - platform: - - linux/amd64 - - linux/arm64 - install_override: - - platform: linux/arm64 - install: - dockerfile: - - ENV JAVA_HOME=/usr/lib/jvm/java-11-openjdk - - ENV PATH="$JAVA_HOME/bin:${PATH}" - - ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true - - RUN echo y|sfdx plugins:install sfdx-hardis linters: # SFDX Scanner - linter_name: sfdx-scanner-apex From e7ed3ed978e871bad52ec8fca2c7e59044d00cf9 Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Wed, 26 Jul 2023 10:28:28 -0500 Subject: [PATCH 100/105] Fix a bug in the ide extension code --- megalinter/reporters/ConfigReporter.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/megalinter/reporters/ConfigReporter.py b/megalinter/reporters/ConfigReporter.py index 93f0eb407cb..04eae760269 100644 --- a/megalinter/reporters/ConfigReporter.py +++ b/megalinter/reporters/ConfigReporter.py @@ -63,11 +63,9 @@ def produce_report(self): # Get applicable IDEA extensions idea_extensions = ide.get("idea", []) for idea_extension in idea_extensions: - if "https://plugins.jetbrains.com/plugin/" in idea_extension["url"]: + if "id" in idea_extension: idea_recommended_extensions += [ - idea_extension["url"].split( - "https://plugins.jetbrains.com/plugin/", 1 - )[1] + idea_extension["id"] ] # Copy config file if default (and not already at the root of the folder) if linter.final_config_file is not None: From 546966d07d3f2703acb8c150ea7eb6c4e81fa126 Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Wed, 26 Jul 2023 13:23:14 -0500 Subject: [PATCH 101/105] Debugging --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index d2edb8ca4a8..646232aabff 100644 --- a/Dockerfile +++ b/Dockerfile @@ -946,7 +946,7 @@ RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GI # # powershell installation -RUN pwsh -c 'Install-Module -Name PSScriptAnalyzer -RequiredVersion ${PSSA_VERSION} -Scope AllUsers -Force' +#RUN pwsh -c 'Install-Module -Name PSScriptAnalyzer -RequiredVersion ${PSSA_VERSION} -Scope AllUsers -Force' # # powershell_formatter installation # Next line commented because already managed by another linter From 560dc8c707877436847c803b1ca87ec3dc3381ad Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Wed, 26 Jul 2023 15:29:41 -0500 Subject: [PATCH 102/105] Disabled powershell for arm --- Dockerfile | 49 ++++++++++--------- flavors/dotnet/Dockerfile | 43 ++++++++-------- flavors/dotnetweb/Dockerfile | 43 ++++++++-------- linters/arm_arm_ttk/Dockerfile | 8 +-- linters/powershell_powershell/Dockerfile | 5 +- .../Dockerfile | 5 +- .../descriptors/arm.megalinter-descriptor.yml | 10 ++-- .../powershell.megalinter-descriptor.yml | 8 +-- 8 files changed, 93 insertions(+), 78 deletions(-) diff --git a/Dockerfile b/Dockerfile index 646232aabff..4f730aa48d5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -721,9 +721,10 @@ COPY --from=copy-collector / / #OTHER__START RUN rc-update add docker boot && rc-service docker start || true # ARM installation -RUN --mount=type=secret,id=GITHUB_TOKEN case ${TARGETPLATFORM} in \ +RUN --mount=type=secret,id=GITHUB_TOKEN ([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && exit 0) || \ + case ${TARGETPLATFORM} in \ "linux/amd64") POWERSHELL_ARCH=alpine-x64 ;; \ - "linux/arm64") POWERSHELL_ARCH=arm64 ;; \ + "linux/arm64") POWERSHELL_ARCH=alpine-arm64 ;; \ esac \ && mkdir -p ${PWSH_DIRECTORY} \ && curl --retry 5 --retry-delay 5 -s \ @@ -735,7 +736,8 @@ RUN --mount=type=secret,id=GITHUB_TOKEN case ${TARGETPLATFORM} in \ | cut -d '"' -f 4 \ | xargs -n 1 wget -O - \ | tar -xzC ${PWSH_DIRECTORY} \ - && ln -sf ${PWSH_DIRECTORY}/pwsh /usr/bin/pwsh + && ln -sf ${PWSH_DIRECTORY}/pwsh /usr/bin/pwsh \ + && chmod +x /usr/bin/pwsh # # CLOJURE installation @@ -836,26 +838,27 @@ ENV JAVA_HOME=/usr/lib/jvm/java-11-openjdk ENV PATH="$JAVA_HOME/bin:${PATH}" # # PHP installation -RUN update-alternatives --install /usr/bin/php php /usr/bin/php81 110 +RUN update-alternatives --install /usr/bin/php php /usr/bin/php81 110 \ # # POWERSHELL installation -RUN --mount=type=secret,id=GITHUB_TOKEN case ${TARGETPLATFORM} in \ - "linux/amd64") POWERSHELL_ARCH=alpine-x64 ;; \ - "linux/arm64") POWERSHELL_ARCH=arm64 ;; \ - esac \ - && mkdir -p ${PWSH_DIRECTORY} \ - && curl --retry 5 --retry-delay 5 -s \ - -H "Accept: application/vnd.github+json" \ - -H "Authorization: Bearer $(cat /run/secrets/GITHUB_TOKEN)" \ - https://api.github.com/repos/powershell/powershell/releases/${PWSH_VERSION} \ - | grep browser_download_url \ - | grep linux-${POWERSHELL_ARCH} \ - | cut -d '"' -f 4 \ - | xargs -n 1 wget -O - \ - | tar -xzC ${PWSH_DIRECTORY} \ - && ln -sf ${PWSH_DIRECTORY}/pwsh /usr/bin/pwsh \ - && chmod +x /usr/bin/pwsh - +# Next line commented because already managed by another linter +# RUN ([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && exit 0) || \ +# case ${TARGETPLATFORM} in \ +# "linux/amd64") POWERSHELL_ARCH=alpine-x64 ;; \ +# "linux/arm64") POWERSHELL_ARCH=alpine-arm64 ;; \ +# esac \ +# && mkdir -p ${PWSH_DIRECTORY} \ +# && curl --retry 5 --retry-delay 5 -s \ +# -H "Accept: application/vnd.github+json" \ +# -H "Authorization: Bearer $(cat /run/secrets/GITHUB_TOKEN)" \ +# https://api.github.com/repos/powershell/powershell/releases/${PWSH_VERSION} \ +# | grep browser_download_url \ +# | grep linux-${POWERSHELL_ARCH} \ +# | cut -d '"' -f 4 \ +# | xargs -n 1 wget -O - \ +# | tar -xzC ${PWSH_DIRECTORY} \ +# && ln -sf ${PWSH_DIRECTORY}/pwsh /usr/bin/pwsh \ +# && chmod +x /usr/bin/pwsh # # SALESFORCE installation # Next line commented because already managed by another linter @@ -872,7 +875,7 @@ RUN --mount=type=secret,id=GITHUB_TOKEN case ${TARGETPLATFORM} in \ # ENV PATH="${PATH}:/root/.dotnet/tools:/usr/share/dotnet" # # bicep_linter installation -RUN case ${TARGETPLATFORM} in \ + && case ${TARGETPLATFORM} in \ "linux/amd64") POWERSHELL_ARCH=musl-x64 ;; \ "linux/arm64") POWERSHELL_ARCH=arm64 ;; \ esac \ @@ -946,7 +949,7 @@ RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GI # # powershell installation -#RUN pwsh -c 'Install-Module -Name PSScriptAnalyzer -RequiredVersion ${PSSA_VERSION} -Scope AllUsers -Force' +RUN pwsh -c 'Install-Module -Name PSScriptAnalyzer -RequiredVersion ${PSSA_VERSION} -Scope AllUsers -Force' # # powershell_formatter installation # Next line commented because already managed by another linter diff --git a/flavors/dotnet/Dockerfile b/flavors/dotnet/Dockerfile index 256ecb45e0b..0e87ca5a09a 100644 --- a/flavors/dotnet/Dockerfile +++ b/flavors/dotnet/Dockerfile @@ -440,9 +440,10 @@ COPY --from=copy-collector / / ############################################################################################# #OTHER__START # ARM installation -RUN --mount=type=secret,id=GITHUB_TOKEN case ${TARGETPLATFORM} in \ +RUN --mount=type=secret,id=GITHUB_TOKEN ([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && exit 0) || \ + case ${TARGETPLATFORM} in \ "linux/amd64") POWERSHELL_ARCH=alpine-x64 ;; \ - "linux/arm64") POWERSHELL_ARCH=arm64 ;; \ + "linux/arm64") POWERSHELL_ARCH=alpine-arm64 ;; \ esac \ && mkdir -p ${PWSH_DIRECTORY} \ && curl --retry 5 --retry-delay 5 -s \ @@ -454,7 +455,8 @@ RUN --mount=type=secret,id=GITHUB_TOKEN case ${TARGETPLATFORM} in \ | cut -d '"' -f 4 \ | xargs -n 1 wget -O - \ | tar -xzC ${PWSH_DIRECTORY} \ - && ln -sf ${PWSH_DIRECTORY}/pwsh /usr/bin/pwsh + && ln -sf ${PWSH_DIRECTORY}/pwsh /usr/bin/pwsh \ + && chmod +x /usr/bin/pwsh # # CSHARP installation @@ -465,23 +467,24 @@ RUN wget --tries=5 -q -O dotnet-install.sh https://dot.net/v1/dotnet-install.sh ENV PATH="${PATH}:/root/.dotnet/tools:/usr/share/dotnet" # # POWERSHELL installation -RUN --mount=type=secret,id=GITHUB_TOKEN case ${TARGETPLATFORM} in \ - "linux/amd64") POWERSHELL_ARCH=alpine-x64 ;; \ - "linux/arm64") POWERSHELL_ARCH=arm64 ;; \ - esac \ - && mkdir -p ${PWSH_DIRECTORY} \ - && curl --retry 5 --retry-delay 5 -s \ - -H "Accept: application/vnd.github+json" \ - -H "Authorization: Bearer $(cat /run/secrets/GITHUB_TOKEN)" \ - https://api.github.com/repos/powershell/powershell/releases/${PWSH_VERSION} \ - | grep browser_download_url \ - | grep linux-${POWERSHELL_ARCH} \ - | cut -d '"' -f 4 \ - | xargs -n 1 wget -O - \ - | tar -xzC ${PWSH_DIRECTORY} \ - && ln -sf ${PWSH_DIRECTORY}/pwsh /usr/bin/pwsh \ - && chmod +x /usr/bin/pwsh - +# Next line commented because already managed by another linter +# RUN ([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && exit 0) || \ +# case ${TARGETPLATFORM} in \ +# "linux/amd64") POWERSHELL_ARCH=alpine-x64 ;; \ +# "linux/arm64") POWERSHELL_ARCH=alpine-arm64 ;; \ +# esac \ +# && mkdir -p ${PWSH_DIRECTORY} \ +# && curl --retry 5 --retry-delay 5 -s \ +# -H "Accept: application/vnd.github+json" \ +# -H "Authorization: Bearer $(cat /run/secrets/GITHUB_TOKEN)" \ +# https://api.github.com/repos/powershell/powershell/releases/${PWSH_VERSION} \ +# | grep browser_download_url \ +# | grep linux-${POWERSHELL_ARCH} \ +# | cut -d '"' -f 4 \ +# | xargs -n 1 wget -O - \ +# | tar -xzC ${PWSH_DIRECTORY} \ +# && ln -sf ${PWSH_DIRECTORY}/pwsh /usr/bin/pwsh \ +# && chmod +x /usr/bin/pwsh # # VBDOTNET installation # Next line commented because already managed by another linter diff --git a/flavors/dotnetweb/Dockerfile b/flavors/dotnetweb/Dockerfile index 19cb801192d..f68d3e1c9c7 100644 --- a/flavors/dotnetweb/Dockerfile +++ b/flavors/dotnetweb/Dockerfile @@ -460,9 +460,10 @@ COPY --from=copy-collector / / ############################################################################################# #OTHER__START # ARM installation -RUN --mount=type=secret,id=GITHUB_TOKEN case ${TARGETPLATFORM} in \ +RUN --mount=type=secret,id=GITHUB_TOKEN ([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && exit 0) || \ + case ${TARGETPLATFORM} in \ "linux/amd64") POWERSHELL_ARCH=alpine-x64 ;; \ - "linux/arm64") POWERSHELL_ARCH=arm64 ;; \ + "linux/arm64") POWERSHELL_ARCH=alpine-arm64 ;; \ esac \ && mkdir -p ${PWSH_DIRECTORY} \ && curl --retry 5 --retry-delay 5 -s \ @@ -474,7 +475,8 @@ RUN --mount=type=secret,id=GITHUB_TOKEN case ${TARGETPLATFORM} in \ | cut -d '"' -f 4 \ | xargs -n 1 wget -O - \ | tar -xzC ${PWSH_DIRECTORY} \ - && ln -sf ${PWSH_DIRECTORY}/pwsh /usr/bin/pwsh + && ln -sf ${PWSH_DIRECTORY}/pwsh /usr/bin/pwsh \ + && chmod +x /usr/bin/pwsh # # CSHARP installation @@ -485,23 +487,24 @@ RUN wget --tries=5 -q -O dotnet-install.sh https://dot.net/v1/dotnet-install.sh ENV PATH="${PATH}:/root/.dotnet/tools:/usr/share/dotnet" # # POWERSHELL installation -RUN --mount=type=secret,id=GITHUB_TOKEN case ${TARGETPLATFORM} in \ - "linux/amd64") POWERSHELL_ARCH=alpine-x64 ;; \ - "linux/arm64") POWERSHELL_ARCH=arm64 ;; \ - esac \ - && mkdir -p ${PWSH_DIRECTORY} \ - && curl --retry 5 --retry-delay 5 -s \ - -H "Accept: application/vnd.github+json" \ - -H "Authorization: Bearer $(cat /run/secrets/GITHUB_TOKEN)" \ - https://api.github.com/repos/powershell/powershell/releases/${PWSH_VERSION} \ - | grep browser_download_url \ - | grep linux-${POWERSHELL_ARCH} \ - | cut -d '"' -f 4 \ - | xargs -n 1 wget -O - \ - | tar -xzC ${PWSH_DIRECTORY} \ - && ln -sf ${PWSH_DIRECTORY}/pwsh /usr/bin/pwsh \ - && chmod +x /usr/bin/pwsh - +# Next line commented because already managed by another linter +# RUN ([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && exit 0) || \ +# case ${TARGETPLATFORM} in \ +# "linux/amd64") POWERSHELL_ARCH=alpine-x64 ;; \ +# "linux/arm64") POWERSHELL_ARCH=alpine-arm64 ;; \ +# esac \ +# && mkdir -p ${PWSH_DIRECTORY} \ +# && curl --retry 5 --retry-delay 5 -s \ +# -H "Accept: application/vnd.github+json" \ +# -H "Authorization: Bearer $(cat /run/secrets/GITHUB_TOKEN)" \ +# https://api.github.com/repos/powershell/powershell/releases/${PWSH_VERSION} \ +# | grep browser_download_url \ +# | grep linux-${POWERSHELL_ARCH} \ +# | cut -d '"' -f 4 \ +# | xargs -n 1 wget -O - \ +# | tar -xzC ${PWSH_DIRECTORY} \ +# && ln -sf ${PWSH_DIRECTORY}/pwsh /usr/bin/pwsh \ +# && chmod +x /usr/bin/pwsh # # VBDOTNET installation # Next line commented because already managed by another linter diff --git a/linters/arm_arm_ttk/Dockerfile b/linters/arm_arm_ttk/Dockerfile index 513a0b6f1f5..707c112a1fd 100644 --- a/linters/arm_arm_ttk/Dockerfile +++ b/linters/arm_arm_ttk/Dockerfile @@ -231,9 +231,10 @@ COPY --from=copy-collector / / ############################################################################################# #OTHER__START # ARM installation -RUN --mount=type=secret,id=GITHUB_TOKEN case ${TARGETPLATFORM} in \ +RUN --mount=type=secret,id=GITHUB_TOKEN ([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && exit 0) || \ + case ${TARGETPLATFORM} in \ "linux/amd64") POWERSHELL_ARCH=alpine-x64 ;; \ - "linux/arm64") POWERSHELL_ARCH=arm64 ;; \ + "linux/arm64") POWERSHELL_ARCH=alpine-arm64 ;; \ esac \ && mkdir -p ${PWSH_DIRECTORY} \ && curl --retry 5 --retry-delay 5 -s \ @@ -245,7 +246,8 @@ RUN --mount=type=secret,id=GITHUB_TOKEN case ${TARGETPLATFORM} in \ | cut -d '"' -f 4 \ | xargs -n 1 wget -O - \ | tar -xzC ${PWSH_DIRECTORY} \ - && ln -sf ${PWSH_DIRECTORY}/pwsh /usr/bin/pwsh + && ln -sf ${PWSH_DIRECTORY}/pwsh /usr/bin/pwsh \ + && chmod +x /usr/bin/pwsh # #OTHER__END diff --git a/linters/powershell_powershell/Dockerfile b/linters/powershell_powershell/Dockerfile index 9959f93b780..4f4e8e84583 100644 --- a/linters/powershell_powershell/Dockerfile +++ b/linters/powershell_powershell/Dockerfile @@ -221,9 +221,10 @@ COPY --from=copy-collector / / ############################################################################################# #OTHER__START # POWERSHELL installation -RUN --mount=type=secret,id=GITHUB_TOKEN case ${TARGETPLATFORM} in \ +RUN --mount=type=secret,id=GITHUB_TOKEN ([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && exit 0) || \ + case ${TARGETPLATFORM} in \ "linux/amd64") POWERSHELL_ARCH=alpine-x64 ;; \ - "linux/arm64") POWERSHELL_ARCH=arm64 ;; \ + "linux/arm64") POWERSHELL_ARCH=alpine-arm64 ;; \ esac \ && mkdir -p ${PWSH_DIRECTORY} \ && curl --retry 5 --retry-delay 5 -s \ diff --git a/linters/powershell_powershell_formatter/Dockerfile b/linters/powershell_powershell_formatter/Dockerfile index 1f616ca897f..c40a0dd844c 100644 --- a/linters/powershell_powershell_formatter/Dockerfile +++ b/linters/powershell_powershell_formatter/Dockerfile @@ -221,9 +221,10 @@ COPY --from=copy-collector / / ############################################################################################# #OTHER__START # POWERSHELL installation -RUN --mount=type=secret,id=GITHUB_TOKEN case ${TARGETPLATFORM} in \ +RUN --mount=type=secret,id=GITHUB_TOKEN ([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && exit 0) || \ + case ${TARGETPLATFORM} in \ "linux/amd64") POWERSHELL_ARCH=alpine-x64 ;; \ - "linux/arm64") POWERSHELL_ARCH=arm64 ;; \ + "linux/arm64") POWERSHELL_ARCH=alpine-arm64 ;; \ esac \ && mkdir -p ${PWSH_DIRECTORY} \ && curl --retry 5 --retry-delay 5 -s \ diff --git a/megalinter/descriptors/arm.megalinter-descriptor.yml b/megalinter/descriptors/arm.megalinter-descriptor.yml index 89225421e69..a1f7bd8c761 100644 --- a/megalinter/descriptors/arm.megalinter-descriptor.yml +++ b/megalinter/descriptors/arm.megalinter-descriptor.yml @@ -14,10 +14,12 @@ install: - ARG TARGETPLATFORM - ARG PWSH_VERSION='latest' - ARG PWSH_DIRECTORY='/opt/microsoft/powershell' + # Currently there is no support for alpine / arm in powershell. Leaving the case statement here since it should work once it's supported - | - RUN case ${TARGETPLATFORM} in \ + RUN ([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && exit 0) || \ + case ${TARGETPLATFORM} in \ "linux/amd64") POWERSHELL_ARCH=alpine-x64 ;; \ - "linux/arm64") POWERSHELL_ARCH=arm64 ;; \ + "linux/arm64") POWERSHELL_ARCH=alpine-arm64 ;; \ esac \ && mkdir -p ${PWSH_DIRECTORY} \ && curl --retry 5 --retry-delay 5 -s \ @@ -29,7 +31,8 @@ install: | cut -d '"' -f 4 \ | xargs -n 1 wget -O - \ | tar -xzC ${PWSH_DIRECTORY} \ - && ln -sf ${PWSH_DIRECTORY}/pwsh /usr/bin/pwsh + && ln -sf ${PWSH_DIRECTORY}/pwsh /usr/bin/pwsh \ + && chmod +x /usr/bin/pwsh linters: # ARM TTK - class: ArmLinter @@ -70,7 +73,6 @@ linters: supported_platforms: platform: - linux/amd64 - - linux/arm64 ide: vscode: - name: ARMTTKExtension diff --git a/megalinter/descriptors/powershell.megalinter-descriptor.yml b/megalinter/descriptors/powershell.megalinter-descriptor.yml index 5d68f11d257..c1baa452336 100644 --- a/megalinter/descriptors/powershell.megalinter-descriptor.yml +++ b/megalinter/descriptors/powershell.megalinter-descriptor.yml @@ -21,10 +21,12 @@ install: - ARG TARGETPLATFORM - ARG PWSH_VERSION='latest' - ARG PWSH_DIRECTORY='/opt/microsoft/powershell' + # Currently there is no support for alpine / arm in powershell. Leaving the case statement here since it should work once it's supported - | - RUN case ${TARGETPLATFORM} in \ + RUN ([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && exit 0) || \ + case ${TARGETPLATFORM} in \ "linux/amd64") POWERSHELL_ARCH=alpine-x64 ;; \ - "linux/arm64") POWERSHELL_ARCH=arm64 ;; \ + "linux/arm64") POWERSHELL_ARCH=alpine-arm64 ;; \ esac \ && mkdir -p ${PWSH_DIRECTORY} \ && curl --retry 5 --retry-delay 5 -s \ @@ -62,7 +64,6 @@ linters: supported_platforms: platform: - linux/amd64 - - linux/arm64 ide: vscode: - name: VSCode PowerShell extension @@ -96,7 +97,6 @@ linters: supported_platforms: platform: - linux/amd64 - - linux/arm64 ide: vscode: - name: VSCode PowerShell extension From 79f607e2865fd5b13be848379e3856a6cc10ce28 Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Wed, 26 Jul 2023 16:15:23 -0500 Subject: [PATCH 103/105] Bugfix --- Dockerfile | 8 ++++---- flavors/cupcake/Dockerfile | 4 ++-- flavors/dotnet/Dockerfile | 4 ++-- flavors/dotnetweb/Dockerfile | 4 ++-- flavors/rust/Dockerfile | 4 ++-- linters/powershell_powershell/Dockerfile | 2 +- linters/powershell_powershell_formatter/Dockerfile | 2 +- .../descriptors/powershell.megalinter-descriptor.yml | 4 ++-- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4f730aa48d5..2a4d6fdbcf6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -101,12 +101,12 @@ RUN rustup-init -y --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-u RUN --mount=type=cache,id=cargo-${TARGETARCH},sharing=locked,target=/cargo/.cargo/registry/,uid=63425 \ . /cargo/.cargo/env \ - && cargo binstall --no-confirm --no-symlinks shellcheck-sarif sarif-fmt --root /tmp --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") + && cargo binstall --no-confirm --no-symlinks sarif-fmt shellcheck-sarif --root /tmp --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") FROM scratch AS cargo COPY --link --from=cargo-build /tmp/bin/* /bin/ -RUN ["/bin/shellcheck-sarif", "--help"] RUN ["/bin/sarif-fmt", "--help"] +RUN ["/bin/shellcheck-sarif", "--help"] #FROM__END @@ -949,11 +949,11 @@ RUN --mount=type=secret,id=GITHUB_TOKEN GITHUB_AUTH_TOKEN="$(cat /run/secrets/GI # # powershell installation -RUN pwsh -c 'Install-Module -Name PSScriptAnalyzer -RequiredVersion ${PSSA_VERSION} -Scope AllUsers -Force' +RUN ([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && exit 0) || pwsh -c 'Install-Module -Name PSScriptAnalyzer -RequiredVersion ${PSSA_VERSION} -Scope AllUsers -Force' # # powershell_formatter installation # Next line commented because already managed by another linter -# RUN pwsh -c 'Install-Module -Name PSScriptAnalyzer -RequiredVersion ${PSSA_VERSION} -Scope AllUsers -Force' +# RUN ([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && exit 0) || pwsh -c 'Install-Module -Name PSScriptAnalyzer -RequiredVersion ${PSSA_VERSION} -Scope AllUsers -Force' # # mypy installation ENV MYPY_CACHE_DIR=/tmp diff --git a/flavors/cupcake/Dockerfile b/flavors/cupcake/Dockerfile index f874a18d230..197adc4b67d 100644 --- a/flavors/cupcake/Dockerfile +++ b/flavors/cupcake/Dockerfile @@ -88,12 +88,12 @@ RUN rustup-init -y --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-u RUN --mount=type=cache,id=cargo-${TARGETARCH},sharing=locked,target=/cargo/.cargo/registry/,uid=63425 \ . /cargo/.cargo/env \ - && cargo binstall --no-confirm --no-symlinks shellcheck-sarif sarif-fmt --root /tmp --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") + && cargo binstall --no-confirm --no-symlinks sarif-fmt shellcheck-sarif --root /tmp --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") FROM scratch AS cargo COPY --link --from=cargo-build /tmp/bin/* /bin/ -RUN ["/bin/shellcheck-sarif", "--help"] RUN ["/bin/sarif-fmt", "--help"] +RUN ["/bin/shellcheck-sarif", "--help"] #FROM__END diff --git a/flavors/dotnet/Dockerfile b/flavors/dotnet/Dockerfile index 0e87ca5a09a..5febfd2f570 100644 --- a/flavors/dotnet/Dockerfile +++ b/flavors/dotnet/Dockerfile @@ -511,11 +511,11 @@ esac \ curl --retry 5 --retry-delay 5 -sLv https://raw.githubusercontent.com/kubescape/kubescape/master/install.sh | /bin/bash -s -- -v v2.3.6 \ # # powershell installation - && pwsh -c 'Install-Module -Name PSScriptAnalyzer -RequiredVersion ${PSSA_VERSION} -Scope AllUsers -Force' \ + && ([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && exit 0) || pwsh -c 'Install-Module -Name PSScriptAnalyzer -RequiredVersion ${PSSA_VERSION} -Scope AllUsers -Force' \ # # powershell_formatter installation # Next line commented because already managed by another linter -# RUN pwsh -c 'Install-Module -Name PSScriptAnalyzer -RequiredVersion ${PSSA_VERSION} -Scope AllUsers -Force' +# RUN ([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && exit 0) || pwsh -c 'Install-Module -Name PSScriptAnalyzer -RequiredVersion ${PSSA_VERSION} -Scope AllUsers -Force' # # grype installation && curl -sSfL https://raw.githubusercontent.com/anchore/grype/main/install.sh | sh -s -- -b /usr/local/bin v0.63.1 \ diff --git a/flavors/dotnetweb/Dockerfile b/flavors/dotnetweb/Dockerfile index f68d3e1c9c7..afd8153f7bf 100644 --- a/flavors/dotnetweb/Dockerfile +++ b/flavors/dotnetweb/Dockerfile @@ -531,11 +531,11 @@ esac \ curl --retry 5 --retry-delay 5 -sLv https://raw.githubusercontent.com/kubescape/kubescape/master/install.sh | /bin/bash -s -- -v v2.3.6 \ # # powershell installation - && pwsh -c 'Install-Module -Name PSScriptAnalyzer -RequiredVersion ${PSSA_VERSION} -Scope AllUsers -Force' \ + && ([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && exit 0) || pwsh -c 'Install-Module -Name PSScriptAnalyzer -RequiredVersion ${PSSA_VERSION} -Scope AllUsers -Force' \ # # powershell_formatter installation # Next line commented because already managed by another linter -# RUN pwsh -c 'Install-Module -Name PSScriptAnalyzer -RequiredVersion ${PSSA_VERSION} -Scope AllUsers -Force' +# RUN ([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && exit 0) || pwsh -c 'Install-Module -Name PSScriptAnalyzer -RequiredVersion ${PSSA_VERSION} -Scope AllUsers -Force' # # grype installation && curl -sSfL https://raw.githubusercontent.com/anchore/grype/main/install.sh | sh -s -- -b /usr/local/bin v0.63.1 \ diff --git a/flavors/rust/Dockerfile b/flavors/rust/Dockerfile index ab92e499445..ec5a479b55d 100644 --- a/flavors/rust/Dockerfile +++ b/flavors/rust/Dockerfile @@ -58,12 +58,12 @@ RUN rustup-init -y --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-u RUN --mount=type=cache,id=cargo-${TARGETARCH},sharing=locked,target=/cargo/.cargo/registry/,uid=63425 \ . /cargo/.cargo/env \ - && cargo binstall --no-confirm --no-symlinks shellcheck-sarif sarif-fmt --root /tmp --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") + && cargo binstall --no-confirm --no-symlinks sarif-fmt shellcheck-sarif --root /tmp --target $([[ "${TARGETARCH}" == "amd64" ]] && echo "x86_64-unknown-linux-musl" || echo "aarch64-unknown-linux-musl") FROM scratch AS cargo COPY --link --from=cargo-build /tmp/bin/* /bin/ -RUN ["/bin/shellcheck-sarif", "--help"] RUN ["/bin/sarif-fmt", "--help"] +RUN ["/bin/shellcheck-sarif", "--help"] #FROM__END diff --git a/linters/powershell_powershell/Dockerfile b/linters/powershell_powershell/Dockerfile index 4f4e8e84583..a5138bcd251 100644 --- a/linters/powershell_powershell/Dockerfile +++ b/linters/powershell_powershell/Dockerfile @@ -241,7 +241,7 @@ RUN --mount=type=secret,id=GITHUB_TOKEN ([[ "${TARGETPLATFORM}" == "linux/arm64" # # powershell installation -RUN pwsh -c 'Install-Module -Name PSScriptAnalyzer -RequiredVersion ${PSSA_VERSION} -Scope AllUsers -Force' +RUN ([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && exit 0) || pwsh -c 'Install-Module -Name PSScriptAnalyzer -RequiredVersion ${PSSA_VERSION} -Scope AllUsers -Force' # #OTHER__END diff --git a/linters/powershell_powershell_formatter/Dockerfile b/linters/powershell_powershell_formatter/Dockerfile index c40a0dd844c..74dbad07286 100644 --- a/linters/powershell_powershell_formatter/Dockerfile +++ b/linters/powershell_powershell_formatter/Dockerfile @@ -241,7 +241,7 @@ RUN --mount=type=secret,id=GITHUB_TOKEN ([[ "${TARGETPLATFORM}" == "linux/arm64" # # powershell_formatter installation -RUN pwsh -c 'Install-Module -Name PSScriptAnalyzer -RequiredVersion ${PSSA_VERSION} -Scope AllUsers -Force' +RUN ([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && exit 0) || pwsh -c 'Install-Module -Name PSScriptAnalyzer -RequiredVersion ${PSSA_VERSION} -Scope AllUsers -Force' # #OTHER__END diff --git a/megalinter/descriptors/powershell.megalinter-descriptor.yml b/megalinter/descriptors/powershell.megalinter-descriptor.yml index c1baa452336..4c681b77927 100644 --- a/megalinter/descriptors/powershell.megalinter-descriptor.yml +++ b/megalinter/descriptors/powershell.megalinter-descriptor.yml @@ -60,7 +60,7 @@ linters: install: dockerfile: - ARG PSSA_VERSION='latest' - - RUN pwsh -c 'Install-Module -Name PSScriptAnalyzer -RequiredVersion ${PSSA_VERSION} -Scope AllUsers -Force' + - RUN ([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && exit 0) || pwsh -c 'Install-Module -Name PSScriptAnalyzer -RequiredVersion ${PSSA_VERSION} -Scope AllUsers -Force' supported_platforms: platform: - linux/amd64 @@ -93,7 +93,7 @@ linters: install: dockerfile: - ARG PSSA_VERSION='latest' - - RUN pwsh -c 'Install-Module -Name PSScriptAnalyzer -RequiredVersion ${PSSA_VERSION} -Scope AllUsers -Force' + - RUN ([[ "${TARGETPLATFORM}" == "linux/arm64" ]] && exit 0) || pwsh -c 'Install-Module -Name PSScriptAnalyzer -RequiredVersion ${PSSA_VERSION} -Scope AllUsers -Force' supported_platforms: platform: - linux/amd64 From c811e524ad6ff8e569e09f25c8e203cd262185d9 Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Wed, 26 Jul 2023 17:34:32 -0500 Subject: [PATCH 104/105] Reenable amd64 --- .github/workflows/-build-docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/-build-docker.yml b/.github/workflows/-build-docker.yml index 213149fa745..c8cc5945156 100644 --- a/.github/workflows/-build-docker.yml +++ b/.github/workflows/-build-docker.yml @@ -88,7 +88,7 @@ jobs: uses: docker/build-push-action@v4 with: file: ${{ inputs.dockerfile }} - platforms: linux/arm64 # linux/amd64, + platforms: linux/amd64,linux/arm64 build-args: | BUILD_DATE=${{ env.BUILD_DATE }} BUILD_REVISION=${{ github.sha }} From 8a809c9e7ad83598bb83092b8064a1204c5241dc Mon Sep 17 00:00:00 2001 From: Aaron Aichlmayr Date: Thu, 27 Jul 2023 08:15:32 -0500 Subject: [PATCH 105/105] Increase build space using action --- .github/workflows/-build-docker.yml | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/workflows/-build-docker.yml b/.github/workflows/-build-docker.yml index c8cc5945156..8c8e9865d38 100644 --- a/.github/workflows/-build-docker.yml +++ b/.github/workflows/-build-docker.yml @@ -31,16 +31,19 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 120 steps: + - name: Maximize build space + uses: easimon/maximize-build-space@master + with: + root-reserve-mb: 512 + swap-size-mb: 1024 + remove-dotnet: 'true' # will release about 17GB if you don't need .NET + remove-haskell: 'true' # will release about 2.7GB if you don't need haskell + remove-android: 'true' # will release about 11 GB if you don't need Android + remove-codeql: 'true' # will release about 5.4GB if you don't need CodeQL + remove-docker-images: 'true' # will free about 3GB by clearing out some pre cached images - name: Checkout Code uses: actions/checkout@v3 - # Free disk space - - name: Free Disk space - shell: bash - run: | - sudo rm -rf /usr/local/lib/android # will release about 10 GB if you don't need Android - sudo rm -rf /usr/share/dotnet # will release about 20GB if you don't need .NET - - name: Set up QEMU uses: docker/setup-qemu-action@v2