Updated dockefiles to best practices ready for multi stage builds

Former-commit-id: b4062222cf
pull/1161/head
Ashley 2020-02-29 10:54:26 +10:00
rodzic 27704136b6
commit b88acf1f48
4 zmienionych plików z 47 dodań i 64 usunięć

Wyświetl plik

@ -12,3 +12,15 @@ odm_meshing
odm_georeferencing odm_georeferencing
images_resize images_resize
.git .git
/contrib
/docs
/hooks
/img
/license
/tests
tests.sh
settings.yml
code_of_conduct.md
configure_18_04.sh
index.html

Wyświetl plik

@ -1,18 +1,13 @@
FROM phusion/baseimage FROM phusion/baseimage as base
# Env variables # Env variables
ENV DEBIAN_FRONTEND noninteractive ENV DEBIAN_FRONTEND noninteractive
#Install dependencies and required requisites #Install dependencies and required requisites
RUN apt-get update -y \ RUN add-apt-repository -y ppa:ubuntugis/ubuntugis-unstable \
&& apt-get install -y \
software-properties-common \
&& add-apt-repository -y ppa:ubuntugis/ubuntugis-unstable \
&& add-apt-repository -y ppa:george-edison55/cmake-3.x \ && add-apt-repository -y ppa:george-edison55/cmake-3.x \
&& apt-get update -y && apt-get update -y \
&& apt-get install --no-install-recommends -y \
# All packages (Will install much faster)
RUN apt-get install --no-install-recommends -y \
build-essential \ build-essential \
cmake \ cmake \
gdal-bin \ gdal-bin \
@ -53,41 +48,30 @@ RUN apt-get install --no-install-recommends -y \
python-pip \ python-pip \
python-software-properties \ python-software-properties \
python-wheel \ python-wheel \
software-properties-common \
swig2.0 \ swig2.0 \
grass-core \ grass-core \
libssl-dev libssl-dev \
&& apt-get remove libdc1394-22-dev \
&& pip install --upgrade pip \
&& pip install setuptools
RUN apt-get remove libdc1394-22-dev
RUN pip install --upgrade pip
RUN pip install setuptools
# Prepare directories # Prepare directories
RUN mkdir /code
WORKDIR /code WORKDIR /code
# Copy repository files # Copy everything
COPY CMakeLists.txt /code/CMakeLists.txt COPY . ./
COPY configure.sh /code/configure.sh
COPY /modules/ /code/modules/
COPY /opendm/ /code/opendm/
COPY run.py /code/run.py
COPY run.sh /code/run.sh
COPY /stages/ /code/stages/
COPY /SuperBuild/cmake/ /code/SuperBuild/cmake/
COPY /SuperBuild/CMakeLists.txt /code/SuperBuild/CMakeLists.txt
COPY docker.settings.yaml /code/settings.yaml
COPY VERSION /code/VERSION
COPY requirements.txt /code/requirements.txt
RUN pip install -r requirements.txt RUN pip install -r requirements.txt
RUN pip install --upgrade cryptography && python -m easy_install --upgrade pyOpenSSL
ENV PYTHONPATH="$PYTHONPATH:/code/SuperBuild/install/lib/python2.7/dist-packages" ENV PYTHONPATH="$PYTHONPATH:/code/SuperBuild/install/lib/python2.7/dist-packages"
ENV PYTHONPATH="$PYTHONPATH:/code/SuperBuild/src/opensfm" ENV PYTHONPATH="$PYTHONPATH:/code/SuperBuild/src/opensfm"
ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/code/SuperBuild/install/lib" ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/code/SuperBuild/install/lib"
# Compile code in SuperBuild and root directories # Compile code in SuperBuild and root directories
RUN cd SuperBuild \ RUN rm -fr docker \
&& cd SuperBuild \
&& mkdir build \ && mkdir build \
&& cd build \ && cd build \
&& cmake .. \ && cmake .. \
@ -99,7 +83,8 @@ RUN cd SuperBuild \
&& make -j$(nproc) && make -j$(nproc)
# Cleanup APT # Cleanup APT
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* RUN apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Clean Superbuild # Clean Superbuild
RUN rm -rf \ RUN rm -rf \
@ -113,5 +98,4 @@ RUN rm -rf \
/code/SuperBuild/src/pdal /code/SuperBuild/src/pdal
# Entry point # Entry point
ENTRYPOINT ["python", "/code/run.py"] ENTRYPOINT ["python", "/code/run.py"]

