-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathDockerfile
More file actions
89 lines (81 loc) · 4.14 KB
/
Copy pathDockerfile
File metadata and controls
89 lines (81 loc) · 4.14 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
# STAGE 0 - Ubuntu and R packages (geoBAM)
FROM rpy2/base-ubuntu:master-20.04 as stage0
RUN echo "America/New_York" | tee /etc/timezone \
&& apt update \
&& apt upgrade -y \
&& DEBIAN_FRONTEND=noninteractive apt install -y \
build-essential \
curl \
gcc \
gfortran \
locales \
libcurl4-gnutls-dev \
libfontconfig1-dev \
libfribidi-dev \
libgit2-dev \
libharfbuzz-dev \
libnetcdf-dev \
libnetcdff-dev \
libssl-dev \
libtiff5-dev \
libxml2-dev \
tzdata \
&& locale-gen en_US.UTF-8 \
&& /usr/bin/curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
# Stage 2 - R and R packages (geoBAM)
FROM stage0 as stage1
COPY remove_packages.R /app/remove_packages.R
RUN apt -y install \
software-properties-common \
dirmngr \
&& . /etc/lsb-release \
&& wget -qO- https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc | tee -a /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc \
&& add-apt-repository -y "deb https://cloud.r-project.org/bin/linux/ubuntu $(lsb_release -cs)-cran40/" \
&& apt -y install --no-install-recommends r-base \
&& /usr/bin/Rscript /app/remove_packages.R \
&& /usr/bin/Rscript -e 'Sys.setenv(DOWNLOAD_STATIC_LIBV8 = 1); install.packages("V8")' \
&& /usr/bin/Rscript -e "install.packages('dplyr', dependencies=TRUE, repos='http://cran.rstudio.com/')" \
&& /usr/bin/Rscript -e "install.packages('reshape2', dependencies=TRUE, repos='http://cran.rstudio.com/')" \
&& /usr/bin/Rscript -e "install.packages('settings', dependencies=TRUE, repos='http://cran.rstudio.com/')" \
&& /usr/bin/Rscript -e "install.packages('RNetCDF', dependencies=TRUE, repos='http://cran.rstudio.com/')" \
&& /usr/bin/Rscript -e "install.packages('foreach', dependencies=TRUE, repos='http://cran.rstudio.com/')" \
&& /usr/bin/Rscript -e "install.packages('doParallel', dependencies=TRUE, repos='http://cran.rstudio.com/')" \
&& /usr/bin/Rscript -e "install.packages('yaml', dependencies=TRUE, repos='http://cran.rstudio.com/')" \
&& /usr/bin/Rscript -e "install.packages('data.table', dependencies=TRUE, repos='http://cran.rstudio.com/')" \
&& /usr/bin/Rscript -e "install.packages('rjson', dependencies=TRUE, repos='http://cran.rstudio.com/')" \
&& /usr/bin/Rscript -e "install.packages('R.utils', dependencies=TRUE, repos='http://cran.rstudio.com/')" \
&& /usr/bin/Rscript -e "install.packages('BBmisc', dependencies=TRUE, repos='http://cran.rstudio.com/')" \
# && /usr/bin/Rscript -e "install.packages('tidyhydat', dependencies=TRUE, repos='http://cran.rstudio.com/')" \
&& /usr/bin/Rscript -e "install.packages('RSelenium', dependencies=TRUE, repos='http://cran.rstudio.com/')"\
&& /usr/bin/Rscript -e "install.packages('rvest', dependencies=TRUE, repos='http://cran.rstudio.com/')"
# && /usr/bin/Rscript -e "devtools::install_github('buzacott/bomWater')"
#Stage 3 - Python and Python packages
FROM stage1 as stage2
RUN add-apt-repository -y ppa:deadsnakes/ppa \
&& apt update \
&& apt install -y python3.12 python3.12-dev python3.12-venv
COPY requirements.txt /app/requirements.txt
RUN /usr/bin/python3.12 -m venv /app/env
RUN /app/env/bin/pip install -r /app/requirements.txt
# Stage 4 - Copy priors code
FROM stage2 as stage3
RUN /usr/bin/Rscript -e "install.packages('devtools', dependencies=TRUE, repos='http://cran.rstudio.com/')" \
&& /usr/bin/Rscript -e 'devtools::install_github("nikki-t/geoBAMr", force = TRUE)' \
&& /usr/bin/Rscript -e "devtools::install_github('buzacott/bomWater', force = TRUE)" \
&& /usr/bin/Rscript -e "devtools::install_github('Travis-Simmons/tidyhydat')"
# Stage 5 - Download tidyhydat database
FROM stage3 as stage4
COPY metadata/ /app/metadata/
COPY priors/ /app/priors/
COPY update_priors.py /app/update_priors.py
# FROM stage4 as stage5
RUN sudo mkdir /opt/hydroshare
# RUN /usr/bin/Rscript -e 'library(tidyhydat)'\
# && /usr/bin/Rscript -e 'tidyhydat::download_hydat(dl_hydat_here = "/opt/hydroshare", ask = FALSE )' \
# Stage 6 - Execute algorithm
FROM stage4 as stage5
LABEL version="1.0" \
description="Containerized priors module." \
"confluence.contact"="ntebaldi@umass.edu" \
"algorithm.contact"="ntebaldi@umass.edu"
ENTRYPOINT ["/app/env/bin/python3", "/app/update_priors.py"]