Skip to content
Snippets Groups Projects
Dockerfile 4.84 KiB
Newer Older
# Copyright (c) 2012-2018 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Capgemini modified the first verion of this dockerfile
# for Biomass Project
# Contributors:
#   Red Hat, Inc. - initial API and implementation
#   Capgemini for Biomass project

FROM quay.io/eclipse/che-python-3.7:nightly

LABEL maintainer="teddy.kossoko@capgemini.com"
LABEL version="1.0"
LABEL description="Docker file based on ubuntu for eclipse-che workspaces for Biomass project"

edupin's avatar
edupin committed
USER root
RUN apt-get update \
 && apt-get install -y sudo


# this is where I was running into problems with the other approaches
edupin's avatar
edupin committed
#RUN sudo apt-get update 
edupin's avatar
edupin committed
RUN  apt-get update 
RUN  apt-get clean
# Installation of pip, gdal, python3, matplotlib, doxyen
# installation of scikit-learn, pandas, geopandas, fiona,  shapely

RUN  pip3 install --upgrade pip
edupin's avatar
edupin committed
RUN  sudo apt-get clean
RUN apt-get -y install sudo wget


RUN wget https://repo.anaconda.com/miniconda/Miniconda3-py37_4.9.2-Linux-x86_64.sh
RUN chmod +x Miniconda3-py37_4.9.2-Linux-x86_64.sh
#RUN   apt-get install -y  --no-install-recommends  rsync software-properties-common python3-lxml python3-pip python3-dev gdal-bin libgdal-dev octave && \ 
#       apt-get install -y libgl1-mesa-glx libegl1-mesa libxrandr2 libxrandr2 libxss1 libxcursor1 libxcomposite1 libasound2 libxi6 libxtst6 && \ 
RUN apt-get -y install sudo wget unzip sqlite3 libsqlite3-dev && \
edupin's avatar
edupin committed
      pip install -U scikit-learn && \
      pip install --user fiona && \
      pip install Shapely && \
      pip install opencv-python && \
      pip install octave_kernel && \
      apt-get -y install jq && \
edupin's avatar
edupin committed
      pip3 install --upgrade pip && \
      apt-get -y install gcc && \
edupin's avatar
edupin committed
      apt-get -y install g++ && \
     # add-apt-repository -y ppa:ubuntugis/ubuntugis-unstable && \
     # apt-get install gdal-bin && \
     # apt-get install libgdal-dev && \
      pip install OWSLib && \
edupin's avatar
edupin committed
      apt-get install -y unzip git curl && \      
      bash Miniconda3-py37_4.9.2-Linux-x86_64.sh -b -p $HOME/miniconda3  && \
      export PATH="$HOME/miniconda3/bin:$PATH" && \
      rm Miniconda3-py37_4.9.2-Linux-x86_64.sh
      #git clone https://github.com/geopandas/geopandas.git && \
      #cd geopandas && \ 
      #pip install .
#RUN $HOME/miniconda3/bin/conda init
edupin's avatar
edupin committed

#RUN export CPLUS_INCLUDE_PATH=/usr/include/gdal
#RUN export C_INCLUDE_PATH=/usr/include/gdal
#RUN  pip install --global-option=build_ext --global-option="-I/usr/include/gdal" GDAL==`gdal-config --version`
edupin's avatar
edupin committed

# installation of GDL
edupin's avatar
edupin committed
RUN  apt -y install gnudatalanguage

# We add the script folder and the zip file to be able to unzip the structure of the project
COPY initTemplate.sh /usr/bmap/initTemplate.sh
COPY initCredentials.sh /usr/bmap/initCredentials.sh
COPY Project_template.zip /usr/bmap/Project_template.zip
COPY shareAlgorithm.sh /usr/bmap/shareAlgorithm.sh
COPY .gitlab-ci.yml /usr/bmap/.gitlab-ci.yml


# We add the RestClient file
COPY RestClient.py /usr/bmap/RestClient.py
COPY quicklook_raster.py /usr/bmap/quicklook_raster.py
COPY ingestData.py /usr/bmap/ingestData.py
edupin's avatar
edupin committed
COPY ingestData.sh /usr/bmap/ingestData.sh
edupin's avatar
edupin committed
COPY maap-s3.py /usr/bmap/maap-s3.py
COPY .condarc /usr/bmap/.condarc
COPY installLib.sh /usr/bmap/.installLib.sh
edupin's avatar
edupin committed

RUN chmod a+rwx /usr/bmap/

edupin's avatar
edupin committed
RUN  chmod +x /usr/bmap/initTemplate.sh
RUN  chmod +x /usr/bmap/shareAlgorithm.sh
RUN  chmod +x /usr/bmap/ingestData.sh
edupin's avatar
edupin committed
RUN  chmod +x /usr/bmap/maap-s3.py
ENV PATH="/home/user/miniconda3/bin:/usr/bmap/:${PATH}"
ENV PYTHONPATH="/usr/bmap/:${PYTHONPATH}"
ENV PATH="/usr/modules/:${PATH}"
ENV PYTHONPATH="/usr/modules/:${PYTHONPATH}"
#We add env variable to request the back end
ENV BMAP_BACKEND_URL=http://backend-val.biomass-maap.com/bmap-web/
RUN $HOME/miniconda3/bin/conda init && \
    $HOME/miniconda3/bin/conda update -n base -c defaults conda -y

RUN  conda config --set auto_activate_base false && \
    echo "echo 'wait, we create conda environment...'" >> $HOME/.bashrc && \
    touch $HOME/.bashrc && \
    echo "cp /usr/bmap/.condarc /home/user/miniconda3/" >> $HOME/.bashrc && \
    echo "cp /usr/bmap/.installLib.sh /projects" >> $HOME/.bashrc && \
    echo "if [[ ! -d "/projects/.conda" ]]; then" >>  $HOME/.bashrc && \
    echo "  conda create -n maap python=3.7 -y 2>&1 >/dev/null" >> $HOME/.bashrc && \
    echo "fi" >> $HOME/.bashrc && \
    echo "conda activate maap 2>&1 >/dev/null" >> $HOME/.bashrc && \
    echo "conda install pip -y 2>&1 >/dev/null" >> $HOME/.bashrc && \
    echo "echo 'Workspace is ready'" >> $HOME/.bashrc && \
    echo "(&>/dev/null ./.installLib.sh &)" >> $HOME/.bashrc && \
    echo "cd /projects >& /dev/null" >> $HOME/.bashrc && \
    echo "export PATH=".conda/envs/maap/bin:/usr/bmap/:${PATH}"" >> $HOME/.bashrc

#RUN $HOME/miniconda3/bin/conda init
edupin's avatar
edupin committed
#USER user