-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
90 lines (76 loc) · 2.27 KB
/
Dockerfile
File metadata and controls
90 lines (76 loc) · 2.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
FROM ubuntu:24.04
ENV DEBIAN_FRONTEND=noninteractive
# Core system deps
RUN apt-get update && apt-get install -y --no-install-recommends \
software-properties-common \
dirmngr \
gnupg \
ca-certificates \
wget \
curl \
build-essential \
gfortran \
cmake \
pkg-config \
git \
libcurl4-openssl-dev \
libssl-dev \
libxml2-dev \
libudunits2-dev \
libgdal-dev \
libgeos-dev \
libproj-dev \
locales \
&& rm -rf /var/lib/apt/lists/*
# Locale
RUN locale-gen en_US.UTF-8
ENV LANG=en_US.UTF-8
ENV LC_ALL=en_US.UTF-8
# ---- Add CRAN apt repo (THIS IS THE KEY FIX) ----
RUN wget -qO- https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc \
| gpg --dearmor -o /usr/share/keyrings/cran.gpg
RUN echo "deb [signed-by=/usr/share/keyrings/cran.gpg] https://cloud.r-project.org/bin/linux/ubuntu noble-cran40/" \
> /etc/apt/sources.list.d/cran.list
# Install R (will pull latest 4.5.x)
RUN apt-get update && apt-get install -y --no-install-recommends \
r-base \
r-base-dev \
&& rm -rf /var/lib/apt/lists/*
# R library location
ENV R_LIBS_USER=/usr/local/lib/R/site-library
RUN mkdir -p $R_LIBS_USER
# Install rstan
RUN R --vanilla -e " \
install.packages(c('Rcpp', 'RcppEigen'), repos='https://cloud.r-project.org'); \
install.packages('rstan', repos='https://cloud.r-project.org', type='source'); \
"
RUN R --vanilla -e "library(rstan); rstan::stan_version()"
# Install fmesher FIRST (INLA depends on it) -- must be installed from testing repo for R 4.5.1
RUN R -e "install.packages( \
'fmesher', \
repos = c( \
INLA = 'https://inla.r-inla-download.org/R/testing', \
CRAN = 'https://cloud.r-project.org' \
), \
type = 'source' \
)"
# Install INLA
RUN R --vanilla <<'EOF'
options(repos = c(CRAN = "https://cloud.r-project.org"))
install.packages(
"INLA",
repos = c(
INLA = "https://inla.r-inla-download.org/R/stable",
CRAN = "https://cloud.r-project.org"
),
type = "source",
INSTALL_opts = "--no-test-load"
)
EOF
RUN R -e "library(INLA); print(inla.version())"
# Install sn ("skew-normal") utilities needed to sample joint posterior from INLA marginals
RUN R -e "install.packages('sn')"
# Sanity check
RUN R -e "library(fmesher); library(INLA); inla.version()"
WORKDIR /work
CMD ["R"]