Skip to content

Commit

Permalink
Fix up docker configuration issues (#3399)
Browse files Browse the repository at this point in the history
* Fix up docker configuration issues #3375

* updates
  • Loading branch information
hobu committed Apr 1, 2021
1 parent 1f00a08 commit 1a8965d
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 113 deletions.
74 changes: 24 additions & 50 deletions scripts/docker/ubuntu/Dockerfile
@@ -1,17 +1,14 @@
FROM pdal/ubuntubase:latest as builder
FROM pdal/ubuntubase:latest as build
MAINTAINER Andrew Bell <andrew@hobu.co>

SHELL ["/bin/bash", "-c"]
SHELL ["conda", "run", "-n", "pdal", "/bin/bash", "-c"]

RUN . /opt/conda/etc/profile.d/conda.sh && \
conda activate pdal && \
git clone http://github.com/PDAL/PDAL.git pdal

RUN . /opt/conda/etc/profile.d/conda.sh && \
conda activate pdal && \
RUN git clone http://github.com/PDAL/PDAL.git pdal && \
mkdir -p pdal/build && \
cd pdal/build && \
cmake -G Ninja \
LDFLAGS="-Wl,-rpath-link,$CONDA_PREFIX/lib" cmake -G Ninja \
-DCMAKE_LIBRARY_PATH:FILEPATH="$CONDA_PREFIX/lib" \
-DCMAKE_INCLUDE_PATH:FILEPATH="$CONDA_PREFIX/include" \
-DCMAKE_INSTALL_PREFIX=/usr \
-DBUILD_PLUGIN_CPD=OFF \
-DBUILD_PLUGIN_PGPOINTCLOUD=ON \
Expand All @@ -26,57 +23,34 @@ RUN . /opt/conda/etc/profile.d/conda.sh && \
-DWITH_LASZIP=ON \
..

RUN . /opt/conda/etc/profile.d/conda.sh && \
conda activate pdal && \
cd pdal/build && \
RUN cd pdal/build && \
ninja

RUN . /opt/conda/etc/profile.d/conda.sh && \
conda activate pdal && \
cd pdal/build && \
RUN cd pdal/build && \
ctest -V

RUN . /opt/conda/etc/profile.d/conda.sh && \
conda activate pdal && \
cd pdal/build && \
RUN cd pdal/build && \
ninja install

RUN apt-get -y remove unzip bzip2 gcc g++ ca-certificates && \
apt-get -y autoremove

RUN . /opt/conda/etc/profile.d/conda.sh && \
conda activate pdal && \
conda remove -c conda-forge git cmake ninja conda-forge-ci-setup

RUN rm /opt/conda/envs/pdal/lib/*.a && \
rm /opt/conda/envs/pdal/include/H5*.h && \
rm /opt/conda/envs/pdal/include/h5*.mod && \
rm /opt/conda/envs/pdal/include/tcl*.h && \
rm /opt/conda/envs/pdal/include/itcl*.h && \
rm /opt/conda/envs/pdal/include/tk*.h && \
rm -rf /opt/conda/envs/pdal/include/spatialite && \
rm -rf /opt/conda/envs/pdal/include/freetype2 && \
rm -rf /opt/conda/envs/pdal/include/informix && \
rm -rf /opt/conda/envs/pdal/include/fontconfig && \
rm -rf /opt/conda/envs/pdal/include/X11 && \
rm -rf /opt/conda/envs/pdal/lib/cmake
RUN conda-pack -n pdal --dest-prefix=/opt/conda/envs/pdal -o /tmp/env.tar && \
mkdir /venv && cd /venv && tar xf /tmp/env.tar && \
rm /tmp/env.tar

FROM continuumio/miniconda3

FROM ubuntu:bionic
ENV CONDAENV "/opt/conda/envs/pdal"
COPY --from=build /venv "/opt/conda/envs/pdal"

ARG PDAL_CONDA=/opt/conda/envs/pdal
ENV PROJ_NETWORK=TRUE
ENV PATH $PATH:${CONDAENV}/bin
ENV DTED_APPLY_PIXEL_IS_POINT=TRUE
ENV GTIFF_POINT_GEO_IGNORE=TRUE
ENV GTIFF_REPORT_COMPD_CS=TRUE
ENV REPORT_COMPD_CS=TRUE
ENV OAMS_TRADITIONAL_GIS_ORDER=TRUE

RUN apt-get update --fix-missing && \
apt-get install -y \
sudo ca-certificates && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
SHELL ["conda", "run", "--no-capture-output", "/bin/sh", "-c"]

COPY --from=builder /usr/ /usr/
COPY --from=builder /lib/ /lib/
COPY --from=builder /${PDAL_CONDA}/lib/ /usr/lib/
COPY --from=builder /${PDAL_CONDA}/include/ /usr/include/
COPY --from=builder /${PDAL_CONDA}/share/ /usr/share/

ENV GDAL_DATA=/usr/share/gdal
ENV PDAL_DRIVER_PATH=/usr/lib
ENV PROJ_LIB=/usr/share/proj
94 changes: 31 additions & 63 deletions scripts/docker/ubuntu/Dockerfile.dependencies
@@ -1,74 +1,42 @@
FROM ubuntu:bionic
FROM debian:buster-slim
MAINTAINER Andrew Bell<andrew@hobu.co>

SHELL ["/bin/bash", "-c"]
ENV CC gcc-6
ENV CXX g++-6
ENV LANG=C.UTF-8 LC_ALL=C.UTF-8

RUN apt-get update --fix-missing && \
apt-get install -y \
wget unzip bzip2 gcc-6 g++-6 ca-certificates curl && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
RUN apt-get update -q && \
apt-get install -q -y \
bzip2 \
ca-certificates \
git \
wget \
&& apt-get clean

RUN wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh && \
/bin/bash ~/miniconda.sh -b -p /opt/conda && \
rm ~/miniconda.sh && \
/opt/conda/bin/conda update -n base -c defaults conda && \
ENV PATH /opt/conda/bin:$PATH

CMD [ "/bin/bash" ]

# Leave these args here to better use the Docker build cache
ARG CONDA_VERSION=py38_4.9.2
ARG CONDA_MD5=122c8c9beb51e124ab32a0fa6426c656

RUN wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-${CONDA_VERSION}-Linux-x86_64.sh -O miniconda.sh && \
echo "${CONDA_MD5} miniconda.sh" > miniconda.md5 && \
if ! md5sum --status -c miniconda.md5; then exit 1; fi && \
mkdir -p /opt && \
sh miniconda.sh -b -p /opt/conda && \
rm miniconda.sh miniconda.md5 && \
ln -s /opt/conda/etc/profile.d/conda.sh /etc/profile.d/conda.sh && \
echo ". /opt/conda/etc/profile.d/conda.sh" >> ~/.profile && \
echo "conda activate base" >> ~/.profile
echo ". /opt/conda/etc/profile.d/conda.sh" >> ~/.bashrc && \
echo "conda activate base" >> ~/.bashrc && \
find /opt/conda/ -follow -type f -name '*.a' -delete && \
find /opt/conda/ -follow -type f -name '*.js.map' -delete && \
/opt/conda/bin/conda clean -afy

RUN . /opt/conda/etc/profile.d/conda.sh && \
conda create --yes --quiet --name pdal && \
conda activate pdal && \
conda install --yes --name pdal -c conda-forge git cmake ninja \
conda-forge-ci-setup && \
conda install --yes --name pdal -c conda-forge pdal --only-deps

RUN . /opt/conda/etc/profile.d/conda.sh && \
conda activate pdal && \
conda install --yes --name pdal -c conda-forge eigen

#
# We install fgt and cpd in /usr. By default they'll go in /usr/local.
# When in /usr/local, we'd have to run ldconfig in order for them to be found
# at run-time. This is an issue for the CPD filter and test. We could also
# put them in the conda directory and set the rpath when building the
# test. Probably better is just to stick this stuff in vendor and build
# as a static lib(s).
#
RUN . /opt/conda/etc/profile.d/conda.sh && \
conda activate pdal && \
git clone https://github.com/PDAL/fgt.git && \
mkdir -p fgt/build && \
cd fgt/build && \
cmake \
-DCMAKE_INSTALL_PREFIX=/usr \
-G Ninja .. && \
ninja install && \
cd / && \
rm -rf fgt

RUN . /opt/conda/etc/profile.d/conda.sh && \
conda activate pdal && \
git clone https://github.com/PDAL/cpd.git && \
mkdir -p cpd/build && \
cd cpd/build && \
cmake \
-DCMAKE_INSTALL_PREFIX=/usr \
-DWITH_FGT=ON \
-G Ninja .. && \
ninja install && \
cd / && \
rm -rf cpd
RUN conda create -n pdal -y && conda install -c conda-forge compilers conda-pack git cmake ninja && \
conda install --yes --name pdal -c conda-forge pdal --only-deps && \
conda install --yes --name pdal -c conda-forge conda jq

RUN \
mkdir gridzip && \
cd gridzip && \
curl -LOs http://download.osgeo.org/proj/proj-datumgrid-1.8.zip && unzip -j -u -o proj-datumgrid-1.8.zip -d /usr/share/proj && rm proj-datumgrid-1.8.zip ; \
curl -LOs http://download.osgeo.org/proj/proj-datumgrid-europe-1.2.zip && unzip -j -u -o proj-datumgrid-europe-1.2.zip -d /usr/share/proj && rm proj-datumgrid-europe-1.2.zip ; \
curl -LOs http://download.osgeo.org/proj/proj-datumgrid-oceania-1.0.zip && unzip -j -u -o proj-datumgrid-oceania-1.0.zip -d /usr/share/proj && rm proj-datumgrid-oceania-1.0.zip; \
curl -LOs http://download.osgeo.org/proj/proj-datumgrid-world-1.0.zip && unzip -j -u -o proj-datumgrid-world-1.0.zip -d /usr/share/proj && rm proj-datumgrid-world-1.0.zip; \
curl -LOs http://download.osgeo.org/proj/proj-datumgrid-north-america-1.2.zip && unzip -j -u -o proj-datumgrid-north-america-1.2.zip -d /usr/share/proj && rm proj-datumgrid-north-america-1.2.zip

0 comments on commit 1a8965d

Please sign in to comment.