Skip to content
Snippets Groups Projects
Commit e2516f02 authored by edupin's avatar edupin
Browse files

Merge branch 'develop' of...

Merge branch 'develop' of https://biomass.pl.s2-eu.capgemini.com/gitlab/bmap/Stack-che into edu_update_stack
parents 32836bb0 00cefd83
No related branches found
No related tags found
No related merge requests found
......@@ -17,52 +17,51 @@ LABEL maintainer="teddy.kossoko@capgemini.com"
LABEL version="1.0"
LABEL description="Docker file based on ubuntu for eclipse-che workspaces for Biomass project"
RUN sudo chmod 777 /etc/apt/sources.list
RUN sudo apt-get update
USER root
#RUN chmod 777 /etc/apt/sources.list
RUN apt-get update
# Installation of pip, gdal, python3, matplotlib, doxyen
# installation of scikit-learn, pandas, geopandas, fiona, shapely
RUN sudo apt-get update && \
sudo apt-get install -y software-properties-common python-software-properties && \
sudo apt-get install -y python3-lxml && \
sudo apt-get install -y python3-pip &&\
sudo pip3 install scipy==0.19.1 && \
sudo pip3 install matplotlib && \
sudo pip3 install property && \
sudo pip install pillow && \
sudo pip install -U scikit-learn && \
sudo pip install pandas && \
sudo git clone https://github.com/geopandas/geopandas.git && \
RUN apt-get update && \
apt-get install -y software-properties-common python-software-properties python3-lxml python3-pip &&\
pip3 install scipy==0.19.1 && \
pip3 install matplotlib && \
pip3 install property && \
pip install pillow && \
pip install -U scikit-learn && \
pip install pandas && \
git clone https://github.com/geopandas/geopandas.git && \
cd geopandas && \
sudo pip install . && \
pip install . && \
cd .. && \
sudo rm -rf geopandas && \
sudo apt-get -y install libgdal1-dev && \
sudo pip install --user fiona && \
sudo sudo apt-get install python-shapely
rm -rf geopandas && \
apt-get -y install libgdal1-dev && \
pip install --user fiona && \
apt-get install python-shapely && \
pip install opencv-python
#INstallation of Octave
RUN sudo apt-add-repository ppa:octave/stable && \
sudo apt-get update && \
sudo apt-get -y install octave && \
sudo apt-get -y install doxygen && \
sudo pip3 install --upgrade pip && \
sudo add-apt-repository -y ppa:ubuntugis/ubuntugis-unstable && \
sudo apt update && \
sudo apt -y upgrade && \
sudo apt install -y gdal-bin libgdal-dev && \
sudo pip install requests && \
sudo pip install conda
RUN apt-add-repository ppa:octave/stable && \
apt-get update && \
apt-get -y install octave && \
apt-get -y install doxygen && \
pip3 install --upgrade pip && \
add-apt-repository -y ppa:ubuntugis/ubuntugis-unstable && \
apt update && \
apt -y upgrade && \
apt install -y gdal-bin libgdal-dev && \
pip install requests && \
pip install conda
# installation of GDL
RUN sudo apt -y install gnudatalanguage
RUN apt -y install gnudatalanguage
# install gdal and matplotlib with CONDA
#RUN conda install -y gdal matplotlib
RUN sudo pip install --global-option=build_ext --global-option="-I/usr/include/gdal" GDAL==`gdal-config --version`
RUN pip install --global-option=build_ext --global-option="-I/usr/include/gdal" GDAL==`gdal-config --version`
# 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
......@@ -78,14 +77,14 @@ COPY quicklook_raster.py /usr/bmap/quicklook_raster.py
COPY ingestData.py /usr/bmap/ingestData.py
COPY ingestData.sh /usr/bmap/ingestData.sh
USER root
RUN chmod +x /usr/bmap/initTemplate.sh
RUN chmod +x /usr/bmap/shareAlgorithm.sh
RUN chmod +x /usr/bmap/ingestData.sh
ENV PATH="/usr/bmap/:${PATH}"
ENV PYTHONPATH="/usr/bmap/:${PYTHONPATH}"
#We add env variable to request the back end
ENV BMAP_BACKEND_URL=http://backend.biomass-maap.com/bmap-web/
ENV BMAP_BACKEND_URL=http://backend-val.biomass-maap.com/bmap-web/
USER user
......@@ -12,7 +12,6 @@ from properties.p import Property
from typing import Iterable
logging.basicConfig(filename='RestClient.log', level=logging.DEBUG, format='%(asctime)s %(levelname)-8s %(message)s', datefmt='%Y-%m-%d %H:%M:%S')
url = os.environ['BMAP_BACKEND_URL'] + 'catalogue/granule/'
......@@ -174,15 +173,24 @@ def download_granule(granule_id: str, target_Dir: str) -> Iterable:
try:
response = requests.get(url + 'granulename/' + granule_id)
json_str = response.text
print(target_Dir)
# if the response body contains something
if len(json_str) > 0:
json_obj = json.loads(response.text)
for data in json_obj['Granule']['dataList'][:] :
urlToData = data['Data']['urlToData']
completeName = os.path.join(target_Dir, data['Data']['fileName'])
r = requests.get(urlToData, allow_redirects=True)
open(completeName, 'wb').write(r.content)
#print(target_Dir+'/'+data['Data']['fileName'])
my_file = Path(target_Dir+'/'+data['Data']['fileName'])
urlToData=''
if my_file.is_file():
print(data['Data']['fileName']+' already exists in targetDir: '+ target_Dir)
logging.info(data['Data']['fileName']+' already exists in targetDir: '+ target_Dir)
else:
urlToData = data['Data']['urlToData']
completeName = os.path.join(target_Dir, data['Data']['fileName'])
r = requests.get(urlToData, allow_redirects=True)
open(completeName, 'wb').write(r.content)
print(data['Data']['fileName']+' has been successfully downloaded in targetDir: '+ target_Dir)
logging.info(data['Data']['fileName']+' has been successfully downloaded in targetDir: '+ target_Dir)
return urlToData
else:
print('INFO: There is no data with ID: ' + granule_id)
......@@ -195,6 +203,7 @@ def download_granule(granule_id: str, target_Dir: str) -> Iterable:
#########################################################################
# -*- coding: utf-8 -*-
......
docker build -t kosted/bmap-stack:latest .
docker run --rm kosted/bmap-stack:latest pip freeze
docker push kosted/bmap-stack:latest
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment