fix merge conflict

This commit is contained in:
Michael Mayer 2024-05-02 13:00:48 +02:00
commit 8e2dbc253a
79 changed files with 13241 additions and 7325 deletions

137
.github/workflows/test.yml vendored Normal file
View file

@ -0,0 +1,137 @@
name: R builds
on:
push:
paths:
- 'builder/**'
- 'test/**'
- 'Makefile'
- '.github/workflows/test.yml'
pull_request:
paths:
- 'builder/**'
- 'test/**'
- 'Makefile'
- '.github/workflows/test.yml'
workflow_dispatch:
inputs:
platforms:
description: |
Comma-separated list of platforms. Specify "all" to use all platforms (the default).
required: false
default: 'all'
type: string
r_versions:
description: |
Comma-separated list of R versions. Specify "last-N" to use the
last N minor R versions, or "all" to use all minor R versions since R 3.1.
Defaults to "last-5,devel".
required: false
default: 'last-5,devel'
type: string
permissions:
contents: read
jobs:
setup-matrix:
runs-on: ubuntu-latest
outputs:
platforms: ${{ steps.setup-matrix.outputs.platforms }}
r_versions: ${{ steps.setup-matrix.outputs.r_versions }}
steps:
- uses: actions/checkout@v3
- name: Set up matrix of platforms and R versions
id: setup-matrix
run: |
platforms=$(python test/get_platforms.py ${{ github.event.inputs.platforms }})
echo "platforms=$platforms" >> $GITHUB_OUTPUT
r_versions=$(python test/get_r_versions.py ${{ github.event.inputs.r_versions }})
echo "r_versions=$r_versions" >> $GITHUB_OUTPUT
docker-images:
needs: setup-matrix
strategy:
matrix:
platform: ${{ fromJson(needs.setup-matrix.outputs.platforms) }}
runs-on: ubuntu-latest
name: Docker image (${{ matrix.platform }})
steps:
- uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
install: true
# Enable Docker layer caching without having to push to a registry.
# https://docs.docker.com/build/ci/github-actions/examples/#local-cache
# This may eventually be migrated to the GitHub Actions cache backend,
# which is still considered experimental.
# https://github.com/moby/buildkit#github-actions-cache-experimental
- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ matrix.platform }}-buildx-${{ github.sha }}
restore-keys: ${{ matrix.platform }}-buildx-
# Use docker buildx instead of docker-compose here because cache exporting
# does not seem to work as of docker-compose v2.6.0 and buildx v0.8.2, even
# though it works with buildx individually.
- name: Build image
run: |
docker buildx build -t r-builds:${{ matrix.platform }} \
--file builder/Dockerfile.${{ matrix.platform }} \
--cache-from "type=local,src=/tmp/.buildx-cache" \
--cache-to "type=local,dest=/tmp/.buildx-cache-new,mode=max" \
builder
# Temporary workaround for unbounded GHA cache growth with the local cache mode.
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
test:
needs: [setup-matrix, docker-images]
strategy:
fail-fast: false
matrix:
platform: ${{ fromJson(needs.setup-matrix.outputs.platforms) }}
r_version: ${{ fromJson(needs.setup-matrix.outputs.r_versions) }}
runs-on: ubuntu-latest
name: ${{ matrix.platform }} (R ${{ matrix.r_version }})
steps:
- uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
install: true
- name: Restore cached Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ matrix.platform }}-buildx-${{ github.sha }}
restore-keys: ${{ matrix.platform }}-buildx-
- name: Load cached Docker image
run: |
docker buildx build -t r-builds:${{ matrix.platform }} \
--file builder/Dockerfile.${{ matrix.platform }} \
--cache-from "type=local,src=/tmp/.buildx-cache" \
--load \
builder
- name: Build R
run: |
R_VERSION=${{ matrix.r_version }} make build-r-${{ matrix.platform }}
- name: Test R
run: |
R_VERSION=${{ matrix.r_version }} make test-r-${{ matrix.platform }}

4
Jenkinsfile vendored
View file

