-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
task/WG-285: update potree converter (#218)
* Rework worker Dockerfile and bump PotreeConverter * Fix docker compose commands * Update and improve custom html template * Activate conda when starting bash on running container * Add an additional test * Improve nginx.conf to allow range requests for potree bin files * Fix adding of nsf_logo.png * Fix unit test * Add vim package * Do not need to install laszip * Clean up dockerfile * Update deployed nginx.conf to allow range requests for potree bin files * Simplify entrypoint script * Refactor oder of Dockerfile * Fix nginx.conf so range requests work on Firefox * Remove unused background image in template Also, fixes nsf log snippet application. * Improve comment * Fix PYTHONPATH * Fix .bin settings * Unify how some settings are set * Lower max body size This was high as we used to support direct file upload instead of using TAPIS * Improve error handling to log memory issues
- Loading branch information
1 parent
526f9ce
commit f50e8e9
Showing
10 changed files
with
206 additions
and
139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,92 @@ | ||
FROM pdal/pdal:2.4.2 | ||
FROM ubuntu:22.04 | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
RUN apt-get update && apt-get install -y \ | ||
libtiff-dev libgeotiff-dev libgdal-dev \ | ||
libboost-system-dev libboost-thread-dev libboost-filesystem-dev \ | ||
libboost-program-options-dev libboost-regex-dev libboost-iostreams-dev \ | ||
git cmake build-essential python3.9 python3-pip python3-dev ffmpeg \ | ||
unzip git wget libc6-dev gcc-multilib | ||
vim \ | ||
libtiff-dev \ | ||
libgeotiff-dev \ | ||
libgdal-dev \ | ||
libboost-system-dev \ | ||
libboost-thread-dev \ | ||
libboost-filesystem-dev \ | ||
libboost-program-options-dev \ | ||
libboost-regex-dev \ | ||
libboost-iostreams-dev \ | ||
git \ | ||
cmake \ | ||
build-essential \ | ||
python3.9 \ | ||
python3-pip \ | ||
python3-dev \ | ||
ffmpeg \ | ||
unzip \ | ||
wget \ | ||
libc6-dev \ | ||
libtbb-dev\ | ||
libcgal-dev | ||
|
||
WORKDIR /opt | ||
|
||
RUN git clone --depth 1 https://github.com/m-schuetz/LAStools.git && cd LAStools/LASzip && mkdir build && cd build && \ | ||
cmake -DCMAKE_BUILD_TYPE=Release .. && make && make install && ldconfig | ||
|
||
RUN git clone -b develop https://github.com/potree/PotreeConverter.git && cd PotreeConverter && git checkout 685ef56a7864ea2a9781b2ab61580f11f0983d29 && \ | ||
# Install PotreeConverter | ||
# c2328c4 is v2.1.1 and some additional fixes | ||
RUN git clone -b develop https://github.com/potree/PotreeConverter.git && cd PotreeConverter && git checkout c2328c4 && \ | ||
mkdir build && cd build && \ | ||
cmake -DCMAKE_BUILD_TYPE=Release -DLASZIP_INCLUDE_DIRS=/opt/LAStools/LASzip/dll/ -DLASZIP_LIBRARY=/usr/local/lib/liblaszip.so .. && \ | ||
make && make install && cp -r /opt/PotreeConverter/PotreeConverter/resources /resources | ||
ADD devops/misc/potree/page_template /resources/page_template | ||
cmake .. -DCMAKE_BUILD_TYPE=Release && \ | ||
make | ||
|
||
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 2 | ||
# Setup our page template for PotreeConverter | ||
ADD devops/misc/potree/page_template/nsf_logo.png /opt/PotreeConverter/build/resources/page_template/ | ||
ADD devops/misc/potree/page_template/nsf_logo_snippet.txt /tmp/ | ||
# - add nsf logo | ||
RUN sed -i '/<body>/r /tmp/nsf_logo_snippet.txt' /opt/PotreeConverter/build/resources/page_template/viewer_template.html | ||
# - remove reference to background image | ||
RUN sed -i 's/style="[^"]*background-image:[^"]*"//' /opt/PotreeConverter/build/resources/page_template/viewer_template.html | ||
|
||
RUN pip3 install --upgrade pip | ||
|
||
ENV POETRY_VERSION=1.8.3 | ||
ENV POETRY_HOME=/opt/poetry | ||
ENV PATH="$POETRY_HOME/bin:$PATH" | ||
RUN curl -sSL https://install.python-poetry.org | python3 - | ||
RUN poetry config virtualenvs.create false | ||
COPY devops/pyproject.toml devops/poetry.lock ./ | ||
# Install Miniforge for our Python environment (provides easier PDAL installation) | ||
RUN wget -q -O miniforge.sh https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-$(uname -m).sh && \ | ||
sh miniforge.sh -b -p /opt/conda && \ | ||
rm miniforge.sh | ||
ENV PATH="/opt/conda/bin:${PATH}" | ||
|
||
WORKDIR /opt | ||
# Create a conda environment with Python 3.9 and activate it | ||
RUN conda create -n py39env python=3.9 -y | ||
SHELL ["conda", "run", "-n", "py39env", "/bin/bash", "-c"] | ||
|
||
# install geos into condo the base pdal image is using | ||
RUN conda install setuptools geos -y -n base | ||
# Install PDAL using conda | ||
RUN conda install -c conda-forge pdal -y | ||
|
||
# Install needed python packages using poetry | ||
RUN pip install poetry==1.8.3 | ||
RUN poetry config virtualenvs.create false | ||
COPY devops/pyproject.toml devops/poetry.lock ./ | ||
RUN poetry install | ||
|
||
ENV PYTHONPATH "${PYTHONPATH}:/app" | ||
|
||
WORKDIR / | ||
# Populate image with geoapi and set PYTHONPATH | ||
RUN mkdir app | ||
COPY geoapi /app/geoapi | ||
WORKDIR /app/geoapi | ||
ENV PYTHONPATH=/app | ||
|
||
# Create an entrypoint script that activates our conda environment | ||
RUN echo '#!/bin/bash' > /usr/local/bin/entrypoint.sh && \ | ||
echo 'set -e' >> /usr/local/bin/entrypoint.sh && \ | ||
echo '' >> /usr/local/bin/entrypoint.sh && \ | ||
echo '# Activate conda and the specific environment' >> /usr/local/bin/entrypoint.sh && \ | ||
echo '. /opt/conda/etc/profile.d/conda.sh' >> /usr/local/bin/entrypoint.sh && \ | ||
echo 'conda activate py39env' >> /usr/local/bin/entrypoint.sh && \ | ||
echo '' >> /usr/local/bin/entrypoint.sh && \ | ||
echo '# Execute the passed command' >> /usr/local/bin/entrypoint.sh && \ | ||
echo 'exec "$@"' >> /usr/local/bin/entrypoint.sh && \ | ||
chmod +x /usr/local/bin/entrypoint.sh | ||
|
||
# Set the entrypoint | ||
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] | ||
|
||
# activate conda (to handle when user starts a bash via docker exec) | ||
RUN echo '. /opt/conda/etc/profile.d/conda.sh' >> /root/.bashrc && \ | ||
echo 'conda activate py39env' >> /root/.bashrc | ||
|
||
# Set a default command (can be overridden by docker-compose) | ||
CMD ["bash"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<div class="nsf_logo" style="position: absolute; z-index: 10000; right: 10px; bottom: 10px;"> | ||
<img src="./nsf_logo.png" /> | ||
</div> |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.