Skip to content

Commit 942f01f

Browse files
committed
Update Dockerfile
1. Update the version of R to 4.2.1. 2. Added missing software such as proj, gdal, git and some libs to the apt-get install list. 3. Update the packages that R needs to install to be consistent with the latest instructions in README.md. 4. Installed missing R packages, such as ncdf4, raster, etc. 5. Replace the constants in the download and installation paths of GAMS with environment variables. 6. Update the version of GAMS to 40.2. As stated in README.md, "as the model benefits significantly of recent improvements in GAMS and CONOPT4 it is recommended to work with the most recent versions of both". Note, as of September 2022, the latest GAMS version is 40.3, but this version has not been tested. It has been tested that MAgPIE works fine with GAMS 40.2.
1 parent a1944d1 commit 942f01f

File tree

1 file changed

+28
-8
lines changed

1 file changed

+28
-8
lines changed

Dockerfile

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
FROM rocker/r-ver:3.6.2
1+
FROM rocker/r-ver:4.2.1
22

33
RUN mkdir /home/magpie
44
COPY . /home/magpie/
55

66
RUN apt-get update \
7+
&& apt-get upgrade -y \
78
&& apt-get install -y libpng-dev \
89
&& apt-get install -y libjpeg-dev \
910
&& apt-get install -y zlib1g-dev \
@@ -16,17 +17,30 @@ RUN apt-get update \
1617
&& apt-get install -y fonts-inconsolata \
1718
&& apt-get install -y pandoc \
1819
&& apt-get install -y pandoc-citeproc \
20+
&& apt-get install -y libfontconfig1-dev \
21+
&& apt-get install -y libharfbuzz-dev \
22+
&& apt-get install -y libfribidi-dev \
23+
&& apt-get install -y libfreetype6-dev \
24+
&& apt-get install -y libtiff5-dev \
25+
&& apt-get install -y r-cran-ncdf4 \
26+
&& apt-get install -y netcdf-bin \
27+
&& apt-get install -y libnetcdf-dev \
28+
&& apt-get install -y proj-bin \
29+
&& apt-get install -y libproj-dev \
30+
&& apt-get install -y gdal-bin \
31+
&& apt-get install -y libgdal-dev \
32+
&& apt-get install -y texlive-latex-extra \
33+
&& apt-get install -y git \
1934
&& fc-cache -fv
2035

21-
22-
23-
2436
RUN R -e "options(repos = \
2537
list(CRAN = 'https://cran.rstudio.com/',pik='https://rse.pik-potsdam.de/r/packages')); \
2638
install.packages(c('gdxrrw', \
2739
'ggplot2', \
40+
'citation', \
2841
'curl', \
2942
'gdx', \
43+
'gms', \
3044
'magclass', \
3145
'madrat', \
3246
'mip', \
@@ -36,10 +50,15 @@ RUN R -e "options(repos = \
3650
'lusweave', \
3751
'luscale', \
3852
'goxygen', \
39-
'luplot'))"
53+
'luplot', \
54+
'yaml'))"
55+
56+
RUN R -e "install.packages(c('ncdf4', \
57+
'raster'))"
4058

4159
# Set GAMS version
42-
ENV LATEST=30.3.0
60+
ENV LATEST=40.2.0
61+
ENV LATEST_SHORT=40.2
4362
ENV GAMS_VERSION=${LATEST}
4463

4564
# Set GAMS bit architecture, either 'x64_64' or 'x86_32'
@@ -56,14 +75,15 @@ RUN cd /opt/gams &&\
5675
./gams.exe &&\
5776
rm -rf gams.exe
5877

59-
COPY gamslice.txt /opt/gams/gams30.3_linux_x64_64_sfx/gamslice.txt
78+
COPY gamslice.txt /opt/gams/gams${LATEST_SHORT}_linux_${GAMS_BIT_ARC}_sfx/gamslice.txt
6079
# Add GAMS path to user env path
6180
RUN GAMS_PATH=$(dirname $(find / -name gams -type f -executable -print)) &&\
6281
ln -s $GAMS_PATH /usr/local/bin &&\
6382
echo "export PATH=\$PATH:$GAMS_PATH" >> ~/.bashrc &&\
83+
echo "export GAMS_PATH=$GAMS_PATH" >> ~/.bashrc &&\
6484
cd $GAMS_PATH &&\
6585
./gamsinst -a
6686

67-
COPY gamslice.txt /opt/gams/gams30.3_linux_x64_64_sfx/gamslice.txt
87+
COPY gamslice.txt /opt/gams/gams${LATEST_SHORT}_linux_${GAMS_BIT_ARC}_sfx/gamslice.txt
6888

6989
CMD cd /home/magpie && Rscript start.R

0 commit comments

Comments
 (0)