Meshroom/docker/Dockerfile_ubuntu

84 lines
3.8 KiB
Text

ARG MESHROOM_VERSION
ARG AV_VERSION
ARG CUDA_VERSION
ARG UBUNTU_VERSION
FROM alicevision/meshroom-deps:${MESHROOM_VERSION}-av${AV_VERSION}-ubuntu${UBUNTU_VERSION}-cuda${CUDA_VERSION}
LABEL maintainer="AliceVision Team alicevision-team@googlegroups.com"
# Execute with nvidia docker (https://github.com/nvidia/nvidia-docker/wiki/Installation-(version-2.0))
# docker run -it --runtime nvidia -p 2222:22 --name meshroom -v</path/to/your/data>:/data alicevision/meshroom:develop-av2.2.8.develop-ubuntu20.04-cuda11.0
# ssh -p 2222 -X root@<docker host> /opt/Meshroom_bundle/Meshroom # Password is 'meshroom'
ENV MESHROOM_DEV=/opt/Meshroom \
MESHROOM_BUILD=/tmp/Meshroom_build \
MESHROOM_BUNDLE=/opt/Meshroom_bundle \
AV_INSTALL=/opt/AliceVision_install \
QT_DIR=/opt/Qt/6.6.3/gcc_64 \
PATH="${PATH}:${MESHROOM_BUNDLE}"
COPY *.txt *.md *.py ${MESHROOM_DEV}/
COPY ./docs ${MESHROOM_DEV}/docs
COPY ./meshroom ${MESHROOM_DEV}/meshroom
COPY ./tests ${MESHROOM_DEV}/tests
COPY ./bin ${MESHROOM_DEV}/bin
WORKDIR ${MESHROOM_DEV}
RUN python3 setup.py install_exe -d "${MESHROOM_BUNDLE}" && \
find ${MESHROOM_BUNDLE} -name "*Qt6Web*" -delete && \
find ${MESHROOM_BUNDLE} -name "*Qt6Designer*" -delete && \
rm -rf ${MESHROOM_BUNDLE}/lib/PySide6/typesystems/ \
${MESHROOM_BUNDLE}/lib/PySide6/examples/ \
${MESHROOM_BUNDLE}/lib/PySide6/include/ \
${MESHROOM_BUNDLE}/lib/PySide6/Qt/translations/ \
${MESHROOM_BUNDLE}/lib/PySide6/Qt/resources/ \
${MESHROOM_BUNDLE}/lib/PySide6/QtWeb* \
${MESHROOM_BUNDLE}/lib/PySide6/rcc \
${MESHROOM_BUNDLE}/lib/PySide6/designer
WORKDIR ${MESHROOM_BUILD}
# Build Meshroom plugins
RUN cmake "${MESHROOM_DEV}" -DALICEVISION_ROOT="${AV_INSTALL}" -DCMAKE_INSTALL_PREFIX="${MESHROOM_BUNDLE}/qtPlugins"
RUN make "-j$(nproc)" QtAliceVision
RUN make "-j$(nproc)" && \
rm -rf "${MESHROOM_BUILD}" "${MESHROOM_DEV}" \
${MESHROOM_BUNDLE}/aliceVision/share/doc \
${MESHROOM_BUNDLE}/aliceVision/share/eigen3 \
${MESHROOM_BUNDLE}/aliceVision/share/fonts \
${MESHROOM_BUNDLE}/aliceVision/share/lemon \
${MESHROOM_BUNDLE}/aliceVision/share/libraw \
${MESHROOM_BUNDLE}/aliceVision/share/man/ \
aliceVision/share/pkgconfig
# Download meshroomNodes and the models, install the requirements and set all the variables
WORKDIR ${MESHROOM_BUNDLE}
RUN git clone https://github.com/alicevision/meshroomNodes.git meshroomNodes
RUN pip install --upgrade setuptools
RUN pip install -r meshroomNodes/requirements.txt
RUN rm meshroomNodes/requirements.txt meshroomNodes/setup.py
ENV MESHROOM_NODES_PATH="${MESHROOM_BUNDLE}/meshroomNodes/meshroom/nodes"
ENV PYTHONPATH="${PYTHONPATH}:${MESHROOM_BUNDLE}/meshroomNodes"
RUN git clone https://gitlab.com/alicevision/imagepromptnnmodels.git imagePromptNNModels
RUN rm imagePromptNNModels/.gitattributes
ENV RDS_RECOGNITION_MODEL_PATH="${MESHROOM_BUNDLE}/imagePromptNNModels/models/ram_plus_swin_large_14m.pth"
ENV RDS_DETECTION_CONFIG_PATH="${MESHROOM_BUNDLE}/imagePromptNNModels/models/models/GroundingDINO_SwinT_OGC.py"
ENV RDS_DETECTION_MODEL_PATH="${MESHROOM_BUNDLE}/imagePromptNNModels/models/groundingdino_swint_ogc.pth"
ENV RDS_SEGMENTATION_MODEL_PATH="${MESHROOM_BUNDLE}/imagePromptNNModels/models/sam_vit_h_4b8939.pth"
ENV RDS_TOKENIZER_PATH="${MESHROOM_BUNDLE}/imagePromptNNModels/models/tokenizer"
ENV TRANSFORMERS_OFFLINE="TRUE"
# Enable SSH X11 forwarding, needed when the Docker image
# is run on a remote machine
RUN apt install ssh xauth && \
systemctl enable ssh && \
mkdir -p /run/sshd
RUN sed -i "s/^.*X11Forwarding.*$/X11Forwarding yes/; s/^.*X11UseLocalhost.*$/X11UseLocalhost no/; s/^.*PermitRootLogin prohibit-password/PermitRootLogin yes/; s/^.*X11UseLocalhost.*/X11UseLocalhost no/;" /etc/ssh/sshd_config
RUN echo "root:meshroom" | chpasswd
WORKDIR /root
EXPOSE 22
CMD ["/usr/sbin/sshd", "-D"]