Wyświetl plik

@ -1,18 +1,13 @@
FROM phusion/baseimage FROM phusion/baseimage as base
# Env variables # Env variables
ENV DEBIAN_FRONTEND noninteractive ENV DEBIAN_FRONTEND noninteractive
#Install dependencies and required requisites #Install dependencies and required requisites
RUN apt-get update -y \ RUN add-apt-repository -y ppa:ubuntugis/ubuntugis-unstable \
&& apt-get install -y \
software-properties-common \
&& add-apt-repository -y ppa:ubuntugis/ubuntugis-unstable \
&& add-apt-repository -y ppa:george-edison55/cmake-3.x \ && add-apt-repository -y ppa:george-edison55/cmake-3.x \
&& apt-get update -y && apt-get update -y \
&& apt-get install --no-install-recommends -y \
# All packages (Will install much faster)
RUN apt-get install --no-install-recommends -y \
build-essential \ build-essential \
cmake \ cmake \
gdal-bin \ gdal-bin \
@ -53,34 +48,23 @@ RUN apt-get install --no-install-recommends -y \
python-pip \ python-pip \
python-software-properties \ python-software-properties \
python-wheel \ python-wheel \
software-properties-common \
swig2.0 \ swig2.0 \
grass-core \ grass-core \
libssl-dev libssl-dev \
&& apt-get remove libdc1394-22-dev \
RUN apt-get remove libdc1394-22-dev && pip install --upgrade pip \
RUN pip install --upgrade pip && pip install setuptools
RUN pip install setuptools
# Prepare directories # Prepare directories
RUN mkdir /code
WORKDIR /code WORKDIR /code
# Copy repository files # Copy everything
COPY CMakeLists.txt /code/CMakeLists.txt COPY . ./
COPY configure.sh /code/configure.sh
COPY /modules/ /code/modules/
COPY /opendm/ /code/opendm/
COPY run.py /code/run.py
COPY run.sh /code/run.sh
COPY /stages/ /code/stages/
COPY /SuperBuild/cmake/ /code/SuperBuild/cmake/
COPY /SuperBuild/CMakeLists.txt /code/SuperBuild/CMakeLists.txt
COPY docker.settings.yaml /code/settings.yaml
COPY VERSION /code/VERSION
COPY requirements.txt /code/requirements.txt
RUN pip install -r requirements.txt RUN pip install -r requirements.txt \
RUN pip install --upgrade cryptography && python -m easy_install --upgrade pyOpenSSL && pip install --upgrade cryptography \
&& python -m easy_install --upgrade pyOpenSSL
ENV PYTHONPATH="$PYTHONPATH:/code/SuperBuild/install/lib/python2.7/dist-packages" ENV PYTHONPATH="$PYTHONPATH:/code/SuperBuild/install/lib/python2.7/dist-packages"
ENV PYTHONPATH="$PYTHONPATH:/code/SuperBuild/src/opensfm" ENV PYTHONPATH="$PYTHONPATH:/code/SuperBuild/src/opensfm"
@ -106,7 +90,8 @@ RUN cd SuperBuild \
&& make -j$(nproc) && make -j$(nproc)
# Cleanup APT # Cleanup APT
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* RUN apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Clean Superbuild # Clean Superbuild
RUN rm -rf \ RUN rm -rf \

Wyświetl plik

@ -16,3 +16,5 @@ pyproj==2.2.2
psutil==5.6.3 psutil==5.6.3
joblib==0.13.2 joblib==0.13.2
Fiona==1.8.9.post2 Fiona==1.8.9.post2
cryptography==2.8
pyOpenSSL==19.1.0