diff --git a/.github/workflows/build-docker-base.yml b/.github/workflows/build-docker-base.yml index 853aaa8..3b570b9 100644 --- a/.github/workflows/build-docker-base.yml +++ b/.github/workflows/build-docker-base.yml @@ -3,7 +3,7 @@ name: Docker Base Image on: push: branches: [ master ] - paths: 'base.dockerfile' + paths: [ 'base.dockerfile' ] jobs: build: @@ -12,19 +12,18 @@ jobs: - name: Get current date id: date run: echo "::set-output name=date::$(date +'%Y.%m.%d')" - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: submodules: recursive - token: ${{ secrets.GH_PAT }} - name: Login to Docker Hub - uses: docker/login-action@v1 + uses: docker/login-action@v2 with: username: ${{ secrets.DOCKER_HUB_USERNAME }} password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 + uses: docker/setup-buildx-action@v2 - name: Build and push - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v4 with: context: ./ file: ./base.dockerfile @@ -33,6 +32,6 @@ jobs: JOBS=2 VERSION=${{ steps.date.outputs.date }} push: true - tags: ${{ secrets.DOCKER_HUB_USERNAME }}/geoflow-bundle-base:latest, ${{ secrets.DOCKER_HUB_USERNAME }}/geoflow-bundle-base:${{ steps.date.outputs.date }} - cache-from: type=registry,ref=${{ secrets.DOCKER_HUB_USERNAME }}/geoflow-bundle-base:buildcache - cache-to: type=registry,ref=${{ secrets.DOCKER_HUB_USERNAME }}/geoflow-bundle-base:buildcache,mode=max \ No newline at end of file + tags: 3dgi/geoflow-bundle-base:${{ steps.date.outputs.date }} + cache-from: type=registry,ref=3dgi/geoflow-bundle-base:buildcache + cache-to: type=registry,ref=3dgi/geoflow-bundle-base:buildcache,mode=max \ No newline at end of file diff --git a/.github/workflows/build-docker-builder.yml b/.github/workflows/build-docker-builder.yml new file mode 100644 index 0000000..7aa32c8 --- /dev/null +++ b/.github/workflows/build-docker-builder.yml @@ -0,0 +1,36 @@ +name: Docker Builder Image + +on: + push: + tags: + - '202[2-9].[0-9]+.[0-9]+' + paths-ignore: + - '**.md' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + - name: Login to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Build and push + uses: docker/build-push-action@v4 + with: + context: ./ + file: ./builder.dockerfile + builder: ${{ steps.buildx.outputs.name }} + build-args: | + JOBS=2 + VERSION=${{ github.ref_name }} + push: true + tags: 3dgi/geoflow-bundle-builder:${{ github.ref_name }} + cache-from: type=registry,ref=3dgi/geoflow-bundle-builder:buildcache + cache-to: type=registry,ref=3dgi/geoflow-bundle-builder:buildcache,mode=max \ No newline at end of file diff --git a/base-ubuntu.dockerfile b/base-ubuntu.dockerfile deleted file mode 100644 index bf065d3..0000000 --- a/base-ubuntu.dockerfile +++ /dev/null @@ -1,106 +0,0 @@ -FROM ubuntu:lunar-20230301 -ARG VERSION -LABEL org.opencontainers.image.authors="Balázs Dukai " -LABEL org.opencontainers.image.vendor="3DGI" -LABEL org.opencontainers.image.title="geoflow-bundle-base-ubuntu" -LABEL org.opencontainers.image.description="Base image for building the geoflow-bundle." -LABEL org.opencontainers.image.version=$VERSION -LABEL org.opencontainers.image.licenses="MIT" -ARG JOBS - -RUN apt-get update && apt-get -y install \ - libgeos++-dev \ - libeigen3-dev \ - libpq-dev \ - nlohmann-json3-dev \ - libboost-filesystem-dev \ - libsqlite3-dev sqlite3\ - libgeotiff-dev \ - build-essential \ - wget \ - git \ - cmake - -RUN cd /tmp && \ - wget https://download.osgeo.org/proj/proj-9.1.0.tar.gz && \ - tar -zxvf proj-9.1.0.tar.gz && \ - cd proj-9.1.0 && \ - mkdir build && \ - cd build/ && \ - cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF && \ - cmake --build . --config Release --parallel $JOBS && \ - cmake --install . && \ - rm -rf /tmp/* - -ARG LASTOOLS_VERSION=9ecb4e682153436b044adaeb3b4bfdf556109a0f -RUN cd /tmp && \ - git clone https://github.com/LAStools/LAStools.git lastools && \ - cd lastools && \ - git checkout ${LASTOOLS_VERSION} && \ - mkdir build && \ - cd build && \ - cmake .. -DCMAKE_BUILD_TYPE=Release && \ - cmake --build . --parallel $JOBS --config Release && \ - cmake --install . && \ - rm -rf /tmp/* && \ - mkdir /tmp/geoflow-bundle - -ARG CGAL_VERSION=5.4 -RUN cd /tmp && \ - apt-get install -y libboost-system-dev libboost-thread-dev libgmp-dev libmpfr-dev zlib1g-dev && \ - wget https://github.com/CGAL/cgal/releases/download/v${CGAL_VERSION}/CGAL-${CGAL_VERSION}.tar.xz && \ - tar xf CGAL-${CGAL_VERSION}.tar.xz && \ - cd CGAL-${CGAL_VERSION} && \ - mkdir build && cd build && \ - cmake .. -DCMAKE_BUILD_TYPE=Release && \ - cmake --build . --parallel $JOBS --config Release && \ - cmake --install . && \ - rm -rf /tmp/* - -ARG FGDB_VERSION=1.5.2 -ARG GDAL_VERSION=3.6.2 -RUN cd /tmp && \ - git clone https://github.com/Esri/file-geodatabase-api.git && \ - tar -xf file-geodatabase-api/FileGDB_API_${FGDB_VERSION}/FileGDB_API-RHEL7-64gcc83.tar.gz && \ - rm -rf /tmp/FileGDB_API-RHEL7-64gcc83/lib/libstdc++.so* && \ - mv /tmp/FileGDB_API-RHEL7-64gcc83 /usr/local/src/FileGDB && \ - ln -s /usr/local/src/FileGDB/lib/libFileGDBAPI.so /usr/local/lib/libFileGDBAPI.so && \ - ln -s /usr/local/src/FileGDB/lib/libfgdbunixrtl.so /usr/local/lib/libfgdbunixrtl.so && \ - ldconfig && \ - wget http://download.osgeo.org/gdal/${GDAL_VERSION}/gdal-${GDAL_VERSION}.tar.gz && \ - tar -zxvf gdal-${GDAL_VERSION}.tar.gz && \ - cd gdal-${GDAL_VERSION} && \ - mkdir build && cd build && \ - cmake .. -DCMAKE_BUILD_TYPE=Release -DENABLE_IPO=OFF -DFileGDB_ROOT=/usr/local/src/FileGDB -DBUILD_TESTING=OFF && \ - cmake --build . --parallel $JOBS --config Release && \ - cmake --install . && \ - ldconfig && \ - rm -rf /tmp/* - -RUN ldconfig -## install geoflow -#COPY . /tmp/geoflow-bundle -#RUN cd /tmp/geoflow-bundle && \ -# mkdir build && cd build && \ -# cmake .. -DCMAKE_BUILD_TYPE=Release -DGF_BUILD_GUI=OFF && \ -# cmake --build . --parallel $JOBS --config Release && \ -# cmake --install . && \ -# rm -rf /tmp/* -# -## install citygml-tools -#RUN apt-get update && apt-get -y install unzip default-jre && \ -# cd /tmp && \ -# wget https://github.com/citygml4j/citygml-tools/releases/download/v2.0.0/citygml-tools-2.0.0.zip && \ -# unzip citygml-tools-2.0.0.zip && \ -# mv citygml-tools-2.0.0 /opt/ && \ -# ln -s /opt/citygml-tools-2.0.0/citygml-tools /usr/local/bin/citygml-tools && \ -# rm -rf /tmp/* -# -#WORKDIR /data -#USER 1000 - -# ENTRYPOINT ["citygml-tools"] -# CMD ["--help"] - -# docker build -t gf-ubuntu-base -f base-ubuntu.dockerfile -# docker run -it gf-ubuntu-base diff --git a/base.dockerfile b/base.dockerfile index 8f59825..377f984 100644 --- a/base.dockerfile +++ b/base.dockerfile @@ -1,351 +1,80 @@ -FROM alpine:3.15 +FROM ubuntu:lunar-20230301 ARG VERSION LABEL org.opencontainers.image.authors="Balázs Dukai " LABEL org.opencontainers.image.vendor="3DGI" -LABEL org.opencontainers.image.title="geoflow-bundle-base" +LABEL org.opencontainers.image.title="geoflow-bundle-base-ubuntu" LABEL org.opencontainers.image.description="Base image for building the geoflow-bundle." LABEL org.opencontainers.image.version=$VERSION LABEL org.opencontainers.image.licenses="MIT" ARG JOBS -# -# 1 Install proj -# proj-data is not added, TIFF and curl support are disabled, because we are not going to do any -# transformations with proj, just need it for the gis libraries to run. -ARG PROJ_VERSION=8.1.1 -RUN apk --update add sqlite libstdc++ sqlite-libs libgcc && \ - apk --update add --virtual .proj-deps \ - make \ - gcc \ - g++ \ - file \ - sqlite-dev \ - unzip && \ - cd /tmp && \ - wget http://download.osgeo.org/proj/proj-${PROJ_VERSION}.tar.gz && \ - tar xfvz proj-${PROJ_VERSION}.tar.gz && \ - rm -f proj-${PROJ_VERSION}.tar.gz && \ - cd proj-${PROJ_VERSION} && \ - ./configure \ - --disable-tiff \ - --without-curl \ - --enable-lto \ - CFLAGS="-O3" CXXFLAGS="-O3" && \ - make -j $JOBS && \ - make install && \ - echo "Entering root folder" && \ - cd / &&\ - echo "Cleaning dependencies tmp and manuals" && \ - apk del .proj-deps && \ - rm -rf /tmp/* && \ - rm -rf /user/local/man && \ - for i in /usr/local/lib/libproj*; do strip -s $i 2>/dev/null || /bin/true; done && \ - for i in /usr/local/lib/geod*; do strip -s $i 2>/dev/null || /bin/true; done && \ - for i in /usr/local/bin/proj*; do strip -s $i 2>/dev/null || /bin/true; done && \ - proj - -# -# 2 Install geos -# -ARG GEOS_VERSION=3.10.1 -RUN apk --update add --virtual .geos-deps \ - make \ - gcc \ - g++ \ - cmake \ - file \ - libtool && \ - cd /tmp && \ - wget http://download.osgeo.org/geos/geos-${GEOS_VERSION}.tar.bz2 && \ - tar xfvj geos-${GEOS_VERSION}.tar.bz2 && \ - rm -f geos-${GEOS_VERSION}.tar.bz2 && \ - cd geos-${GEOS_VERSION} && \ - mkdir "_build" && \ - cd "_build" && \ - cmake \ - -DCMAKE_BUILD_TYPE=Release \ - -DBUILD_DOCUMENTATION=OFF \ - .. && \ - make -j $JOBS && \ - ctest && \ - make install && \ - cd ~ && \ - apk del .geos-deps && \ - rm -rf /tmp/* && \ - rm -rf /user/local/man && \ - for i in /usr/local/lib/libgeos*; do strip -s $i 2>/dev/null || /bin/true; done && \ - for i in /usr/local/bin/geos-config*; do strip -s $i 2>/dev/null || /bin/true; done +RUN apt-get update && apt-get -y install \ + libgeos++-dev \ + libeigen3-dev \ + libpq-dev \ + nlohmann-json3-dev \ + libboost-filesystem-dev \ + libsqlite3-dev sqlite3\ + libgeotiff-dev \ + build-essential \ + wget \ + git \ + cmake -# -# 3 Install Boost -# -ARG BOOST_VERSION=1_77_0 -RUN apk add boost-dev && \ - apk --update add \ - zlib \ - zstd \ - xz \ - icu \ - bzip2 \ - mpfr-dev \ - eigen && \ - apk --update add --virtual .boost-deps \ - zlib-dev \ - zstd-dev \ - xz-dev \ - icu-dev \ - bzip2-dev \ - make \ - gcc \ - g++ \ - cmake \ - linux-headers && \ - cd /tmp && \ - wget https://boostorg.jfrog.io/artifactory/main/release/1.77.0/source/boost_${BOOST_VERSION}.tar.bz2 && \ - tar xzfj boost_${BOOST_VERSION}.tar.bz2 && \ - cd boost_${BOOST_VERSION} && \ - ./bootstrap.sh \ - --with-libraries=all \ - --libdir=/usr/local/lib \ - --includedir=/usr/local/include \ - --exec-prefix=/usr/local && \ - ./b2 \ - --libdir=/usr/local/lib \ - --includedir=/usr/local/include \ - --exec-prefix=/usr/local \ - install && \ - cd ~ && \ - apk del .boost-deps && \ - rm -rf /tmp/* && \ - rm -rf /user/local/man && \ - for i in /usr/local/lib/libboost*; do strip -s $i 2>/dev/null || /bin/true; done +RUN cd /tmp && \ + wget https://download.osgeo.org/proj/proj-9.1.0.tar.gz && \ + tar -zxvf proj-9.1.0.tar.gz && \ + cd proj-9.1.0 && \ + mkdir build && \ + cd build/ && \ + cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF && \ + cmake --build . --config Release --parallel $JOBS && \ + cmake --install . && \ + rm -rf /tmp/* -# -# 4 Install LASTools -# ARG LASTOOLS_VERSION=9ecb4e682153436b044adaeb3b4bfdf556109a0f -RUN apk --update add --virtual .lastools-deps \ - which \ - make \ - cmake \ - gcc \ - g++ \ - file \ - git \ - libtool && \ - cd /tmp && \ +RUN cd /tmp && \ git clone https://github.com/LAStools/LAStools.git lastools && \ cd lastools && \ git checkout ${LASTOOLS_VERSION} && \ - mkdir "_build" && \ - cd "_build" && \ + mkdir build && \ + cd build && \ cmake .. -DCMAKE_BUILD_TYPE=Release && \ - make -j $JOBS && \ - make install && \ - apk del .lastools-deps && \ + cmake --build . --parallel $JOBS --config Release && \ + cmake --install . && \ rm -rf /tmp/* && \ - rm -rf /user/local/man + mkdir /tmp/geoflow-bundle -# -# 5 Install CGAL -# -ARG CGAL_VERSION=5.3 -RUN apk --update add \ - gmp \ - mpfr-dev \ - eigen \ - zlib && \ - apk --update add --virtual .cgal-deps \ - make \ - gcc \ - gmp-dev \ - mpfr-dev \ - eigen-dev \ - zlib-dev \ - g++ \ - git \ - cmake \ - linux-headers && \ - cd /tmp && \ +ARG CGAL_VERSION=5.4 +RUN cd /tmp && \ + apt-get install -y libboost-system-dev libboost-thread-dev libgmp-dev libmpfr-dev zlib1g-dev && \ wget https://github.com/CGAL/cgal/releases/download/v${CGAL_VERSION}/CGAL-${CGAL_VERSION}.tar.xz && \ tar xf CGAL-${CGAL_VERSION}.tar.xz && \ cd CGAL-${CGAL_VERSION} && \ - mkdir build && \ - cd build && \ - cmake \ - -DBoost_NO_BOOST_CMAKE=ON \ - -DBoost_NO_SYSTEM_PATHS=ON \ - -DBOOST_ROOT=/usr/local \ - -DCMAKE_BUILD_TYPE=Release \ - -DWITH_examples=OFF \ - -DWITH_demos=OFF \ - -DWITH_CGAL_Core=ON \ - -DWITH_CGAL_Qt5=OFF \ - -DWITH_CGAL_ImageIO=OFF \ - .. && \ - make -j $JOBS && \ - make install && \ - cd ~ && \ - apk del .cgal-deps && \ - rm -rf /tmp/* && \ - rm -rf /user/local/man && \ - for i in /usr/local/lib64/libCGAL*; do strip -s $i 2>/dev/null || /bin/true; done - -## -## 6 Install SFCGAL -## -#ARG SFCGAL_VERSION=1.3.10 -#RUN apk --update add \ -# gmp \ -# mpfr4 \ -# zlib && \ -# apk --update add --virtual .sfcgal-deps \ -# make \ -# gcc \ -# gmp-dev \ -# mpfr-dev \ -# zlib-dev \ -# g++ \ -# cmake \ -# linux-headers && \ -# cd /tmp && \ -# wget https://gitlab.com/Oslandia/SFCGAL/-/archive/v${SFCGAL_VERSION}/SFCGAL-v${SFCGAL_VERSION}.tar.gz && \ -# tar xvfz SFCGAL-v${SFCGAL_VERSION}.tar.gz && \ -# cd SFCGAL-v${SFCGAL_VERSION} && \ -# mkdir build && \ -# cd build && \ -# cmake \ -# -DBoost_NO_BOOST_CMAKE=TRUE \ -# -DBoost_NO_SYSTEM_PATHS=TRUE \ -# -DBOOST_ROOT=/usr/local \ -# .. && \ -# make && \ -# make install && \ -# cd ~ && \ -# apk del .sfcgal-deps && \ -# rm -rf /tmp/* && \ -# rm -rf /user/local/man && \ -# for i in /usr/local/lib64/libSFCGAL*; do strip -s $i 2>/dev/null || /bin/true; done - -# -# 7 Install PostGIS -# -ARG POSTGIS_VERSION=3.1.4 -# RUN ln -sf /usr/local/lib64/libSFCGAL.so /usr/local/lib && \ -RUN apk --update add \ - curl \ - nghttp2 \ - zlib \ - zstd \ - xz \ - icu \ - bzip2 \ - mpfr4 \ - perl \ - json-c \ - libxml2 \ - sqlite \ - postgresql && \ - apk --update add --virtual .postgis-deps \ - curl-dev \ - nghttp2-dev \ - zlib-dev \ - zstd-dev \ - xz-dev \ - icu-dev \ - bzip2-dev \ - mpfr-dev \ - git \ - make \ - wget \ - gcc \ - g++ \ - file \ - perl-dev \ - json-c-dev \ - libxml2-dev \ - sqlite-dev \ - postgresql-dev \ - tiff-dev \ - portablexdr-dev \ - linux-headers && \ - cd /tmp && \ - wget http://download.osgeo.org/postgis/source/postgis-${POSTGIS_VERSION}.tar.gz && \ - tar xzf postgis-${POSTGIS_VERSION}.tar.gz && \ - cd postgis-${POSTGIS_VERSION} && \ - ./configure \ - --without-raster \ - --without-topology \ - --without-address-standardizer \ - --without-phony-revision \ - --without-protobuf && \ - make -j $JOBS && \ - make install && \ - cd ~ && \ - apk del .postgis-deps && \ - rm -rf /tmp/* && \ - rm -rf /user/local/man + mkdir build && cd build && \ + cmake .. -DCMAKE_BUILD_TYPE=Release && \ + cmake --build . --parallel $JOBS --config Release && \ + cmake --install . && \ + rm -rf /tmp/* -# -# 8 Install GDAL -# -ARG GDAL_VERSION=3.4.0 -RUN apk --update add \ - xz-dev \ - zstd-dev \ - sqlite-dev \ - postgresql-dev \ - portablexdr-dev && \ - apk --update add --virtual .gdal-deps \ - make \ - gcc \ - g++ \ - file \ - linux-headers && \ - cd /tmp && \ +ARG FGDB_VERSION=1.5.2 +ARG GDAL_VERSION=3.6.2 +RUN cd /tmp && \ + git clone https://github.com/Esri/file-geodatabase-api.git && \ + tar -xf file-geodatabase-api/FileGDB_API_${FGDB_VERSION}/FileGDB_API-RHEL7-64gcc83.tar.gz && \ + rm -rf /tmp/FileGDB_API-RHEL7-64gcc83/lib/libstdc++.so* && \ + mv /tmp/FileGDB_API-RHEL7-64gcc83 /usr/local/src/FileGDB && \ + ln -s /usr/local/src/FileGDB/lib/libFileGDBAPI.so /usr/local/lib/libFileGDBAPI.so && \ + ln -s /usr/local/src/FileGDB/lib/libfgdbunixrtl.so /usr/local/lib/libfgdbunixrtl.so && \ + ldconfig && \ wget http://download.osgeo.org/gdal/${GDAL_VERSION}/gdal-${GDAL_VERSION}.tar.gz && \ - tar xzf gdal-${GDAL_VERSION}.tar.gz && \ - rm -f gdal-${GDAL_VERSION}.tar.gz && \ + tar -zxvf gdal-${GDAL_VERSION}.tar.gz && \ cd gdal-${GDAL_VERSION} && \ - ./configure \ - PQ_CFLAGS="-I/usr/include/postgresql" \ - PQ_LIBS="-L/usr/lib/postgresql14 -lpq" \ - CFLAGS="-g -O3" \ - CXXFLAGS="-g -O3" \ - --enable-lto && \ - make -j $JOBS && \ - make install && \ - cd ~ && \ - apk del .gdal-deps && \ - rm -rf /tmp/* && \ - rm -rf /user/local/man && \ - for i in /usr/local/lib/libgdal*; do strip -s $i 2>/dev/null || /bin/true; done && \ - for i in /usr/local/bin/gdal*; do strip -s $i 2>/dev/null || /bin/true; done + mkdir build && cd build && \ + cmake .. -DCMAKE_BUILD_TYPE=Release -DENABLE_IPO=OFF -DFileGDB_ROOT=/usr/local/src/FileGDB -DBUILD_TESTING=OFF && \ + cmake --build . --parallel $JOBS --config Release && \ + cmake --install . && \ + ldconfig && \ + rm -rf /tmp/* -# -# 9 Install nlohmann JSON -# -ARG JSON_VERSION=3.10.5 -RUN apk --update add --virtual .json-deps \ - make \ - gcc \ - g++ \ - file \ - cmake \ - linux-headers && \ - cd /tmp && \ - wget -O json-${JSON_VERSION}.tar.gz https://github.com/nlohmann/json/archive/refs/tags/v${JSON_VERSION}.tar.gz && \ - tar xzf json-${JSON_VERSION}.tar.gz && \ - rm -f json-${JSON_VERSION}.tar.gz && \ - cd json-${JSON_VERSION} && \ - mkdir build && \ - cd build && \ - cmake \ - -DJSON_BuildTests=OFF \ - .. && \ - make && \ - make install && \ - cd ~ && \ - apk del .json-deps && \ - rm -rf /tmp/* && \ - rm -rf /user/local/man \ No newline at end of file +RUN ldconfig diff --git a/builder-ubuntu.dockerfile b/builder-ubuntu.dockerfile deleted file mode 100644 index aac6ba5..0000000 --- a/builder-ubuntu.dockerfile +++ /dev/null @@ -1,67 +0,0 @@ -FROM balazsdukai/geoflow-bundle-base:2023.03.15 -ARG VERSION -LABEL org.opencontainers.image.authors="Balázs Dukai " -LABEL org.opencontainers.image.vendor="3DGI" -LABEL org.opencontainers.image.title="geoflow-bundle-builder-ubuntu" -LABEL org.opencontainers.image.description="Builder image for building the geoflow executable with all of its plugins for building reconstruction." -LABEL org.opencontainers.image.version=$VERSION -LABEL org.opencontainers.image.licenses="(GPL-3 OR AGPL-3)" - -ARG JOBS -ARG geoflow_src="/usr/src/geoflow-bundle" -# Because explicit is better than defaults -ARG GF_PLUGIN_FOLDER="/usr/local/lib/geoflow-plugins" - -# Debug dependencies and need bash for stripping the image -RUN apt-get update && apt-get install -y gdb bash - -# Only copy what's needed for the build so the docker image build is faster -COPY ./cmake $geoflow_src/cmake -COPY ./flowcharts $geoflow_src/flowcharts -COPY ./geoflow $geoflow_src/geoflow -COPY ./plugins $geoflow_src/plugins -COPY ./CMakeLists.txt ./strip-docker-image-export $geoflow_src/ - -# Need to explicitly create the plugin directory -RUN chmod 1777 $geoflow_src && \ - cd $geoflow_src && \ - mkdir -p $GF_PLUGIN_FOLDER && \ - mkdir -p build && cd build && \ - cmake .. \ - -DCMAKE_BUILD_TYPE=Release \ - -DGF_BUILD_GUI=OFF \ - -DGF_PLUGIN_FOLDER=$GF_PLUGIN_FOLDER && \ - cmake --build . --parallel $JOBS --config Release -# Split the install from the build, because it makes easier to debug installation issues -RUN cd $geoflow_src/build && cmake --install . -# Do not clean up $geoflow_src here, so that the build cache is not invalidated unless -# the files have really changed. - -# Check geoflow -RUN echo $(geof -p) - -# So that CLion can install the cmake target when run in a docker container, because -# CLion maps the host UID as the container user -RUN chmod -R a+w $GF_PLUGIN_FOLDER - -# -# Export the dependencies -# -# maybe needs all transformation files from /usr/local/share/proj/ ? -# maybe needs the pkgconfig files for gdal and proj from /usr/local/lib/pkgconfig/ ? -RUN mkdir /export && \ - bash $geoflow_src/strip-docker-image-export \ - -v \ - -d /export \ - -f /usr/local/share/proj/proj.db \ - -f /usr/local/bin/geof \ - -f $GF_PLUGIN_FOLDER/gfp_buildingreconstruction.so \ - -f $GF_PLUGIN_FOLDER/gfp_core_io.so \ - -f $GF_PLUGIN_FOLDER/gfp_gdal.so \ - -f $GF_PLUGIN_FOLDER/gfp_val3dity.so \ - -f $GF_PLUGIN_FOLDER/gfp_las.so -RUN mkdir --parents "/export/usr/local/geoflow-flowcharts/gfc-lod13" "/export/usr/local/geoflow-flowcharts/gfc-brecon" - -#ARG UID=1000 -#RUN useradd -m -u ${UID} -s /bin/bash builder -#USER builder \ No newline at end of file diff --git a/builder.dockerfile b/builder.dockerfile index 3cd1b2f..c9968de 100644 --- a/builder.dockerfile +++ b/builder.dockerfile @@ -1,224 +1,67 @@ -FROM balazsdukai/geoflow-bundle-base:latest +FROM 3dgi/geoflow-bundle-base:2023.03.15 ARG VERSION LABEL org.opencontainers.image.authors="Balázs Dukai " LABEL org.opencontainers.image.vendor="3DGI" -LABEL org.opencontainers.image.title="geoflow-bundle-builder" +LABEL org.opencontainers.image.title="geoflow-bundle-builder-ubuntu" LABEL org.opencontainers.image.description="Builder image for building the geoflow executable with all of its plugins for building reconstruction." LABEL org.opencontainers.image.version=$VERSION +LABEL org.opencontainers.image.licenses="(GPL-3 OR AGPL-3)" ARG JOBS -ARG INSTALL_PREFIX="/usr/local" -ARG GF_PLUGIN_FOLDER="/usr/local/geoflow-plugins" -ARG GF_FLOWCHART_FOLDER="/usr/local/geoflow-flowcharts" -ARG root="/tmp" -ARG geoflow_dir="$root/geoflow" -ARG plugins_dir="$root/plugins" -ARG flowcharts_dir="$root/flowcharts" +ARG geoflow_src="/usr/src/geoflow-bundle" +# Because explicit is better than defaults +ARG GF_PLUGIN_FOLDER="/usr/local/lib/geoflow-plugins" -RUN mkdir $GF_PLUGIN_FOLDER && \ - mkdir --parents $GF_FLOWCHART_FOLDER/gfc-lod13 +# Debug dependencies and need bash for stripping the image +RUN apt-get update && apt-get install -y gdb bash -COPY .git $root/.git -COPY .gitmodules $root +# Only copy what's needed for the build so the docker image build is faster +COPY ./cmake $geoflow_src/cmake +COPY ./flowcharts $geoflow_src/flowcharts +COPY ./geoflow $geoflow_src/geoflow +COPY ./plugins $geoflow_src/plugins +COPY ./CMakeLists.txt ./strip-docker-image-export $geoflow_src/ -# -# 1 Install Geoflow -# -# Need to build geoflow in the project directory instead of a 'build' directory, because for some reason cmake takes -# the build dir as root, but it should take the project dir as root. This is not really how it should be. -COPY geoflow $geoflow_dir -RUN apk --update add --virtual .geoflow-deps \ - make \ - gcc \ - g++ \ - cmake \ - git \ - linux-headers && \ - cd $geoflow_dir && \ - git submodule update --init --recursive && \ - cmake . \ - -DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX \ - -DGF_PLUGIN_FOLDER=$GF_PLUGIN_FOLDER \ - -DGF_BUILD_GUI=OFF \ - -DCMAKE_BUILD_TYPE=Release && \ - cmake \ - --build $geoflow_dir \ - --parallel $JOBS \ - --config Release && \ - make install && \ - cd ~ && \ - rm -rf $geoflow_dir && \ - rm -rf /user/local/man && \ - geof --help - -# -# 2 Plugin: GDAL -# -COPY plugins/gfp-gdal $plugins_dir/gfp-gdal -RUN apk --update add --virtual .gdal-deps \ - make \ - gcc \ - g++ \ - cmake \ - git \ - linux-headers && \ - cd $plugins_dir/gfp-gdal && \ - git submodule update --init --recursive && \ - mkdir $plugins_dir/gfp-gdal/build_docker && \ - cd $plugins_dir/gfp-gdal/build_docker && \ - cmake .. \ - -DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX \ - -DCMAKE_BUILD_TYPE=Release && \ - cmake \ - --build . \ - --parallel $JOBS \ - --config Release && \ - cp gfp_gdal.so $GF_PLUGIN_FOLDER && \ - cd ~ && \ - rm -rf $plugins_dir/gfp-gdal && \ - rm -rf /user/local/man - -# -# 3 Plugin: val3dity -# -COPY plugins/gfp-val3dity $plugins_dir/gfp-val3dity -RUN apk --update add --virtual .val3dity-deps \ - gmp-dev \ - mpfr-dev \ - eigen-dev \ - make \ - gcc \ - g++ \ - cmake \ - git \ - linux-headers && \ - cd $plugins_dir/gfp-val3dity && \ - git submodule update --init --recursive && \ - mkdir $plugins_dir/gfp-val3dity/build_docker && \ - cd $plugins_dir/gfp-val3dity/build_docker && \ - cmake .. \ - -DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX \ - -DCMAKE_BUILD_TYPE=Release && \ - cmake \ - --build . \ - --parallel $JOBS \ - --config Release && \ - cp gfp_val3dity.so $GF_PLUGIN_FOLDER && \ - cd ~ && \ - rm -rf $plugins_dir/gfp-val3dity && \ - rm -rf /user/local/man - -# -# 4 Plugin: basic3d -# -COPY plugins/gfp-basic3d $plugins_dir/gfp-basic3d -RUN apk --update add --virtual .basic3d-deps \ - make \ - gcc \ - g++ \ - cmake \ - git \ - linux-headers && \ - cd $plugins_dir/gfp-basic3d && \ - git submodule update --init --recursive && \ - mkdir $plugins_dir/gfp-basic3d/build_docker && \ - cd $plugins_dir/gfp-basic3d/build_docker && \ +# Need to explicitly create the plugin directory +RUN chmod 1777 $geoflow_src && \ + cd $geoflow_src && \ + mkdir -p $GF_PLUGIN_FOLDER && \ + mkdir -p build && cd build && \ cmake .. \ - -DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX \ - -DCMAKE_BUILD_TYPE=Release && \ - cmake \ - --build . \ - --parallel $JOBS \ - --config Release && \ - cp gfp_core_io.so $GF_PLUGIN_FOLDER && \ - cd ~ && \ - rm -rf $plugins_dir/gfp-basic3d && \ - rm -rf /user/local/man + -DCMAKE_BUILD_TYPE=Release \ + -DGF_BUILD_GUI=OFF \ + -DGF_PLUGIN_FOLDER=$GF_PLUGIN_FOLDER && \ + cmake --build . --parallel $JOBS --config Release +# Split the install from the build, because it makes easier to debug installation issues +RUN cd $geoflow_src/build && cmake --install . +# Do not clean up $geoflow_src here, so that the build cache is not invalidated unless +# the files have really changed. -# -# 5 Plugin: building-reconstruction -# -COPY plugins/gfp-building-reconstruction $plugins_dir/gfp-building-reconstruction -RUN apk --update add --virtual .building-reconstruction-deps \ - gmp-dev \ - mpfr-dev \ - eigen-dev \ - make \ - gcc \ - g++ \ - cmake \ - git \ - linux-headers && \ - cd $plugins_dir/gfp-building-reconstruction && \ - git submodule update --init --recursive && \ - mkdir $plugins_dir/gfp-building-reconstruction/build_docker && \ - cd $plugins_dir/gfp-building-reconstruction/build_docker && \ - cmake .. \ - -DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX \ - -DCMAKE_BUILD_TYPE=Release \ - -DGFP_WITH_PDAL=OFF \ - -DGFP_WITH_LOD2=ON && \ - cmake \ - --build . \ - --parallel $JOBS \ - --config Release && \ - cp gfp_buildingreconstruction.so $GF_PLUGIN_FOLDER && \ - cd ~ && \ - rm -rf $plugins_dir/gfp-building-reconstruction && \ - rm -rf /user/local/man - -# -# 6 Plugin: LAS -# -COPY plugins/gfp-las $plugins_dir/gfp-las -RUN cd $plugins_dir/gfp-las && \ - git submodule update --init --recursive && \ - mkdir $plugins_dir/gfp-las/build_docker && \ - cd $plugins_dir/gfp-las/build_docker && \ - cmake .. \ - -DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX \ - -DCMAKE_BUILD_TYPE=Release && \ - cmake \ - --build . \ - --parallel $JOBS \ - --config Release && \ - cp gfp_las.so $GF_PLUGIN_FOLDER && \ - cd ~ && \ - rm -rf $plugins_dir/gfp-las && \ - rm -rf /user/local/man +# Check geoflow +RUN echo $(geof -p) -# Debug dependencies -RUN apk add gdb - -# -# Clean up -# - -#RUN apk del .building-reconstruction-deps && \ -# apk del .basic3d-deps && \ -# apk del .val3dity-deps && \ -# apk del .gdal-deps && \ -# apk del .geoflow-deps - -RUN rm -rf /tmp && \ - mkdir /tmp && \ - chmod 1777 /tmp -# Needed for stripping the image -RUN apk --update add bash +# So that CLion can install the cmake target when run in a docker container, because +# CLion maps the host UID as the container user +RUN chmod -R a+w $GF_PLUGIN_FOLDER # # Export the dependencies # -RUN mkdir /export -COPY strip-docker-image-export /tmp -RUN bash /tmp/strip-docker-image-export \ +# maybe needs all transformation files from /usr/local/share/proj/ ? +# maybe needs the pkgconfig files for gdal and proj from /usr/local/lib/pkgconfig/ ? +RUN mkdir /export && \ + bash $geoflow_src/strip-docker-image-export \ -v \ -d /export \ -f /usr/local/share/proj/proj.db \ -f /usr/local/bin/geof \ - -f /usr/local/geoflow-plugins/gfp_buildingreconstruction.so \ - -f /usr/local/geoflow-plugins/gfp_core_io.so \ - -f /usr/local/geoflow-plugins/gfp_gdal.so \ - -f /usr/local/geoflow-plugins/gfp_val3dity.so \ - -f /usr/local/geoflow-plugins/gfp_las.so -RUN mkdir --parents "/export/usr/local/geoflow-flowcharts/gfc-lod13" "/export/usr/local/geoflow-flowcharts/gfc-brecon" \ No newline at end of file + -f $GF_PLUGIN_FOLDER/gfp_buildingreconstruction.so \ + -f $GF_PLUGIN_FOLDER/gfp_core_io.so \ + -f $GF_PLUGIN_FOLDER/gfp_gdal.so \ + -f $GF_PLUGIN_FOLDER/gfp_val3dity.so \ + -f $GF_PLUGIN_FOLDER/gfp_las.so +RUN mkdir --parents "/export/usr/local/geoflow-flowcharts/gfc-lod13" "/export/usr/local/geoflow-flowcharts/gfc-brecon" + +#ARG UID=1000 +#RUN useradd -m -u ${UID} -s /bin/bash builder +#USER builder \ No newline at end of file