FROM centos:centos7.7.1908
LABEL maintainer Tony Castronova <acastronova@cuahsi.org>

ENV PATH="/root/miniconda3/bin:${PATH}"

RUN yum update -y \
&& yum -y groupinstall "Development Tools" \
&& yum install -y \
    deltarpm \
    epel-release \
    vim \
    git \
    screen \
    wget 

RUN yum install -y \
    libcurl-devel \
    openssl-devel \
    libjpeg*devel* \
    libxml2-devel \
    nco \
    libpng-devel \
    netcdf-devel \
    hdf-devel \
    gdal \
    gdal-devel \
    proj \
    proj-devel \
    proj-epsg \
    proj-nad \
    udunits2-devel \
    R

RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh \
 && sh Miniconda3-latest-Linux-x86_64.sh -b -p /opt/miniconda3 \
 && rm -f Miniconda3-latest-Linux-x86_64.sh \
 && /opt/miniconda3/bin/conda init \
 && /opt/miniconda3/bin/conda config --set auto_activate_base false \
 && /opt/miniconda3/bin/conda config --add channels conda-forge \
 && /bin/bash -c "source ~/.bashrc"

ENV PATH="/opt/miniconda3/bin:${PATH}"

RUN conda install -y \
  --channel anaconda \
  --channel conda-forge \
  redis-py \
  gdal \
  shapely \
  pdbpp 

#### RUN cp /usr/share/proj/proj_def.dat /opt/miniconda3/envs/wrfhydro/share/proj

#RUN echo "options(repos=structure(c(CRAN=\"https://mirrors.nics.utk.edu/cran/\")))" > ~/.Rprofile \
# && R -e "install.packages(c('devtools', 'rgdal', 'RNetCDF','ggmap', 'dataRetrieval', 'data.table', 'ncdf4', 'iterators','foreach'), dependencies=TRUE, INSTALL_opts=c('--no-help', '--no-html'))"
#
#ENV R_REMOTES_NO_ERRORS_FROM_WARNINGS=true
#
#RUN mkdir -p /usr/share/doc/R-3.6.0/html \
# && R -e "devtools::install_github('NCAR/rwrfhydro')"

ADD run.py /srv/run.py
ADD watershed.py /srv/watershed.py
ADD r-subsetting /srv/r-subsetting
ADD redislogger.py /srv/redislogger.py

WORKDIR /srv
#CMD ["python", "run.py"]

