Support arm64 builds

This commit is contained in:
Gábor Csárdi 2023-01-05 11:30:10 +01:00
commit 3b3a13513d
13 changed files with 62 additions and 39 deletions

View file

@ -49,9 +49,11 @@ RUN yum -y update \
RUN pip3 install awscli --upgrade --user && \
ln -s /root/.local/bin/aws /usr/bin/aws
RUN curl -LO https://github.com/goreleaser/nfpm/releases/download/v2.18.1/nfpm_amd64.rpm && \
yum install -y nfpm_amd64.rpm && \
rm nfpm_amd64.rpm
RUN if [ "$(arch)" == "aarch64" ]; then echo arm64; else echo amd64; fi > /tmp/arch
RUN curl -LO "https://github.com/goreleaser/nfpm/releases/download/v2.18.1/nfpm_$(cat /tmp/arch).rpm" && \
yum install -y "nfpm_$(cat /tmp/arch).rpm" && \
rm "nfpm_$(cat /tmp/arch).rpm"
RUN chmod 0777 /opt

View file

@ -50,9 +50,11 @@ RUN dnf -y upgrade \
RUN pip3 install awscli --upgrade --user \
&& ln -s /root/.local/bin/aws /usr/bin/aws
RUN curl -LO https://github.com/goreleaser/nfpm/releases/download/v2.18.1/nfpm_amd64.rpm && \
dnf install -y nfpm_amd64.rpm && \
rm nfpm_amd64.rpm
RUN if [ "$(arch)" == "aarch64" ]; then echo arm64; else echo amd64; fi > /tmp/arch
RUN curl -LO "https://github.com/goreleaser/nfpm/releases/download/v2.18.1/nfpm_$(cat /tmp/arch).rpm" && \
dnf install -y "nfpm_$(cat /tmp/arch).rpm" && \
rm "nfpm_$(cat /tmp/arch).rpm"
RUN chmod 0777 /opt

View file

@ -14,9 +14,9 @@ RUN pip3 install awscli
RUN chmod 0777 /opt
RUN curl -LO https://github.com/goreleaser/nfpm/releases/download/v2.18.1/nfpm_amd64.deb && \
apt install -y ./nfpm_amd64.deb && \
rm nfpm_amd64.deb
RUN curl -LO "https://github.com/goreleaser/nfpm/releases/download/v2.18.1/nfpm_$(dpkg --print-architecture).deb" && \
apt install -y "./nfpm_$(dpkg --print-architecture).deb" && \
rm "nfpm_$(dpkg --print-architecture).deb"
# Override the default pager used by R
ENV PAGER /usr/bin/pager

View file

@ -14,9 +14,9 @@ RUN pip3 install awscli
RUN chmod 0777 /opt
RUN curl -LO https://github.com/goreleaser/nfpm/releases/download/v2.18.1/nfpm_amd64.deb && \
apt install -y ./nfpm_amd64.deb && \
rm nfpm_amd64.deb
RUN curl -LO "https://github.com/goreleaser/nfpm/releases/download/v2.18.1/nfpm_$(dpkg --print-architecture).deb" && \
apt install -y "./nfpm_$(dpkg --print-architecture).deb" && \
rm "nfpm_$(dpkg --print-architecture).deb"
# Override the default pager used by R
ENV PAGER /usr/bin/pager

View file

@ -70,9 +70,11 @@ RUN zypper --non-interactive --gpg-auto-import-keys -n install \
RUN pip install awscli
RUN curl -LO https://github.com/goreleaser/nfpm/releases/download/v2.18.1/nfpm_amd64.rpm && \
zypper --non-interactive --no-gpg-checks install nfpm_amd64.rpm && \
rm nfpm_amd64.rpm
RUN if [ "$(arch)" == "aarch64" ]; then echo arm64; else echo amd64; fi > /tmp/arch
RUN curl -LO "https://github.com/goreleaser/nfpm/releases/download/v2.18.1/nfpm_$(cat /tmp/arch).rpm" && \
zypper --non-interactive --no-gpg-checks install "nfpm_$(cat /tmp/arch).rpm" && \
rm "nfpm_$(cat /tmp/arch).rpm"
RUN chmod 0777 /opt

View file

@ -67,14 +67,16 @@ RUN zypper --non-interactive --gpg-auto-import-keys -n install \
&& zypper clean
# Install AWS CLI
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && \
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-$(uname -p).zip" -o "awscliv2.zip" && \
unzip awscliv2.zip && \
./aws/install && \
rm -rf aws awscliv2.zip
RUN curl -LO https://github.com/goreleaser/nfpm/releases/download/v2.18.1/nfpm_amd64.rpm && \
zypper --non-interactive --no-gpg-checks install nfpm_amd64.rpm && \
rm nfpm_amd64.rpm
RUN if [ "$(arch)" == "aarch64" ]; then echo arm64; else echo amd64; fi > /tmp/arch
RUN curl -LO "https://github.com/goreleaser/nfpm/releases/download/v2.18.1/nfpm_$(cat /tmp/arch).rpm" && \
zypper --non-interactive --no-gpg-checks install "nfpm_$(cat /tmp/arch).rpm" && \
rm "nfpm_$(cat /tmp/arch).rpm"
RUN chmod 0777 /opt

View file

