mirror of
https://github.com/super-linter/super-linter.git
synced 2024-11-21 13:41:19 -05:00
parametrize the install scripts
This commit is contained in:
parent
47884a0e25
commit
5cbf58c106
5 changed files with 71 additions and 12 deletions
|
@ -46,6 +46,8 @@ ARG KTLINT_VERSION='0.47.1'
|
|||
ARG PSSA_VERSION='1.21.0'
|
||||
ARG PWSH_DIRECTORY='/usr/lib/microsoft/powershell'
|
||||
ARG PWSH_VERSION='v7.3.1'
|
||||
# https://docs.docker.com/engine/reference/builder/#automatic-platform-args-in-the-global-scope
|
||||
ARG TARGETARCH
|
||||
|
||||
####################
|
||||
# Run APK installs #
|
||||
|
@ -235,6 +237,8 @@ ARG BUILD_REVISION
|
|||
ARG BUILD_VERSION
|
||||
## install alpine-pkg-glibc (glibc compatibility layer package for Alpine Linux)
|
||||
ARG GLIBC_VERSION='2.34-r0'
|
||||
# https://docs.docker.com/engine/reference/builder/#automatic-platform-args-in-the-global-scope
|
||||
ARG TARGETARCH
|
||||
|
||||
#########################################
|
||||
# Label the instance and set maintainer #
|
||||
|
@ -356,6 +360,8 @@ ENTRYPOINT ["/action/lib/linter.sh"]
|
|||
# Grab small clean image to build standard ###############################
|
||||
################################################################################
|
||||
FROM slim as standard
|
||||
# https://docs.docker.com/engine/reference/builder/#automatic-platform-args-in-the-global-scope
|
||||
ARG TARGETARCH
|
||||
|
||||
###############
|
||||
# Set up args #
|
||||
|
|
|
@ -2,6 +2,19 @@
|
|||
|
||||
set -euo pipefail
|
||||
|
||||
case $TARGETARCH in
|
||||
amd64)
|
||||
target=x64
|
||||
;;
|
||||
arm64)
|
||||
target=arm64
|
||||
;;
|
||||
*)
|
||||
echo "$TARGETARCH is not supported"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
##################
|
||||
# Install ktlint #
|
||||
##################
|
||||
|
@ -33,10 +46,10 @@ curl --retry 5 --retry-delay 5 -sL -o "glibc-${GLIBC_VERSION}.apk" \
|
|||
apk add --no-cache --force-overwrite "glibc-${GLIBC_VERSION}.apk"
|
||||
rm "glibc-${GLIBC_VERSION}.apk"
|
||||
|
||||
curl --retry 5 --retry-delay 5 -sO "https://storage.googleapis.com/dart-archive/channels/stable/release/${DART_VERSION}/sdk/dartsdk-linux-x64-release.zip"
|
||||
unzip -q dartsdk-linux-x64-release.zip
|
||||
curl --retry 5 --retry-delay 5 -sO "https://storage.googleapis.com/dart-archive/channels/stable/release/${DART_VERSION}/sdk/dartsdk-linux-${target}-release.zip"
|
||||
unzip -q dartsdk-linux-${target}-release.zip
|
||||
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/ dartsdk-linux-x64-release.zip
|
||||
rm -r dart-sdk/ dartsdk-linux-${target}-release.zip
|
||||
|
||||
################################
|
||||
# Create and install Bash-Exec #
|
||||
|
|
|
@ -3,6 +3,19 @@
|
|||
set -euo pipefail
|
||||
set -x
|
||||
|
||||
case $TARGETARCH in
|
||||
amd64)
|
||||
target=x86_64
|
||||
;;
|
||||
arm64)
|
||||
target=aarch64
|
||||
;;
|
||||
*)
|
||||
echo "$TARGETARCH is not supported"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
apk add curl jq
|
||||
url=$(curl -s \
|
||||
-H "Accept: application/vnd.github+json" \
|
||||
|
@ -23,7 +36,7 @@ apk add --no-cache --force-overwrite \
|
|||
tar zstd
|
||||
rm "glibc-${GLIBC_VERSION}.apk"
|
||||
mkdir /tmp/libz
|
||||
curl --retry 5 --retry-delay 5 -sL https://www.archlinux.org/packages/core/x86_64/zlib/download | tar -x --zstd -C /tmp/libz
|
||||
curl --retry 5 --retry-delay 5 -sL https://www.archlinux.org/packages/core/${target}/zlib/download | tar -x --zstd -C /tmp/libz
|
||||
mv /tmp/libz/usr/lib/libz.so* /usr/glibc-compat/lib
|
||||
rm -rf /tmp/libz
|
||||
curl --retry 5 --retry-delay 5 -sLO https://phar.io/releases/phive.phar
|
||||
|
|
|
@ -6,12 +6,24 @@ set -euo pipefail
|
|||
# Slightly modified to always retrieve latest stable Powershell version
|
||||
# If changing PWSH_VERSION='latest' to a specific version, use format PWSH_VERSION='tags/v7.0.2'
|
||||
|
||||
case $TARGETARCH in
|
||||
amd64)
|
||||
target=x64
|
||||
;;
|
||||
# arm64)
|
||||
# only on ubuntu
|
||||
*)
|
||||
echo "$TARGETARCH is not supported"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
mkdir -p "${PWSH_DIRECTORY}"
|
||||
url=$(curl -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}" |
|
||||
jq -r '.assets | .[] | select(.name | contains("linux-alpine-x64")) | .url')
|
||||
jq --arg target "${target}" -r '.assets | .[] | select(.name | contains("linux-alpine-" + $target)) | .url')
|
||||
curl --retry 5 --retry-delay 5 -sL \
|
||||
-H "Accept: application/octet-stream" \
|
||||
-H "Authorization: Bearer $(cat /run/secrets/GITHUB_TOKEN)" \
|
||||
|
|
|
@ -2,17 +2,32 @@
|
|||
# shellcheck disable=SC2016
|
||||
# shellcheck disable=SC2129
|
||||
|
||||
# https://doc.rust-lang.org/rustc/platform-support.html
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
case $TARGETARCH in
|
||||
amd64)
|
||||
target=x86_64
|
||||
;;
|
||||
arm64)
|
||||
target=aarch64
|
||||
;;
|
||||
*)
|
||||
echo "$TARGETARCH is not supported"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
ln -s /usr/bin/rustup-init /usr/bin/rustup
|
||||
rustup toolchain install stable-x86_64-unknown-linux-musl
|
||||
rustup component add rustfmt --toolchain=stable-x86_64-unknown-linux-musl
|
||||
rustup component add clippy --toolchain=stable-x86_64-unknown-linux-musl
|
||||
rustup toolchain install stable-${target}-unknown-linux-musl
|
||||
rustup component add rustfmt --toolchain=stable-${target}-unknown-linux-musl
|
||||
rustup component add clippy --toolchain=stable-${target}-unknown-linux-musl
|
||||
mv /root/.rustup /usr/lib/.rustup
|
||||
ln -fsv /usr/lib/.rustup/toolchains/stable-x86_64-unknown-linux-musl/bin/rustfmt /usr/bin/rustfmt
|
||||
ln -fsv /usr/lib/.rustup/toolchains/stable-x86_64-unknown-linux-musl/bin/rustc /usr/bin/rustc
|
||||
ln -fsv /usr/lib/.rustup/toolchains/stable-x86_64-unknown-linux-musl/bin/cargo /usr/bin/cargo
|
||||
ln -fsv /usr/lib/.rustup/toolchains/stable-x86_64-unknown-linux-musl/bin/cargo-clippy /usr/bin/cargo-clippy
|
||||
ln -fsv /usr/lib/.rustup/toolchains/stable-${target}-unknown-linux-musl/bin/rustfmt /usr/bin/rustfmt
|
||||
ln -fsv /usr/lib/.rustup/toolchains/stable-${target}-unknown-linux-musl/bin/rustc /usr/bin/rustc
|
||||
ln -fsv /usr/lib/.rustup/toolchains/stable-${target}-unknown-linux-musl/bin/cargo /usr/bin/cargo
|
||||
ln -fsv /usr/lib/.rustup/toolchains/stable-${target}-unknown-linux-musl/bin/cargo-clippy /usr/bin/cargo-clippy
|
||||
|
||||
echo '#!/usr/bin/env bash' >/usr/bin/clippy
|
||||
echo 'pushd $(dirname $1)' >>/usr/bin/clippy
|
||||
|
|
Loading…
Reference in a new issue