2022-12-29 12:56:54 -05:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -euo pipefail
|
2023-01-02 12:18:10 -05:00
|
|
|
set -x
|
2022-12-29 12:56:54 -05:00
|
|
|
|
2023-04-21 23:57:35 -04:00
|
|
|
case $TARGETARCH in
|
|
|
|
amd64)
|
|
|
|
target=x86_64
|
|
|
|
;;
|
|
|
|
arm64)
|
|
|
|
target=aarch64
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "$TARGETARCH is not supported"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2022-12-29 12:56:54 -05:00
|
|
|
apk add curl jq
|
|
|
|
url=$(curl -s \
|
|
|
|
-H "Accept: application/vnd.github+json" \
|
2023-01-04 00:41:31 -05:00
|
|
|
-H "Authorization: Bearer $(cat /run/secrets/GITHUB_TOKEN)" \
|
2022-12-29 12:56:54 -05:00
|
|
|
"https://api.github.com/repos/sgerrand/alpine-pkg-glibc/releases/tags/${GLIBC_VERSION}" |
|
|
|
|
jq --arg name "glibc-${GLIBC_VERSION}.apk" -r '.assets | .[] | select(.name | contains($name)) | .url')
|
|
|
|
curl --retry 5 --retry-delay 5 -sL -o "glibc-${GLIBC_VERSION}.apk" \
|
|
|
|
-H "Accept: application/octet-stream" \
|
2023-01-04 00:41:31 -05:00
|
|
|
-H "Authorization: Bearer $(cat /run/secrets/GITHUB_TOKEN)" \
|
2022-12-29 12:56:54 -05:00
|
|
|
"${url}"
|
2023-01-04 00:54:55 -05:00
|
|
|
apk add --no-cache --force-overwrite \
|
2022-12-29 12:56:54 -05:00
|
|
|
bash \
|
|
|
|
ca-certificates \
|
|
|
|
"glibc-${GLIBC_VERSION}.apk" \
|
|
|
|
gnupg \
|
2023-12-13 03:28:05 -05:00
|
|
|
php82 php82-curl php82-ctype php82-dom php82-iconv php82-mbstring \
|
|
|
|
php82-openssl php82-phar php82-simplexml php82-tokenizer php82-xmlwriter \
|
2022-12-29 12:56:54 -05:00
|
|
|
tar zstd
|
|
|
|
rm "glibc-${GLIBC_VERSION}.apk"
|
|
|
|
mkdir /tmp/libz
|
2023-04-21 23:57:35 -04:00
|
|
|
curl --retry 5 --retry-delay 5 -sL https://www.archlinux.org/packages/core/${target}/zlib/download | tar -x --zstd -C /tmp/libz
|
2022-12-29 12:56:54 -05:00
|
|
|
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
|
|
|
|
curl --retry 5 --retry-delay 5 -sLO https://phar.io/releases/phive.phar.asc
|
|
|
|
gpg --keyserver hkps://keyserver.ubuntu.com --recv-keys "0x9D8A98B29B2D5D79"
|
|
|
|
gpg --verify phive.phar.asc phive.phar
|
|
|
|
chmod +x phive.phar
|
|
|
|
mv phive.phar /usr/local/bin/phive
|
|
|
|
rm phive.phar.asc
|
2023-12-11 12:37:24 -05:00
|
|
|
|
|
|
|
# Install PHARs
|
|
|
|
phive --no-progress install \
|
|
|
|
--trust-gpg-keys 31C7E470E2138192,CF1A108D0E7AE720,8A03EA3B385DBAA1,12CE0F1D262429A5,5E6DDE998AB73B8E,51C67305FFC2E5C0 \
|
|
|
|
--target /usr/bin \
|
|
|
|
phpstan@^1.10.48 \
|
|
|
|
psalm@^5.17.0 \
|
|
|
|
phpcs@^3.8.0
|