@ -46,14 +46,16 @@ RUN dnf -y upgrade \
&& dnf clean all
# Install AWS CLI
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && \
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-$(uname -p).zip" -o "awscliv2.zip" && \
unzip awscliv2.zip && \
./aws/install && \
rm -rf aws awscliv2.zip
RUN curl -LO https://github.com/goreleaser/nfpm/releases/download/v2.18.1/nfpm_amd64.rpm && \
dnf install -y nfpm_amd64.rpm && \
rm nfpm_amd64.rpm
RUN if [ "$(arch)" == "aarch64" ]; then echo arm64; else echo amd64; fi > /tmp/arch
RUN curl -LO "https://github.com/goreleaser/nfpm/releases/download/v2.18.1/nfpm_$(cat /tmp/arch).rpm" && \
dnf install -y "nfpm_$(cat /tmp/arch).rpm" && \
rm "nfpm_$(cat /tmp/arch).rpm"
RUN chmod 0777 /opt

View file

@ -11,9 +11,9 @@ RUN set -x \
RUN pip install awscli
RUN curl -LO https://github.com/goreleaser/nfpm/releases/download/v2.18.1/nfpm_amd64.deb && \
apt install -y ./nfpm_amd64.deb && \
rm nfpm_amd64.deb
RUN curl -LO "https://github.com/goreleaser/nfpm/releases/download/v2.18.1/nfpm_$(dpkg --print-architecture).deb" && \
apt install -y "./nfpm_$(dpkg --print-architecture).deb" && \
rm "nfpm_$(dpkg --print-architecture).deb"
RUN chmod 0777 /opt

View file

@ -11,9 +11,9 @@ RUN set -x \
RUN pip3 install awscli
RUN curl -LO https://github.com/goreleaser/nfpm/releases/download/v2.18.1/nfpm_amd64.deb && \
apt install -y ./nfpm_amd64.deb && \
rm nfpm_amd64.deb
RUN curl -LO "https://github.com/goreleaser/nfpm/releases/download/v2.18.1/nfpm_$(dpkg --print-architecture).deb" && \
apt install -y "./nfpm_$(dpkg --print-architecture).deb" && \
rm "nfpm_$(dpkg --print-architecture).deb"
RUN chmod 0777 /opt

View file

@ -11,9 +11,9 @@ RUN set -x \
RUN pip3 install awscli
RUN curl -LO https://github.com/goreleaser/nfpm/releases/download/v2.18.1/nfpm_amd64.deb && \
apt install -y ./nfpm_amd64.deb && \
rm nfpm_amd64.deb
RUN curl -LO "https://github.com/goreleaser/nfpm/releases/download/v2.18.1/nfpm_$(dpkg --print-architecture).deb" && \
apt install -y "./nfpm_$(dpkg --print-architecture).deb" && \
rm "nfpm_$(dpkg --print-architecture).deb"
RUN chmod 0777 /opt

View file

@ -67,7 +67,7 @@ compile_r() {
# tools/config.guess in R versions older than 3.2.2 guess 'unknown' instead of 'pc'
# test the version and properly set the flag.
build_flag='--build=x86_64-pc-linux-gnu'
build_flag="--build=$(uname -p)-pc-linux-gnu"
if _version_is_greater_than ${R_VERSION} 3.2.2; then
build_flag=''
fi

View file

@ -144,19 +144,30 @@ do_show_versions () {
done
}
# Returns the installer name for a given version and OS
# Returns the installer name for a given version, OS, arch
download_name () {
os=$1
version=$2
arch=$3
case $arch in
"x86_64" | "amd64")
rpm_arch="x86_64"
deb_arch="amd64"
;;
"aarch64")
rpm_arch="aarch64"
deb_arch="arm64"
;;
esac
case $os in
"RedHat" | "CentOS" | "Amazon" | "Alma" | "Rocky")
echo "R-${version}-1-1.x86_64.rpm"
echo "R-${version}-1-1.${rpm_arch}.rpm"
;;
"Ubuntu" | "Debian")
echo "r-${version}_1_amd64.deb"
echo "r-${version}_1_${deb_arch}.deb"
;;
"LEAP12" | "LEAP15" | "SLES12" | "SLES15")
echo "R-${version}-1-1.x86_64.rpm"
echo "R-${version}-1-1.${rpm_arch}.rpm"
;;
esac
}
@ -486,8 +497,10 @@ do_install () {
prompt_version
[ -z $SELECTED_VERSION ] && { echo "Invalid version"; exit 1; }
arch=$(uname -p)
# Get the name of the installer to use
installer_file_name=$(download_name "${os}" "${SELECTED_VERSION}")
installer_file_name=$(download_name "${os}" "${SELECTED_VERSION}" "${arch}")
# Get the URL to download from. If the installer already exists in the current
# directory, this will return a blank string.

View file

@ -8,7 +8,7 @@ RUN apt-get update -qq && apt-get install -y python-pip
RUN pip install awscli
# install docker cli
RUN wget -q -O /tmp/docker-cli.deb https://download.docker.com/linux/debian/dists/stretch/pool/stable/amd64/docker-ce-cli_18.09.2~3-0~debian-stretch_amd64.deb \
RUN wget -q -O /tmp/docker-cli.deb https://download.docker.com/linux/debian/dists/stretch/pool/stable/$(dpkg --print-architecture)/docker-ce-cli_18.09.2~3-0~debian-stretch_$(dpkg --print-architecture).deb \
&& dpkg -i /tmp/docker-cli.deb
RUN npm install -g serverless