Commit b1770bc5 authored by Gaetano Raffaele's avatar Gaetano Raffaele
Browse files

ENH: new env setup and first working dockerfile.

No related merge requests found
Showing with 26 additions and 14 deletions
+26 -14
...@@ -7,7 +7,7 @@ import rasterio ...@@ -7,7 +7,7 @@ import rasterio
import rasterio.mask import rasterio.mask
from osgeo import ogr from osgeo import ogr
from pyproj import Transformer as T from pyproj import Transformer as T
from shapely import Polygon from shapely.geometry import Polygon
import tqdm import tqdm
def fetch(shp, dt, output_fld, band_list=None): def fetch(shp, dt, output_fld, band_list=None):
......
ARG BASE_IMG=ubuntu:20.04 ARG BASE_IMG=ubuntu:20.04
# Base image can be either focal (20.04) or bionic (18.04) and descendants # Base image can be either focal (20.04) or bionic (18.04) and descendants
FROM $BASE_IMG FROM $BASE_IMG
LABEL description="A base image with OTB and remote modules for the MORINGAv2 platform, CIRAD/UMR TETIS" LABEL description="An image for the MORINGAv2 platform including a specific OTB build, CIRAD/UMR TETIS"
LABEL maintainer="Raffaele GAETANO"
WORKDIR /tmp WORKDIR /tmp
ARG DEPS_INSTALL_PREFIX=/opt/otb
# Install build dependencies # Install build dependencies
RUN apt-get update \ RUN apt-get update \
&& export DEBIAN_FRONTEND=noninteractive \ && export DEBIAN_FRONTEND=noninteractive \
...@@ -47,18 +46,16 @@ RUN mkdir /tmp/SuperBuild-archives /tmp/build /opt/otb \ ...@@ -47,18 +46,16 @@ RUN mkdir /tmp/SuperBuild-archives /tmp/build /opt/otb \
&& cd SuperBuild-archives \ && cd SuperBuild-archives \
&& OTB_VERSION=$(head -n1 /tmp/otb/RELEASE_NOTES.txt | sed -r 's/OTB-v ([0-9].[0-9]).[0-9] -.*/\1/') \ && OTB_VERSION=$(head -n1 /tmp/otb/RELEASE_NOTES.txt | sed -r 's/OTB-v ([0-9].[0-9]).[0-9] -.*/\1/') \
&& curl -s "https://www.orfeo-toolbox.org/packages/archives/OTB/SuperBuild-archives-$OTB_VERSION.tar.bz2" \ && curl -s "https://www.orfeo-toolbox.org/packages/archives/OTB/SuperBuild-archives-$OTB_VERSION.tar.bz2" \
| tar -xjv --exclude 'q*' --exclude '*gl*' | tar -xjv --exclude 'q*' --exclude '*gl*' \
&& cd /tmp/build \
RUN cd /tmp/build \
&& OTB_CMAKE_FLAGS=$(cat "../build-flags-otb.txt") \ && OTB_CMAKE_FLAGS=$(cat "../build-flags-otb.txt") \
&& cmake /tmp/otb/SuperBuild \ && cmake /tmp/otb/SuperBuild \
$OTB_CMAKE_FLAGS \ $OTB_CMAKE_FLAGS \
-DCMAKE_BUILD_TYPE="Release" \ -DCMAKE_BUILD_TYPE="Release" \
-DDOWNLOAD_LOCATION=/tmp/SuperBuild-archives \ -DDOWNLOAD_LOCATION=/tmp/SuperBuild-archives \
-DCMAKE_INSTALL_PREFIX=/opt/otb \ -DCMAKE_INSTALL_PREFIX=/opt/otb \
&& make OTB_DEPENDS -j20 && make OTB_DEPENDS -j7 \
&& cd /tmp/otb/Modules/Remote \
RUN cd /tmp/otb/Modules/Remote \
&& rm -f otbGRM.remote.cmake \ && rm -f otbGRM.remote.cmake \
&& git clone "https://gitlab.irstea.fr/remi.cresson/GRM.git" \ && git clone "https://gitlab.irstea.fr/remi.cresson/GRM.git" \
&& git clone -b disassembled "https://gitlab.irstea.fr/remi.cresson/LSGRM.git" \ && git clone -b disassembled "https://gitlab.irstea.fr/remi.cresson/LSGRM.git" \
...@@ -89,12 +86,11 @@ RUN cd /tmp/otb/Modules/Remote \ ...@@ -89,12 +86,11 @@ RUN cd /tmp/otb/Modules/Remote \
-DModule_SertitObject=OFF \ -DModule_SertitObject=OFF \
-DOTB_WRAP_PYTHON=ON \ -DOTB_WRAP_PYTHON=ON \
-DPYTHON_EXECUTABLE=/usr/bin/python3 \ -DPYTHON_EXECUTABLE=/usr/bin/python3 \
-DCMAKE_INSTALL_PREFIX=/opt/otb -DCMAKE_INSTALL_PREFIX=/opt/otb \
&& sed -i 's/SetDocName/\/\/SetDocName/g' /tmp/otb/Modules/Remote/OTBPhenology/app/otbSigmoFitting.cxx \
RUN sed -i 's/SetDocName/\/\/SetDocName/g' /tmp/otb/Modules/Remote/OTBPhenology/app/otbSigmoFitting.cxx \
&& sed -i 's/SetDocName/\/\/SetDocName/g' /tmp/otb/Modules/Remote/otb-slic/app/otbSLIC.cxx \ && sed -i 's/SetDocName/\/\/SetDocName/g' /tmp/otb/Modules/Remote/otb-slic/app/otbSLIC.cxx \
&& cd /tmp/build \ && cd /tmp/build \
&& make -j20 \ && make -j7 \
&& rm -rf /tmp/* /root/.cache /opt/otb/bin/otbgui_* && rm -rf /tmp/* /root/.cache /opt/otb/bin/otbgui_*
# Persistent environment variables # Persistent environment variables
...@@ -104,3 +100,19 @@ ENV LD_LIBRARY_PATH="/opt/otb/lib:$LD_LIBRARY_PATH" ...@@ -104,3 +100,19 @@ ENV LD_LIBRARY_PATH="/opt/otb/lib:$LD_LIBRARY_PATH"
ENV OTB_APPLICATION_PATH="/opt/otb/lib/otb/applications" ENV OTB_APPLICATION_PATH="/opt/otb/lib/otb/applications"
ENV PROJ_LIB="$DEPS_INSTALL_PREFIX/share/proj" ENV PROJ_LIB="$DEPS_INSTALL_PREFIX/share/proj"
ENV GDAL_DATA="$DEPS_INSTALL_PREFIX/share/gdal" ENV GDAL_DATA="$DEPS_INSTALL_PREFIX/share/gdal"
RUN useradd -s /bin/bash -m ubuntu
USER ubuntu
WORKDIR /home/ubuntu
RUN pip install gdal==3.4.2 \
rasterio \
geopandas \
scikit-learn \
scikit-image \
psutil \
planetary_computer \
theia_picker
RUN mkdir moringav2
COPY --chown=ubuntu . /home/ubuntu/moringav2
\ No newline at end of file
Supports Markdown
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