Skip to content

Commit 4b110a1

Browse files
committed
Add Alpine Linux R Dockerfile
1 parent 534ef71 commit 4b110a1

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
# Minimal Alpine Linux container with R for testing Arrow R package
19+
# on musl libc (CRAN runs checks on Alpine Linux 3.22)
20+
# Replicates CRAN's Alpine environment as closely as possible
21+
22+
ARG arch=amd64
23+
FROM ${arch}/alpine:3.22
24+
25+
# Install R and essential build tools
26+
# Keep minimal to match CRAN's setup (no bash - CRAN uses BusyBox)
27+
RUN apk add \
28+
R \
29+
R-dev \
30+
R-doc \
31+
cmake \
32+
curl-dev \
33+
g++ \
34+
gcc \
35+
git \
36+
make \
37+
musl-locales \
38+
openssl-dev \
39+
pkgconfig \
40+
re2-dev \
41+
zlib-dev && \
42+
rm -rf /var/cache/apk/* && \
43+
ln -s /usr/share/zoneinfo/Etc/UTC /etc/localtime && \
44+
echo "Etc/UTC" > /etc/timezone
45+
46+
# Set locale and timezone
47+
ENV LANG=C.UTF-8 \
48+
LC_COLLATE=C \
49+
MUSL_LOCPATH=/usr/share/i18n/locales/musl
50+
51+
# Set CRAN repo
52+
RUN echo 'options(repos = c(CRAN = "https://cran.rstudio.com"))' >> /usr/lib/R/etc/Rprofile.site
53+
54+
# Install pak for package management (following rhub pattern)
55+
RUN R -q -e 'install.packages("pak", repos = sprintf("https://r-lib.github.io/p/pak/%s/%s/%s/%s", "devel", .Platform$pkgType, R.Version()$os, R.Version()$arch))'
56+
57+
# Enable automatic system requirements installation
58+
ENV PKG_SYSREQS=true \
59+
R_PKG_SYSREQS2=true
60+
61+
# Set up parallel compilation
62+
RUN echo "MAKEFLAGS=-j$(R -s -e 'cat(parallel::detectCores())')" >> /usr/lib/R/etc/Renviron.site
63+
64+
# Verify R works and this is musl
65+
RUN R --version && ldd --version 2>&1 | grep -q musl

0 commit comments

Comments
 (0)