@ -16,7 +16,7 @@ pipeline {
stage('push images') {
agent { label 'docker-4x' }
when {
branch 'master'
branch 'main'
}
steps {
sh 'make docker-push'
@ -25,7 +25,7 @@ pipeline {
stage('deploy') {
agent none
when {
branch 'master'
branch 'main'
}
steps {
build(job: 'r-builds/deploy-r-builds', wait: true,

View file

@ -1,5 +1,5 @@
PLATFORMS := ubuntu-1804 ubuntu-2004 ubuntu-2204 debian-9 debian-10 debian-11 centos-7 centos-8 opensuse-153
SLS_BINARY ?= ./node_modules/serverless/bin/serverless
PLATFORMS := ubuntu-2004 ubuntu-2204 ubuntu-2404 debian-10 debian-11 debian-12 centos-7 centos-8 rhel-9 opensuse-154 opensuse-155 fedora-38 fedora-39
SLS_BINARY ?= ./node_modules/serverless/bin/serverless.js
deps:
npm install
@ -37,7 +37,30 @@ rebuild-all: deps fetch-serverless-custom-file
$(SLS_BINARY) invoke stepf -n rBuilds -d '{"force": true}'
serverless-deploy.%: deps fetch-serverless-custom-file
$(SLS_BINARY) deploy --stage $*
$(SLS_BINARY) deploy --stage $* --verbose
define GEN_TARGETS
docker-build-$(platform):
@cd builder && docker-compose build $(platform)
build-r-$(platform):
@cd builder && R_VERSION=$(R_VERSION) docker-compose run --rm $(platform)
test-r-$(platform):
@cd test && R_VERSION=$(R_VERSION) docker-compose run --rm $(platform)
bash-$(platform):
docker run -it --rm --entrypoint /bin/bash -v $(CURDIR):/r-builds r-builds:$(platform)
.PHONY: docker-build-$(platform) build-r-$(platform) test-r-$(platform) bash-$(platform)
endef
$(foreach platform,$(PLATFORMS), \
$(eval $(GEN_TARGETS)) \
)
print-platforms:
@echo $(PLATFORMS)
# Helper for launching a bash session on a docker image of your choice. Defaults
# to "ubuntu:xenial".
@ -48,4 +71,4 @@ bash:
-w /r-builds \
${TARGET_IMAGE} /bin/bash
.PHONY: deps docker-build docker-push docker-down docker-build-package docker-shell-package-env ecr-login fetch-serverless-custom-file serverless-deploy
.PHONY: deps docker-build docker-push docker-down docker-build-package docker-shell-package-env ecr-login fetch-serverless-custom-file print-platforms serverless-deploy

234
README.md
View file

@ -1,33 +1,36 @@
# r-builds
This repository orchestrates tools to produce R binaries. The binaries are available as a
community resource, **they are not professionally supported by RStudio**.
community resource, **they are not professionally supported by Posit**.
The R language is open source, please see the official documentation at https://www.r-project.org/.
These binaries are not a replacement to existing binary distributions for R.
The binaries were built with the following considerations:
- They use a minimal set of [build and runtime dependencies](builder).
- They are designed to be used side-by-side, e.g., on [RStudio Server Pro](https://docs.rstudio.com/ide/server-pro/r-versions.html#using-multiple-versions-of-r-concurrently).
- They are designed to be used side-by-side, e.g., on [Posit Workbench](https://docs.posit.co/ide/server-pro/r_versions/using_multiple_versions_of_r.html).
- They give users a consistent option for accessing R across different Linux distributions.
These binaries have been extensively tested, and are used in production everyday
on [RStudio Cloud](https://rstudio.cloud) and
on [Posit Cloud](https://posit.cloud) and
[shinyapps.io](https://shinyapps.io). Please open an issue to report a specific
bug, or ask questions on [RStudio Community](https://community.rstudio.com).
bug, or ask questions on [Posit Community](https://community.rstudio.com).
## Supported Platforms
R binaries are built for the following Linux operating systems:
- Ubuntu 18.04, 20.04, 22.04
- Debian 9, 10, 11
- Ubuntu 20.04, 22.04, 24.04
- Debian 10, 11, 12
- CentOS 7
- Red Hat Enterprise Linux 7, 8
- openSUSE 15.3
- SUSE Linux Enterprise 15 SP3
- Red Hat Enterprise Linux 7, 8, 9
- openSUSE 15.4
- openSUSE 15.5
- SUSE Linux Enterprise 15 SP4
- SUSE Linux Enterprise 15 SP5
- Fedora 38, 39
Operating systems are supported until their vendor end-of-support dates, which
can be found on the [RStudio Platform Support](https://www.rstudio.com/about/platform-support/)
can be found on the [Posit Platform Support](https://posit.co/about/platform-support/)
page. When an operating system has reached its end of support, builds for it
will be discontinued, but existing binaries will continue to be available.
@ -46,9 +49,9 @@ bash -c "$(curl -L https://rstd.io/r-install)"
### Specify R version
Define the version of R that you want to install. Available versions
of R can be found here: https://cdn.rstudio.com/r/versions.json
of R can be found here: https://cdn.posit.co/r/versions.json
```bash
R_VERSION=3.5.3
R_VERSION=4.3.3
```
### Download and install R
@ -56,23 +59,23 @@ R_VERSION=3.5.3
Download the deb package:
```bash
# Ubuntu 18.04
wget https://cdn.rstudio.com/r/ubuntu-1804/pkgs/r-${R_VERSION}_1_amd64.deb
# Ubuntu 20.04
wget https://cdn.rstudio.com/r/ubuntu-2004/pkgs/r-${R_VERSION}_1_amd64.deb
curl -O https://cdn.posit.co/r/ubuntu-2004/pkgs/r-${R_VERSION}_1_amd64.deb
# Ubuntu 22.04
wget https://cdn.rstudio.com/r/ubuntu-2204/pkgs/r-${R_VERSION}_1_amd64.deb
curl -O https://cdn.posit.co/r/ubuntu-2204/pkgs/r-${R_VERSION}_1_amd64.deb
# Debian 9
wget https://cdn.rstudio.com/r/debian-9/pkgs/r-${R_VERSION}_1_amd64.deb
# Ubuntu 24.04
curl -O https://cdn.posit.co/r/ubuntu-2404/pkgs/r-${R_VERSION}_1_amd64.deb
# Debian 10
wget https://cdn.rstudio.com/r/debian-10/pkgs/r-${R_VERSION}_1_amd64.deb
curl -O https://cdn.posit.co/r/debian-10/pkgs/r-${R_VERSION}_1_amd64.deb
# Debian 11
wget https://cdn.rstudio.com/r/debian-11/pkgs/r-${R_VERSION}_1_amd64.deb
curl -O https://cdn.posit.co/r/debian-11/pkgs/r-${R_VERSION}_1_amd64.deb
# Debian 12
curl -O https://cdn.posit.co/r/debian-12/pkgs/r-${R_VERSION}_1_amd64.deb
```
Then install the package:
@ -84,30 +87,51 @@ sudo gdebi r-${R_VERSION}_1_amd64.deb
#### RHEL/CentOS Linux
Enable the [Extra Packages for Enterprise Linux](https://fedoraproject.org/wiki/EPEL)
repository (RHEL/CentOS 7 only):
repository (RHEL/CentOS 7 and RHEL 9 only):
```bash
# CentOS / RHEL 7
sudo yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
# Rocky Linux 9 / AlmaLinux 9
sudo dnf install dnf-plugins-core
sudo dnf config-manager --set-enabled crb
sudo dnf install epel-release
# RHEL 9
sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
```
> Note that on RHEL 7, you may also need to enable the Optional repository:
> On RHEL 7, you may also need to enable the Optional repository:
> ```bash
> # For RHEL 7 users with certificate subscriptions:
> sudo subscription-manager repos --enable "rhel-*-optional-rpms"
>
> # Or alternatively, using yum:
> # If running RHEL 7 in a public cloud, such as Amazon EC2, enable the
> # Optional repository from Red Hat Update Infrastructure (RHUI) instead
> sudo yum install yum-utils
> sudo yum-config-manager --enable "rhel-*-optional-rpms"
> ```
> On RHEL 9, you may also need to enable the CodeReady Linux Builder repository:
> ```bash
> sudo subscription-manager repos --enable codeready-builder-for-rhel-9-$(arch)-rpms
>
> # If running RHEL 9 in a public cloud, such as Amazon EC2, enable the CodeReady
> # Linux Builder repository from Red Hat Update Infrastructure (RHUI) instead
> sudo dnf install dnf-plugins-core
> sudo dnf config-manager --enable codeready-builder-for-rhel-9-*-rpms
> ```
Download the rpm package:
```bash
# CentOS / RHEL 7
wget https://cdn.rstudio.com/r/centos-7/pkgs/R-${R_VERSION}-1-1.x86_64.rpm
curl -O https://cdn.posit.co/r/centos-7/pkgs/R-${R_VERSION}-1-1.x86_64.rpm
# RHEL 8
wget https://cdn.rstudio.com/r/centos-8/pkgs/R-${R_VERSION}-1-1.x86_64.rpm
# RHEL 8 / Rocky Linux 8 / AlmaLinux 8
curl -O https://cdn.posit.co/r/centos-8/pkgs/R-${R_VERSION}-1-1.x86_64.rpm
# RHEL 9 / Rocky Linux 9 / AlmaLinux 9
curl -O https://cdn.posit.co/r/rhel-9/pkgs/R-${R_VERSION}-1-1.x86_64.rpm
```
Then install the package:
@ -119,8 +143,12 @@ sudo yum install R-${R_VERSION}-1-1.x86_64.rpm
Download the rpm package:
```bash
# openSUSE 15.3 / SLES 15 SP3
wget https://cdn.rstudio.com/r/opensuse-153/pkgs/R-${R_VERSION}-1-1.x86_64.rpm
# openSUSE 15.4 / SLES 15 SP4
curl -O https://cdn.posit.co/r/opensuse-154/pkgs/R-${R_VERSION}-1-1.x86_64.rpm
# openSUSE 15.5 / SLES 15 SP5
curl -O https://cdn.posit.co/r/opensuse-155/pkgs/R-${R_VERSION}-1-1.x86_64.rpm
```
Then install the package:
@ -128,6 +156,24 @@ Then install the package:
sudo zypper --no-gpg-checks install R-${R_VERSION}-1-1.x86_64.rpm
```
#### Fedora Linux
Download the rpm package:
```bash
# Fedora 38
curl -O https://cdn.posit.co/r/fedora-38/pkgs/R-${R_VERSION}-1-1.x86_64.rpm
# Fedora 39
curl -O https://cdn.posit.co/r/fedora-39/pkgs/R-${R_VERSION}-1-1.x86_64.rpm
```
Then install the package:
```bash
sudo dnf install r-${R_VERSION}_1_amd64.rpm
```
### Verify R installation
Test that R was successfully installed by running:
@ -163,8 +209,58 @@ This repository orchestrates builds using a variety of tools. The
instructions below outline the components in the stack and describe how to add a
new platform or inspect an existing platform.
## Building from source
To build the R binaries from source, you will need to have [Git](https://git-scm.com/),
[Docker](https://docs.docker.com/get-docker/), and `make` installed.
First, clone the Git repository locally and navigate to it.
```bash
git clone https://github.com/rstudio/R-builds
cd R-builds
```
Then, run the `build-r-$PLATFORM` Make target with the `R_VERSION` environment variable
set to your desired R version, where `$PLATFORM` is one of the supported platform
identifiers, such as `ubuntu-2204` or `rhel-9`.
```bash
export PLATFORM=ubuntu-2204
export R_VERSION=4.1.3
make build-r-$PLATFORM
```
The built DEB or RPM package will be available in the `builder/integration/tmp/$PLATFORM`
directory.
```bash
$ ls builder/integration/tmp/$PLATFORM
r-4.1.3_1_amd64.deb
```
### Custom installation path
R is installed to `/opt/R/${R_VERSION}` by default. If you want to customize the
installation path, set the optional `R_INSTALL_PATH` environment variable to a
custom location such as `/opt/custom/R-4.1.3`.
```bash
export PLATFORM=rhel-9
export R_VERSION=4.1.3
export R_INSTALL_PATH=/opt/custom/R-4.1.3
make build-r-$PLATFORM
```
## Adding a new platform.
### README
1. Add the new platform to the `Supported Platforms` list.
2. Add rpm package download instructions for the new platform.
### Dockerfile
Create a `builder/Dockerfile.platform-version` (where `platform-version` is `ubuntu-2204` or `centos-7`, etc.) This file must contain four major tasks:
@ -174,6 +270,10 @@ Create a `builder/Dockerfile.platform-version` (where `platform-version` is `ubu
3. The `awscli`, 1.17.10+ if installed via `pip`, for uploading tarballs to S3
4. `COPY` and `ENTRYPOINT` for the `build.sh` file in `builder/`.
### Packaging script
Create a `builder/package.platform-version` script (where `platform-version` is `ubuntu-2204` or `centos-7`, etc.).
### docker-compose.yml
A new service in the docker-compose file named according to the `platform-version` and containing the proper entries:
@ -185,8 +285,8 @@ environment:
- LOCAL_STORE=/tmp/output # ensures that output tarballs are persisted locally
build:
context: .
dockerfile: Dockerfile.debian-9
image: r-builds:debian-9
dockerfile: Dockerfile.debian-11
image: r-builds:debian-11
volumes:
- ./integration/tmp:/tmp/output # path to output tarballs
```
@ -196,7 +296,7 @@ volumes:
IN `serverless-resources.yml` you'll need to add a job definition that points to the ECR image.
```
rBuildsBatchJobDefinitionDebian9:
rBuildsBatchJobDefinitionDebian11:
Type: AWS::Batch::JobDefinition
Properties:
Type: container
@ -207,7 +307,7 @@ rBuildsBatchJobDefinitionDebian9:
Memory: 4096
JobRoleArn:
"Fn::GetAtt": [ rBuildsEcsTaskIamRole, Arn ]
Image: #{AWS::AccountId}.dkr.ecr.#{AWS::Region}.amazonaws.com/r-builds:debian-9
Image: #{AWS::AccountId}.dkr.ecr.#{AWS::Region}.amazonaws.com/r-builds:debian-11
```
### Environment variables in the serverless.yml functions.
@ -220,15 +320,30 @@ The serverless functions which trigger R builds need to be informed of new platf
```
environment:
# snip
JOB_DEFINITION_ARN_debian_9:
Ref: rBuildsBatchJobDefinitionDebian9
SUPPORTED_PLATFORMS: ubuntu-1804,debian-9,debian-10,centos-7,centos-8
JOB_DEFINITION_ARN_debian_11:
Ref: rBuildsBatchJobDefinitionDebian11
SUPPORTED_PLATFORMS: debian-10,centos-7,centos-8
```
### Makefile
In order for the makefile to push these new platforms to ECR, add them to the PLATFORMS variable near the top of the Makefile
### test/docker-compose.yml
A new service in the `test/docker-compose.yml` file named according to the `platform-version` and containing the proper entries:
```yaml
ubuntu-2204:
image: ubuntu:jammy
command: /r-builds/test/test-apt.sh
environment:
- OS_IDENTIFIER=ubuntu-2204
- R_VERSION=${R_VERSION}
volumes:
- ../:/r-builds
```
### Submit a Pull Request
Once you've followed the steps above, submit a pull request. On successful merge, builds for this platform will begin to be available from the CDN.
@ -247,33 +362,44 @@ serverless invoke stepf -n rBuilds -d '{"force": true, "versions": ["3.6.3", "4.
## Testing
To test the R builds locally, you can build the images:
Tests are automatically run on each push that changes a file in `builder/`, `test/`, or the `Makefile`.
These tests validate that R was correctly configured, built, and packaged. By default, the tests run
for the last 5 minor R versions on each platform.
To run the tests manually, you can navigate to the [GitHub Actions workflow page](https://github.com/rstudio/r-builds/actions/workflows/test.yml)
and use "Run workflow" to run the tests from a custom branch, list of platforms, and list of R versions.
To skip the tests, add `[skip ci]` to your commit message. See [Skipping workflow runs](https://docs.github.com/en/actions/managing-workflow-runs/skipping-workflow-runs)
for more information.
To test the R builds locally, you can use the `build-r-$PLATFORM` and `test-r-$PLATFORM`
targets to build R and run the tests. The tests use the quick install script to install R,
using a locally built R if present, or otherwise a build from the CDN.
```bash
# Build images for all platforms
make docker-build
# Build R 4.1.3 for Ubuntu 22
R_VERSION=4.1.3 make build-r-ubuntu-2204
# Or build the image for a single platform
(cd builder && docker-compose build ubuntu-2004)
# Test R 4.1.3 for Ubuntu 22
R_VERSION=4.1.3 make test-r-ubuntu-2204
```
Then run the build script:
Alternatively, you can build an image using the `docker-build-$PLATFORM`
target, launch a bash session within a container using the `bash-$PLATFORM` target,
and interactively run the build script:
```bash
# Build R for all platforms
R_VERSION=4.0.5 make docker-build-r
# Build the image for Ubuntu 22
make docker-build-ubuntu-2204
# Build R for a single platform
(cd builder && R_VERSION=4.0.5 docker-compose up ubuntu-2004)
# Launch a bash session for Ubuntu 22
make bash-ubuntu-2204
# Alternatively, run the build script from within a container
docker run -it --rm --entrypoint "/bin/bash" r-builds:ubuntu-2004
# Build R 4.1.3
R_VERSION=4.1.3 ./build.sh
# Build R 4.0.5
R_VERSION=4.0.5 ./build.sh
# Build R devel
R_VERSION=devel ./build.sh
# Build R devel with parallel execution to speed up the build
MAKEFLAGS=-j4 R_VERSION=devel ./build.sh
# Build a prerelease version of R (e.g., alpha or beta)
R_VERSION=rc R_TARBALL_URL=https://cran.r-project.org/src/base-prerelease/R-latest.tar.gz ./build.sh

View file

@ -33,8 +33,6 @@ RUN yum -y update \
python3-pip \
readline-devel \
rpm-build \
ruby \
ruby-devel \
tcl-devel \
tex \
texinfo-tex \
@ -51,8 +49,11 @@ RUN yum -y update \
RUN pip3 install awscli --upgrade --user && \
ln -s /root/.local/bin/aws /usr/bin/aws
# Pin fpm for compatibility with Ruby < 2.3
RUN gem install ffi:1.12.2 fpm:1.11.0
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
@ -72,4 +73,5 @@ ENV R_RD4PDF="times,hyper"
COPY package.centos-7 /package.sh
COPY build.sh .
COPY patches /patches
ENTRYPOINT ./build.sh

View file

@ -34,8 +34,6 @@ RUN dnf -y upgrade \
python3-pip \
readline-devel \
rpm-build \
ruby \
ruby-devel \
tcl-devel \
tex \
texinfo-tex \
@ -52,8 +50,11 @@ RUN dnf -y upgrade \
RUN pip3 install awscli --upgrade --user \
&& ln -s /root/.local/bin/aws /usr/bin/aws
# Pin fpm to avoid git dependency in 1.12.0
RUN gem install fpm:1.11.0
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
@ -73,4 +74,5 @@ ENV R_RD4PDF="times,hyper"
COPY package.centos-8 /package.sh
COPY build.sh .
COPY patches /patches
ENTRYPOINT ./build.sh

View file

@ -6,20 +6,22 @@ RUN set -x \
&& export DEBIAN_FRONTEND=noninteractive \
&& echo 'deb-src http://deb.debian.org/debian buster main' >> /etc/apt/sources.list \
&& apt-get update \
&& apt-get install -y gcc libcurl4-openssl-dev libicu-dev \
libopenblas-base libpcre2-dev make python3-pip ruby ruby-dev wget \
&& apt-get install -y curl gcc libcurl4-openssl-dev libicu-dev \
libopenblas-base libpcre2-dev make python3-pip wget \
&& apt-get build-dep -y r-base
RUN pip3 install awscli
RUN chmod 0777 /opt
# Pin fpm to avoid git dependency in 1.12.0
RUN gem install fpm:1.11.0
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
COPY package.debian-10 /package.sh
COPY build.sh .
COPY patches /patches
ENTRYPOINT ./build.sh

View file

@ -6,15 +6,17 @@ RUN set -x \
&& export DEBIAN_FRONTEND=noninteractive \
&& echo 'deb-src http://deb.debian.org/debian bullseye main' >> /etc/apt/sources.list \
&& apt-get update \
&& apt-get install -y gcc libcurl4-openssl-dev libicu-dev \
libopenblas-base libpcre2-dev make python3-pip ruby ruby-dev wget \
&& apt-get install -y curl gcc libcurl4-openssl-dev libicu-dev \
libopenblas-base libpcre2-dev make python3-pip wget \
&& apt-get build-dep -y r-base
RUN pip3 install awscli
RUN chmod 0777 /opt
RUN gem install fpm
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
@ -24,4 +26,5 @@ ENV INCLUDE_PCRE2_IN_R_3 yes
COPY package.debian-11 /package.sh
COPY build.sh .
COPY patches /patches
ENTRYPOINT ./build.sh

View file

@ -0,0 +1,34 @@
FROM debian:bookworm
ENV OS_IDENTIFIER debian-12
RUN set -x \
&& export DEBIAN_FRONTEND=noninteractive \
&& echo 'deb-src http://deb.debian.org/debian bookworm main' >> /etc/apt/sources.list \
&& apt-get update \
&& apt-get install -y curl gcc libcurl4-openssl-dev libicu-dev \
libopenblas0 libpcre2-dev make unzip wget \
&& apt-get build-dep -y r-base
# Install AWS CLI
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-$(uname -m).zip" -o "awscliv2.zip" && \
unzip awscliv2.zip && \
./aws/install && \
rm -rf aws awscliv2.zip
RUN chmod 0777 /opt
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
# R 3.x requires PCRE2 for Pango support on Debian 12
ENV INCLUDE_PCRE2_IN_R_3 yes
COPY package.debian-12 /package.sh
COPY build.sh .
COPY patches /patches
ENTRYPOINT ./build.sh

View file

@ -1,25 +0,0 @@
FROM debian:stretch
ENV OS_IDENTIFIER debian-9
RUN set -x \
&& export DEBIAN_FRONTEND=noninteractive \
&& echo 'deb-src http://deb.debian.org/debian stretch main' >> /etc/apt/sources.list \
&& apt-get update \
&& apt-get install -y gcc libcurl4-openssl-dev libicu-dev \
libopenblas-base libpcre2-dev make python-pip ruby ruby-dev wget \
&& apt-get build-dep -y r-base
RUN pip install awscli
RUN chmod 0777 /opt
# Pin fpm to avoid git dependency in 1.12.0
RUN gem install fpm:1.11.0
# Override the default pager used by R
ENV PAGER /usr/bin/pager
COPY package.debian-9 /package.sh
COPY build.sh .
ENTRYPOINT ./build.sh

View file

@ -0,0 +1,88 @@
FROM fedora:38
ENV OS_IDENTIFIER fedora-38
RUN dnf -y upgrade \
&& dnf -y install dnf-plugins-core \
&& dnf -y install \
autoconf \
automake \
bzip2-devel \
cairo-devel \
flexiblas-devel \
gcc-c++ \
gcc-gfortran \
java-11-openjdk-devel \
libICE-devel \
libSM-devel \
libX11-devel \
libXmu-devel \
libXt-devel \
libcurl-devel \
libicu-devel \
libjpeg-devel \
libpng-devel \
libtiff-devel \
libtool \
make \
ncurses-devel \
pango-devel \
pcre-devel \
pcre2-devel \
readline-devel \
rpm-build \
tcl-devel \
tex \
texinfo-tex \
texlive-collection-latexrecommended \
tk-devel \
unzip \
valgrind-devel \
which \
wget \
xz-devel \
zlib-devel \
&& dnf clean all
# Install AWS CLI
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-$(uname -m).zip" -o "awscliv2.zip" && \
unzip awscliv2.zip && \
./aws/install && \
rm -rf aws awscliv2.zip
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
# Configure flags that don't use the defaults in build.sh
ENV CONFIGURE_OPTIONS="\
--enable-R-shlib \
--with-tcltk \
--enable-memory-profiling \
--with-x \
--with-system-valgrind-headers \
--with-tcl-config=/usr/lib64/tclConfig.sh \
--with-tk-config=/usr/lib64/tkConfig.sh \
--enable-prebuilt-html \
--with-blas=flexiblas \
--with-lapack=flexiblas"
# Make sure that patching Java does not break R.
# R's default JAVA_HOME path includes the exact Java version on CentOS/RHEL, which
# requires users to run `R CMD javareconf` even on minor/patch upgrades. Use the
# major version symlink to avoid this.
# https://cran.r-project.org/doc/manuals/r-release/R-admin.html#Java-support
# https://solutions.posit.co/envs-pkgs/using-rjava/
ENV JAVA_HOME=/usr/lib/jvm/jre-11-openjdk
# R 3.x requires PCRE2 for Pango support on RHEL 9
ENV INCLUDE_PCRE2_IN_R_3 yes
COPY package.fedora-38 /package.sh
COPY build.sh .
COPY patches /patches
ENTRYPOINT ./build.sh

View file

@ -0,0 +1,88 @@
FROM fedora:39
ENV OS_IDENTIFIER fedora-39
RUN dnf -y upgrade \
&& dnf -y install dnf-plugins-core \
&& dnf -y install \
autoconf \
automake \
bzip2-devel \
cairo-devel \
flexiblas-devel \
gcc-c++ \
gcc-gfortran \
java-11-openjdk-devel \
libICE-devel \
libSM-devel \
libX11-devel \
libXmu-devel \
libXt-devel \
libcurl-devel \
libicu-devel \
libjpeg-devel \
libpng-devel \
libtiff-devel \
libtool \
make \
ncurses-devel \
pango-devel \
pcre-devel \
pcre2-devel \
readline-devel \
rpm-build \
tcl-devel \
tex \
texinfo-tex \
texlive-collection-latexrecommended \
tk-devel \
unzip \
valgrind-devel \
which \
wget \
xz-devel \
zlib-devel \
&& dnf clean all
# Install AWS CLI
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-$(uname -m).zip" -o "awscliv2.zip" && \
unzip awscliv2.zip && \
./aws/install && \
rm -rf aws awscliv2.zip
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
# Configure flags for that don't use the defaults in build.sh
ENV CONFIGURE_OPTIONS="\
--enable-R-shlib \
--with-tcltk \
--enable-memory-profiling \
--with-x \
--with-system-valgrind-headers \
--with-tcl-config=/usr/lib64/tclConfig.sh \
--with-tk-config=/usr/lib64/tkConfig.sh \
--enable-prebuilt-html \
--with-blas=flexiblas \
--with-lapack=flexiblas"
# Make sure that patching Java does not break R.
# R's default JAVA_HOME path includes the exact Java version on CentOS/RHEL, which
# requires users to run `R CMD javareconf` even on minor/patch upgrades. Use the
# major version symlink to avoid this.
# https://cran.r-project.org/doc/manuals/r-release/R-admin.html#Java-support
# https://solutions.posit.co/envs-pkgs/using-rjava/
ENV JAVA_HOME=/usr/lib/jvm/jre-11-openjdk
# R 3.x requires PCRE2 for Pango support on RHEL 9
ENV INCLUDE_PCRE2_IN_R_3 yes
COPY package.fedora-39 /package.sh
COPY build.sh .
COPY patches /patches
ENTRYPOINT ./build.sh

View file

@ -0,0 +1,103 @@
FROM opensuse/leap:15.4
ENV OS_IDENTIFIER opensuse-154
# Most of these packages, and also the configure options that follow were determined
# by reviewing "R-base.spec" from the following OpenSUSE RPM:
# https://download.opensuse.org/repositories/devel:/languages:/R:/released/openSUSE_Leap_42.3/src/R-base-3.5.3-103.1.src.rpm
RUN zypper --non-interactive update
RUN zypper --non-interactive --gpg-auto-import-keys -n install \
bzip2 \
cairo-devel \
curl \
fdupes \
gcc \
gcc-c++ \
gcc-fortran \
glib2-devel \
glibc-locale \
help2man \
# Like openSUSE/SLES 15.3, SUSE 15.4 ships with both ICU 65 (libicu-devel) and
# ICU 69 (icu.691-devel). Prefer ICU 69 because the devel packages can't coexist, and
# zypper resolves libicu-devel to icu.691-devel when installing RPMs.
icu.691-devel \
java-11-openjdk-devel \
libX11-devel \
libXScrnSaver-devel \
libXmu-devel \
libXt-devel \
libbz2-devel \
libcurl-devel \
libjpeg-devel \
libpng-devel \
libtiff-devel \
make \
pango-devel \
pcre-devel \
pcre2-devel \
perl \
perl-macros \
readline-devel \
rpm-build \
shadow \
tcl-devel \
texinfo \
texlive-ae \
texlive-bibtex \
texlive-cm-super \
texlive-dvips \
texlive-fancyvrb \
texlive-helvetic \
texlive-inconsolata \
texlive-latex \
texlive-makeindex \
texlive-metafont \
texlive-psnfss \
texlive-tex \
texlive-times \
tk-devel \
unzip \
wget \
xdg-utils \
xorg-x11-devel \
xz-devel \
zip \
zlib-devel \
&& zypper clean
# Install AWS CLI
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-$(uname -m).zip" -o "awscliv2.zip" && \
unzip awscliv2.zip && \
./aws/install && \
rm -rf aws awscliv2.zip
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
# Configure flags for SUSE that don't use the defaults in build.sh
ENV CONFIGURE_OPTIONS="\
--enable-R-shlib \
--with-tcltk \
--with-x \
--enable-memory-profiling \
--with-tcl-config=/usr/lib64/tclConfig.sh \
--with-tk-config=/usr/lib64/tkConfig.sh"
# Make sure that patching Java does not break R.
# On SUSE, the default JAVA_HOME path always uses the major Java version only,
# but the JDK path is chosen by default. We change this to the JRE path to
# support users who only want to install the JRE (non-devel) package.
# https://cran.r-project.org/doc/manuals/r-release/R-admin.html#Java-support
# https://solutions.posit.co/envs-pkgs/using-rjava/
ENV JAVA_HOME=/usr/lib64/jvm/jre-11-openjdk
COPY package.opensuse-154 /package.sh
COPY build.sh .
COPY patches /patches
ENTRYPOINT ./build.sh

View file

@ -0,0 +1,103 @@
FROM opensuse/leap:15.5
ENV OS_IDENTIFIER opensuse-155
# Most of these packages, and also the configure options that follow were determined
# by reviewing "R-base.spec" from the following OpenSUSE RPM:
# https://download.opensuse.org/repositories/devel:/languages:/R:/released/openSUSE_Leap_42.3/src/R-base-3.5.3-103.1.src.rpm
RUN zypper --non-interactive update
RUN zypper --non-interactive --gpg-auto-import-keys -n install \
bzip2 \
cairo-devel \
curl \
fdupes \
gcc \
gcc-c++ \
gcc-fortran \
glib2-devel \
glibc-locale \
help2man \
# Like openSUSE/SLES 15.4, SUSE 15.5 ships with both ICU 65 (libicu-devel) and
# ICU 69 (icu.691-devel). Prefer ICU 69 because the devel packages can't coexist, and
# zypper resolves libicu-devel to icu.691-devel when installing RPMs.
icu.691-devel \
java-11-openjdk-devel \
libX11-devel \
libXScrnSaver-devel \
libXmu-devel \
libXt-devel \
libbz2-devel \
libcurl-devel \
libjpeg-devel \
libpng-devel \
libtiff-devel \
make \
pango-devel \
pcre-devel \
pcre2-devel \
perl \
perl-macros \
readline-devel \
rpm-build \
shadow \
tcl-devel \
texinfo \
texlive-ae \
texlive-bibtex \
texlive-cm-super \
texlive-dvips \
texlive-fancyvrb \
texlive-helvetic \
texlive-inconsolata \
texlive-latex \
texlive-makeindex \
texlive-metafont \
texlive-psnfss \
texlive-tex \
texlive-times \
tk-devel \
unzip \
wget \
xdg-utils \
xorg-x11-devel \
xz-devel \
zip \
zlib-devel \
&& zypper clean
# Install AWS CLI
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-$(uname -m).zip" -o "awscliv2.zip" && \
unzip awscliv2.zip && \
./aws/install && \
rm -rf aws awscliv2.zip
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
# Configure flags for SUSE that don't use the defaults in build.sh
ENV CONFIGURE_OPTIONS="\
--enable-R-shlib \
--with-tcltk \
--with-x \
--enable-memory-profiling \
--with-tcl-config=/usr/lib64/tclConfig.sh \
--with-tk-config=/usr/lib64/tkConfig.sh"
# Make sure that patching Java does not break R.
# On SUSE, the default JAVA_HOME path always uses the major Java version only,
# but the JDK path is chosen by default. We change this to the JRE path to
# support users who only want to install the JRE (non-devel) package.
# https://cran.r-project.org/doc/manuals/r-release/R-admin.html#Java-support
# https://solutions.posit.co/envs-pkgs/using-rjava/
ENV JAVA_HOME=/usr/lib64/jvm/jre-11-openjdk
COPY package.opensuse-155 /package.sh
COPY build.sh .
COPY patches /patches
ENTRYPOINT ./build.sh

94
builder/Dockerfile.rhel-9 Normal file
View file

@ -0,0 +1,94 @@
FROM rockylinux:9
ENV OS_IDENTIFIER rhel-9
RUN dnf -y upgrade \
&& dnf -y install dnf-plugins-core \
&& dnf config-manager --set-enabled crb \
&& dnf install -y epel-release \
&& dnf -y install \
autoconf \
automake \
bzip2-devel \
cairo-devel \
flexiblas-devel \
gcc-c++ \
gcc-gfortran \
java-11-openjdk-devel \
libICE-devel \
libSM-devel \
libX11-devel \
libXmu-devel \
libXt-devel \
libcurl-devel \
libicu-devel \
libjpeg-devel \
libpng-devel \
libtiff-devel \
libtool \
make \
ncurses-devel \
pango-devel \
pcre-devel \
pcre2-devel \
readline-devel \
rpm-build \
tcl-devel \
tex \
texinfo-tex \
texlive-collection-latexrecommended \
tk-devel \
unzip \
valgrind-devel \
which \
wget \
xz-devel \
zlib-devel \
&& dnf clean all
# Install AWS CLI
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-$(uname -m).zip" -o "awscliv2.zip" && \
unzip awscliv2.zip && \
./aws/install && \
rm -rf aws awscliv2.zip
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
# Configure flags for RHEL 9 that don't use the defaults in build.sh
ENV CONFIGURE_OPTIONS="\
--enable-R-shlib \
--with-tcltk \
--enable-memory-profiling \
--with-x \
--with-system-valgrind-headers \
--with-tcl-config=/usr/lib64/tclConfig.sh \
--with-tk-config=/usr/lib64/tkConfig.sh \
--enable-prebuilt-html"
# RHEL 9 doesn't have the inconsolata font, so override the defaults.
# This may be removed if RHEL ever adds the texlive-inconsolata package from Fedora.
# Or check `dnf provides '*/inconsolata.sty'` for a package that provides it.
# https://cran.r-project.org/doc/manuals/r-release/R-admin.html#Making-the-manuals
ENV R_RD4PDF="times,hyper"
# Make sure that patching Java does not break R.
# R's default JAVA_HOME path includes the exact Java version on CentOS/RHEL, which
# requires users to run `R CMD javareconf` even on minor/patch upgrades. Use the
# major version symlink to avoid this.
# https://cran.r-project.org/doc/manuals/r-release/R-admin.html#Java-support
# https://solutions.posit.co/envs-pkgs/using-rjava/
ENV JAVA_HOME=/usr/lib/jvm/jre-11-openjdk
# R 3.x requires PCRE2 for Pango support on RHEL 9
ENV INCLUDE_PCRE2_IN_R_3 yes
COPY package.rhel-9 /package.sh
COPY build.sh .
COPY patches /patches
ENTRYPOINT ./build.sh

View file

@ -1,24 +0,0 @@
FROM ubuntu:bionic
ENV OS_IDENTIFIER ubuntu-1804
RUN set -x \
&& sed -i "s|# deb-src|deb-src|g" /etc/apt/sources.list \
&& export DEBIAN_FRONTEND=noninteractive \
&& apt-get update \
&& apt-get install -y libcurl4-openssl-dev libicu-dev libopenblas-base libpcre2-dev wget python-pip ruby ruby-dev \
&& apt-get build-dep -y r-base
RUN pip install awscli
# Pin fpm to avoid git dependency in 1.12.0
RUN gem install fpm:1.11.0
RUN chmod 0777 /opt
# Override the default pager used by R
ENV PAGER /usr/bin/pager
COPY package.ubuntu-1804 /package.sh
COPY build.sh .
ENTRYPOINT ./build.sh

View file

@ -6,13 +6,14 @@ RUN set -x \
&& sed -i "s|# deb-src|deb-src|g" /etc/apt/sources.list \
&& export DEBIAN_FRONTEND=noninteractive \
&& apt-get update \
&& apt-get install -y libopenblas-dev libcurl4-openssl-dev libicu-dev libpcre2-dev wget python3-pip ruby ruby-dev \
&& apt-get install -y curl libopenblas-dev libcurl4-openssl-dev libicu-dev liblapack-dev libpcre2-dev wget python3-pip \
&& apt-get build-dep -y r-base
RUN pip3 install awscli
# Pin fpm to avoid git dependency in 1.12.0
RUN gem install fpm:1.11.0
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
@ -21,4 +22,5 @@ ENV PAGER /usr/bin/pager
COPY package.ubuntu-2004 /package.sh
COPY build.sh .
COPY patches /patches
ENTRYPOINT ./build.sh

View file

@ -6,12 +6,14 @@ RUN set -x \
&& sed -i "s|# deb-src|deb-src|g" /etc/apt/sources.list \
&& export DEBIAN_FRONTEND=noninteractive \
&& apt-get update \
&& apt-get install -y libcurl4-openssl-dev libicu-dev libopenblas-base libpcre2-dev wget python3-pip ruby ruby-dev \
&& apt-get install -y curl libcurl4-openssl-dev libicu-dev libopenblas-base libpcre2-dev wget python3-pip \
&& apt-get build-dep -y r-base
RUN pip3 install awscli
RUN gem install fpm
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
@ -23,4 +25,5 @@ ENV INCLUDE_PCRE2_IN_R_3 yes
COPY package.ubuntu-2204 /package.sh
COPY build.sh .
COPY patches /patches
ENTRYPOINT ./build.sh

View file

@ -0,0 +1,33 @@
FROM ubuntu:noble
ENV OS_IDENTIFIER ubuntu-2404
RUN set -x \
&& sed -i "s|Types: deb|Types: deb deb-src|g" /etc/apt/sources.list.d/ubuntu.sources \
&& export DEBIAN_FRONTEND=noninteractive \
&& apt update \
&& apt install -y curl libcurl4-openssl-dev libicu-dev libopenblas0-pthread libpcre2-dev libpcre3-dev unzip wget \
&& apt build-dep -y r-base
# Install AWS CLI
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-$(uname -m).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_$(dpkg --print-architecture).deb" && \
apt install -y "./nfpm_$(dpkg --print-architecture).deb" && \
rm "nfpm_$(dpkg --print-architecture).deb"
RUN chmod 0777 /opt
# Override the default pager used by R
ENV PAGER /usr/bin/pager
# R 3.x requires PCRE2 for Pango support on Ubuntu 24
ENV INCLUDE_PCRE2_IN_R_3 yes
COPY package.ubuntu-2404 /package.sh
COPY build.sh .
COPY patches /patches
ENTRYPOINT ./build.sh

View file

@ -5,6 +5,7 @@ export CRAN=${CRAN-"https://cran.rstudio.com"}
export S3_BUCKET_PREFIX=${S3_BUCKET_PREFIX-""}
export OS_IDENTIFIER=${OS_IDENTIFIER-"unknown"}
export TARBALL_NAME="R-${R_VERSION}-${OS_IDENTIFIER}.tar.gz"
export R_INSTALL_PATH=${R_INSTALL_PATH:-"/opt/R/${R_VERSION}"}
# Some Dockerfiles may copy a `/env.sh` to set up environment variables
# that require command substitution. If this file exists, source it.
@ -33,9 +34,11 @@ upload_r() {
fi
}
# archive_r() - $1 as r version
# archive_r()
archive_r() {
tar czf /tmp/${TARBALL_NAME} --directory=/opt/R ${1} --owner=0 --group=0
dir=$(dirname "$R_INSTALL_PATH")
base=$(basename "$R_INSTALL_PATH")
tar czf "/tmp/${TARBALL_NAME}" --directory="$dir" "$base" --owner=0 --group=0
}
fetch_r_source() {
@ -61,14 +64,32 @@ fetch_r_source() {
rm /tmp/R-${1}.tar.gz
}
# Apply a patch for this R version if present. Typically for R-devel.
patch_r() {
cd /tmp/R-${1}
if [ -f "/patches/R-${1}.patch" ]; then
patch -p1 < "/patches/R-${1}.patch"
fi
if [ -f "/patches/R-${1}-${OS_IDENTIFIER}.patch" ]; then
patch -p1 < "/patches/R-${1}-${OS_IDENTIFIER}.patch"
fi
if [ -f "/patches/R-${1}-`arch`.patch" ]; then
patch -p1 < "/patches/R-${1}-`arch`.patch"
fi
}
# compile_r() - $1 as r version
compile_r() {
cd /tmp/R-${1}
r_version=${1}
cd "/tmp/R-${r_version}"
# 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'
if _version_is_greater_than ${R_VERSION} 3.2.2; then
build_flag="--build=$(uname -m)-pc-linux-gnu"
if _version_is_greater_than "${r_version}" 3.2.2; then
build_flag=''
fi
@ -81,7 +102,7 @@ compile_r() {
# https://cran.r-project.org/doc/manuals/r-release/R-admin.html#Using-Fortran
# https://gcc.gnu.org/gcc-10/porting_to.html
gcc_major_version=$(gcc -dumpversion | cut -d '.' -f 1)
if _version_is_less_than "${R_VERSION}" 3.6.2 && _version_is_greater_than "${gcc_major_version}" 9; then
if _version_is_less_than "${r_version}" 3.6.2 && _version_is_greater_than "${gcc_major_version}" 9; then
# Default CFLAGS/FFLAGS for all R 3.x versions is '-g -O2' when using GCC
export CFLAGS='-g -O2 -fcommon'
export FFLAGS='-g -O2 -fallow-argument-mismatch'
@ -97,9 +118,9 @@ compile_r() {
#
# The INCLUDE_PCRE2_IN_R_3 environment variable can be set to include PCRE2
# in R 3.x builds, for distributions where PCRE2 is always required.
# In Debian 11/Ubuntu 22, Pango now depends on PCRE2, so R 3.x will not be compiled with
# In Debian 11/Ubuntu 22/RHEL 9, Pango now depends on PCRE2, so R 3.x will not be compiled with
# Pango support if the PCRE2 pkg-config file is missing.
if [[ "${1}" =~ ^3 ]] && pkg-config --exists libpcre2-8 && [ -z "$INCLUDE_PCRE2_IN_R_3" ]; then
if [[ "${r_version}" =~ ^3 ]] && pkg-config --exists libpcre2-8 && [ -z "$INCLUDE_PCRE2_IN_R_3" ]; then
mkdir -p /tmp/pcre2
pc_dir=$(pkg-config --variable pcfiledir libpcre2-8)
mv ${pc_dir}/libpcre2-8.pc /tmp/pcre2
@ -108,6 +129,15 @@ compile_r() {
trap "{ mv /tmp/pcre2/libpcre2-8.pc ${pc_dir}; mv /tmp/pcre2/pcre2-config ${config_bin}; }" EXIT
fi
# Allow libcurl 8.x to be used in R 4.2 and below. Despite a change in major
# version number, libcurl 8 changes neither API nor ABI. This applies the same
# change to configure made in R 4.3.0, replacing exit(1) with exit(0) when
# LIBCURL_VERSION_MAJOR > 7.
# https://github.com/wch/r-source/commit/da6638896413bcbb5970b2335b92582853f94e3c
if _version_is_less_than "${r_version}" 4.3.0; then
sed -i -z 's/#if LIBCURL_VERSION_MAJOR > 7\n exit(1)/#if LIBCURL_VERSION_MAJOR > 7\n exit(0)/' configure
fi
# Default configure options. Some Dockerfiles override this with an ENV directive.
default_configure_options="\
--enable-R-shlib \
@ -119,6 +149,16 @@ compile_r() {
CONFIGURE_OPTIONS=${CONFIGURE_OPTIONS:-$default_configure_options}
# For RHEL 9, link to external FlexiBLAS starting from R 4.3.0 to align with EPEL 9
if _version_is_greater_than "${R_VERSION}" 4.2.10; then
if [[ "${OS_IDENTIFIER}" = "rhel-9" ]]; then
CONFIGURE_OPTIONS="$CONFIGURE_OPTIONS \
--with-blas=flexiblas --with-lapack=flexiblas"
fi
fi
echo "Using CONFIGURE_OPTIONS: ${CONFIGURE_OPTIONS}"
# set some common environment variables for the configure step
AWK=/usr/bin/awk \
LIBnn=lib \
@ -130,7 +170,7 @@ compile_r() {
R_UNZIPCMD=/usr/bin/unzip \
R_ZIPCMD=/usr/bin/zip \
./configure \
--prefix=/opt/R/${1} \
--prefix="${R_INSTALL_PATH}" \
${CONFIGURE_OPTIONS} \
${build_flag}
make clean
@ -139,7 +179,7 @@ compile_r() {
# Add OS identifier to the default HTTP user agent.
# Set this in the system Rprofile so it works when R is run with --vanilla.
cat <<EOF >> /opt/R/${1}/lib/R/library/base/R/Rprofile
cat <<EOF >> "${R_INSTALL_PATH}"/lib/R/library/base/R/Rprofile
## Set the default HTTP user agent
local({
os_identifier <- if (file.exists("/etc/os-release")) {
@ -157,7 +197,7 @@ EOF
}
# check for packager script
## If it exists this build is ready for packaging with fpm, so run the script
## If it exists this build is ready for packaging with nFPM, so run the script
## else do nothing
package_r() {
if [[ -f /package.sh ]]; then
@ -167,7 +207,7 @@ package_r() {
}
set_up_environment() {
mkdir -p /opt/R
mkdir -p "$R_INSTALL_PATH"
}
_version_is_greater_than() {
@ -181,7 +221,8 @@ _version_is_less_than() {
###### RUN R COMPILE PROCEDURE ######
set_up_environment
fetch_r_source $R_VERSION
patch_r $R_VERSION
compile_r $R_VERSION
package_r $R_VERSION
archive_r $R_VERSION
archive_r
upload_r $R_VERSION

Some files were not shown because too many files have changed in this diff Show more