Skip to content

Commit 69015b7

Browse files
lorenzwalthertasottile
authored andcommitted
add R building machinery
1 parent fe493e7 commit 69015b7

File tree

2 files changed

+57
-0
lines changed

2 files changed

+57
-0
lines changed

languages/R/Dockerfile

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
FROM ubuntu:focal
2+
RUN : \
3+
# https://askubuntu.com/questions/496549/error-you-must-put-some-source-uris-in-your-sources-list
4+
&& sed -i 's/^# deb-src /deb-src /' /etc/apt/sources.list \
5+
&& apt-get update \
6+
&& DEBIAN_FRONTEND=noninteractive apt-get -y --no-install-recommends build-dep r-base \
7+
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends curl \
8+
&& apt-get clean \
9+
&& rm -rf /var/lib/apt/lists/*
10+
11+
ARG R_VERSION
12+
ARG R_SHA256
13+
RUN : \
14+
&& set -x \
15+
&& mkdir /tmp/r \
16+
&& cd /tmp/r \
17+
&& curl --silent --location --output r.tgz "https://cran.rstudio.com/src/base/R-${R_VERSION%%.*}/R-$R_VERSION.tar.gz" \
18+
&& echo "${R_SHA256} r.tgz" | sha256sum --check \
19+
&& tar -xf r.tgz \
20+
&& cd "R-${R_VERSION}" \
21+
&& mkdir -p /opt/r/ \
22+
&& ./configure \
23+
--prefix=/opt/r/ \
24+
--enable-memory-profiling \
25+
--enable-R-shlib \
26+
--with-blas \
27+
--with-lapack \
28+
--without-recommended-packages \
29+
&& make \
30+
&& make install \
31+
&& rm -rf /tmp/r \
32+
&& :

languages/R/build.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/env bash
2+
set -euxo pipefail
3+
4+
R_VERSION=4.0.2
5+
R_SHA256=d3bceab364da0876625e4097808b42512395fdf41292f4915ab1fd257c1bbe75
6+
7+
podman build \
8+
--build-arg=R_VERSION="$R_VERSION" \
9+
--build-arg=R_SHA256="$R_SHA256" \
10+
-t runner-image-r .
11+
12+
cid="$(podman create runner-image-r sleep infinity)"
13+
trap 'podman rm -f "$cid"' exit
14+
15+
podman start "$cid"
16+
podman exec "$cid" rm -rf /opt/r/lib/R/doc /opt/r/share
17+
podman exec "$cid" \
18+
tar -C /opt/r \
19+
--sort=name \
20+
--mtime="1970-01-01 00:00:00Z" \
21+
--owner=0 --group=0 --numeric-owner \
22+
-czf /tmp/r.tgz .
23+
24+
podman cp "$cid:/tmp/r.tgz" "r-${R_VERSION}.tgz"
25+
sha256sum "r-${R_VERSION}.tgz"

0 commit comments

Comments
 (0)