start building docker images

This commit is contained in:
Patrick Schratz 2024-06-03 23:51:17 +02:00
commit 7b9cf84ebc
Signed by: pat-s
GPG key ID: 3C6318841EF78925
4 changed files with 61 additions and 26 deletions

View file

@ -1,12 +1,19 @@
#!/bin/bash
docker run --name r-pkg-binaries-rhel9 -e RED_HAT_DEV_PW -d redhat/ubi9 tail -f /dev/null
docker exec -it r-pkg-binaries-rhel9 bash
if [[ $1 == "redhat-9" ]]; then
docker run --name r-pkg-binaries-rhel9 -e RED_HAT_DEV_PW -d redhat/ubi9 tail -f /dev/null
docker exec -it r-pkg-binaries-rhel9 bash
elif [[ $1 == "ubuntu-24.04" ]]; then
docker run --name r-pkg-binaries-noble -d ubuntu/noble tail -f /dev/null
docker exec -it r-pkg-binaries-noble bash
elif [[ $1 == "redhat-8" ]]; then
docker run --name r-pkg-binaries-rhel8 -e RED_HAT_DEV_PW -d redhat/ubi8 tail -f /dev/null
docker exec -it r-pkg-binaries-rhel8 bash
fi
export R_VERSION=4.3.3
export PACKAGES="sf"
# export R_VERSION=4.0.5
# export PACKAGES="sf"
bash -c ./01-prepare.sh
bash -c ./02-build-binaries.sh
bash -c ./03-upload.sh
# bash -c ./02-build-binaries.sh
# bash -c ./03-upload.sh

View file

@ -6,17 +6,27 @@ PLATFORM_ID=$(cat /etc/os-release | grep 'PLATFORM_ID=' | cut -d'=' -f2 | tr -d
if [ $PLATFORM_ID = "platform:el9" ]; then
subscription-manager register --username pat-s --password $RED_HAT_DEV_PW
subscription-manager register --username pat-s --password $RED_HAT_DEV_PW
subscription-manager repos --enable codeready-builder-for-rhel-9-$(arch)-rpms
dnf -y install git rsync
# dnf update -y
# FIXME: protect PW
subscription-manager repos --enable codeready-builder-for-rhel-9-$(arch)-rpms
dnf -y install git rsync
echo "R Version: ${R_VERSION}"
echo "Downloading R-${R_VERSION}.rpm from S3..."
curl -o /tmp/R-${R_VERSION}.rpm https://cynkra-r-builds-arm64.s3.eu-central-1.amazonaws.com/el9/R-"${R_VERSION}"-1-1."$(arch)".rpm
dnf install -y /tmp/R-${R_VERSION}.rpm
echo "R Version: ${R_VERSION}"
echo "Downloading R-${R_VERSION}.rpm from S3..."
curl -o /tmp/R-${R_VERSION}.rpm https://cynkra-r-builds-arm64.s3.eu-central-1.amazonaws.com/el9/R-"${R_VERSION}"-1-1."$(arch)".rpm
dnf install -y /tmp/R-${R_VERSION}.rpm
elif [ $PLATFORM_ID = "platform:el8" ]; then
subscription-manager register --username pat-s --password $RED_HAT_DEV_PW
subscription-manager repos --enable codeready-builder-for-rhel-8-$(arch)-rpms
dnf -y install git rsync
echo "R Version: ${R_VERSION}"
echo "Downloading R-${R_VERSION}.rpm from S3..."
curl -o /tmp/R-${R_VERSION}.rpm https://cynkra-r-builds-arm64.s3.eu-central-1.amazonaws.com/el8/R-"${R_VERSION}"-1-1."$(arch)".rpm
dnf install -y /tmp/R-${R_VERSION}.rpm
fi
export PATH=/opt/R/${R_VERSION}/bin:$PATH
@ -24,15 +34,15 @@ export PATH=/opt/R/${R_VERSION}/bin:$PATH
### install R packages needed for building
R -q -e 'install.packages("pak", repos = sprintf("https://r-lib.github.io/p/pak/stable/%s/%s/%s", .Platform$pkgType, R.Version()$os, R.Version()$arch))'
R -q -e 'options(repos = c(CRAN="https://stat.ethz.ch/CRAN/")); pak::pak(c("pkgbuild", "cranlike", "drat"))'
R -q -e 'options(repos = c(CRAN="https://stat.ethz.ch/CRAN/")); pak::pak(c("pkgbuild", "cranlike"))'
### install awscli
curl -s "https://awscli.amazonaws.com/awscli-exe-linux-aarch64.zip" -o "awscliv2.zip"
unzip -qq awscliv2.zip
./aws/install
rm -rf awscliv2.zip
# curl -s "https://awscli.amazonaws.com/awscli-exe-linux-aarch64.zip" -o "awscliv2.zip"
# unzip -qq awscliv2.zip
# ./aws/install
# rm -rf awscliv2.zip
mkdir /root/.aws
echo -e "[default]\n
aws_access_key_id=AKIATHTKSC6FRVE5LNE7\n
aws_secret_access_key=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\n" >/root/.aws/credentials
# mkdir /root/.aws
# echo -e "[default]\n
# aws_access_key_id=AKIATHTKSC6FRVE5LNE7\n
# aws_secret_access_key=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\n" >/root/.aws/credentials

3
Justfile Normal file
View file

@ -0,0 +1,3 @@
build_rhel8_image:
docker buildx build -f docker/Dockerfile.rhel8 --build-arg RED_HAT_DEV_PW=$RED_HAT_DEV_PW -t devxy/rhel8_rpkg_
binaries:latest --load .

15
docker/Dockerfile.rhel8 Normal file
View file

@ -0,0 +1,15 @@
FROM redhat/ubi8
ARG R_VERSION=4.0.5
ARG RED_HAT_DEV_PW
RUN subscription-manager register --username pat-s --password $RED_HAT_DEV_PW && subscription-manager repos --enable codeready-builder-for-rhel-8-$(arch)-rpms && dnf update
RUN dnf -y install --nodocs git rsync
RUN echo "R Version: ${R_VERSION}" && echo "Downloading R-${R_VERSION}.rpm from S3..." && curl -o /tmp/R-${R_VERSION}.rpm https://cynkra-r-builds-arm64.s3.eu-central-1.amazonaws.com/el8/R-"${R_VERSION}"-1-1."$(arch)".rpm && dnf install --nodocs -y /tmp/R-${R_VERSION}.rpm && rm -rf /tmp/R-${R_VERSION}.rpm
ENV PATH=/opt/R/${R_VERSION}/bin:$PATH
ENV R_PROGRESSR_ENABLE=TRUE
CMD ["R"]