Skip to content

Commit e11194c

Browse files
committed
Update pythonr
1 parent f0eb444 commit e11194c

File tree

1 file changed

+66
-47
lines changed

1 file changed

+66
-47
lines changed

pythonr/Dockerfile

Lines changed: 66 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,82 @@
11
FROM ghcr.io/geocompx/python
22

33
# Install R and locales
4+
# Fails on Debian (ubuntu PPA does not support Debian):
5+
# RUN wget https://raw.githubusercontent.com/rocker-org/rocker-versioned2/refs/heads/master/scripts/install_R_ppa.sh
6+
# RUN bash install_R_ppa.sh
7+
# bash -c "$(curl -L https://rstd.io/r-install)"
8+
# Install curl:
49
RUN apt-get update && apt-get install -y --no-install-recommends \
5-
ca-certificates \
6-
libcurl4-openssl-dev \
7-
libssl-dev \
8-
libxml2-dev \
9-
libtcl8.6 \
10-
libtk8.6 \
10+
curl \
1111
locales \
12-
&& locale-gen C.UTF-8 \
1312
&& rm -rf /var/lib/apt/lists/*
13+
# Manual R installation: Download and install R DEB for Debian 12
14+
ARG R_VERSION=4.5.1
15+
RUN curl -O https://cdn.posit.co/r/debian-12/pkgs/r-${R_VERSION}_1_$(dpkg --print-architecture).deb && \
16+
apt-get update && \
17+
apt-get install -y --no-install-recommends ./r-${R_VERSION}_1_$(dpkg --print-architecture).deb && \
18+
rm r-${R_VERSION}_1_$(dpkg --print-architecture).deb
1419

15-
ENV LANG=C.UTF-8
16-
ENV LC_ALL=C.UTF-8
20+
ENV PATH="/opt/R/${R_VERSION}/bin:${PATH}"
21+
ENV R_PKG_TYPE=binary
1722

18-
RUN wget https://github.com/rocker-org/rocker-versioned2/raw/refs/heads/master/scripts/install_R_source.sh
19-
RUN bash install_R_source.sh
23+
RUN mkdir -p /etc/R && \
24+
echo "options(repos = c(CRAN = 'https://packagemanager.posit.co/cran/__linux__/bookworm/latest'))" > /etc/R/Rprofile.site && \
25+
mkdir -p /root && \
26+
echo "options(repos = c(CRAN = 'https://packagemanager.posit.co/cran/__linux__/bookworm/latest'))" > /root/.Rprofile
2027

21-
RUN apt-get update && apt-get install -y --no-install-recommends \
22-
# rspatial deps:
23-
libgdal-dev \
24-
libproj-dev \
25-
libudunits2-dev \
26-
libspatialindex-dev \
27-
libabsl-dev \
28-
libgeos-dev \
29-
libsqlite3-dev \
30-
libtiff-dev \
31-
libjpeg-dev \
32-
libpng-dev \
33-
zlib1g-dev \
34-
libfontconfig1-dev \
35-
libfreetype6-dev \
36-
build-essential \
37-
libharfbuzz-dev \
38-
libfribidi-dev \
39-
libv8-dev \
40-
libmagick++-dev \
41-
cmake \
42-
&& rm -rf /var/lib/apt/lists/*
28+
# Install pak
29+
RUN R -e "options(repos = c(CRAN = 'https://packagemanager.posit.co/cran/__linux__/bookworm/latest')); install.packages('pak')"
30+
31+
# # Install packages with pak (binaries from RSPM)
32+
# RUN Rscript -e "pak::pkg_install('sf')"
4333

44-
# Install ragg and its dependencies for high-quality headless graphics
45-
RUN R -e "install.packages(c('ragg', 'systemfonts', 'textshaping'))"
34+
# RUN wget https://raw.githubusercontent.com/rocker-org/rocker-versioned2/refs/heads/master/scripts/setup_R.sh
35+
# RUN bash setup_R.sh
36+
37+
# RUN wget https://github.com/rocker-org/rocker-versioned2/raw/refs/heads/master/scripts/install_R_source.sh
38+
# RUN bash install_R_source.sh
39+
40+
# RUN apt-get update && apt-get install -y --no-install-recommends \
41+
# # rspatial deps:
42+
# libgdal-dev \
43+
# libproj-dev \
44+
# libudunits2-dev \
45+
# libspatialindex-dev \
46+
# libabsl-dev \
47+
# libgeos-dev \
48+
# libsqlite3-dev \
49+
# libtiff-dev \
50+
# libjpeg-dev \
51+
# libpng-dev \
52+
# zlib1g-dev \
53+
# libfontconfig1-dev \
54+
# libfreetype6-dev \
55+
# build-essential \
56+
# libharfbuzz-dev \
57+
# libfribidi-dev \
58+
# libv8-dev \
59+
# libmagick++-dev \
60+
# cmake \
61+
# && rm -rf /var/lib/apt/lists/*
62+
63+
# # Install ragg and its dependencies for high-quality headless graphics
64+
# RUN R -e "install.packages(c('ragg', 'systemfonts', 'textshaping'))"
4665

4766
# Configure R to use ragg as the default graphics device
48-
RUN mkdir -p /etc/R && \
49-
echo "options(repos = c(CRAN = 'https://cloud.r-project.org'))" > /etc/R/Rprofile.site && \
50-
echo "if (requireNamespace('ragg', quietly = TRUE)) { options(device = ragg::agg_png) }" >> /etc/R/Rprofile.site && \
51-
echo 'options(Ncpus = parallel::detectCores())' >> /etc/R/Rprofile.site
67+
# RUN mkdir -p /etc/R && \
68+
# echo "options(repos = c(CRAN = 'https://cloud.r-project.org'))" > /etc/R/Rprofile.site && \
69+
# echo "if (requireNamespace('ragg', quietly = TRUE)) { options(device = ragg::agg_png) }" >> /etc/R/Rprofile.site && \
70+
# echo 'options(Ncpus = parallel::detectCores())' >> /etc/R/Rprofile.site
5271

53-
# Install sf:
54-
RUN R -e "install.packages('sf', repos = 'https://cloud.r-project.org')"
55-
# Install remotes for GitHub installs:
56-
RUN R -e "install.packages('remotes', repos = 'https://cloud.r-project.org')"
57-
# Install bookdown for book building:
58-
RUN R -e "install.packages('bookdown', repos = 'https://cloud.r-project.org')"
59-
# Install geocompx:
60-
RUN R -e "install.packages('geocompkg', repos = c('https://geocompx.r-universe.dev', 'https://cloud.r-project.org'), dependencies = TRUE, force = TRUE)"
72+
# # Install sf:
73+
# RUN R -e "install.packages('sf', repos = 'https://cloud.r-project.org')"
74+
# # Install remotes for GitHub installs:
75+
# RUN R -e "install.packages('remotes', repos = 'https://cloud.r-project.org')"
76+
# # Install bookdown for book building:
77+
# RUN R -e "install.packages('bookdown', repos = 'https://cloud.r-project.org')"
78+
# # Install geocompx:
79+
# RUN R -e "install.packages('geocompkg', repos = c('https://geocompx.r-universe.dev', 'https://cloud.r-project.org'), dependencies = TRUE, force = TRUE)"
6180

6281
# # build the book
6382
# RUN wget https://github.com/geocompx/geocompr/archive/main.zip && \

0 commit comments

Comments
 (0)