/
Dockerfile
97 lines (79 loc) · 3.01 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
################################################################################
# base system
################################################################################
FROM ubuntu:18.04 as system
################################################################################
# builder
################################################################################
FROM system as builder
RUN apt-get update && apt-get install -y --no-install-recommends \
git \
ca-certificates `# essential for git over https` \
cmake \
build-essential \
automake pkgconf libtool bison flex python python-mako zlib1g-dev libexpat1-dev llvm-dev gettext \
libboost-dev
### OSMesa
RUN git clone -b mesa-18.3.4 --depth 1 https://gitlab.freedesktop.org/mesa/mesa
RUN cd mesa && \
NOCONFIGURE=1 ./autogen.sh && \
./configure \
--prefix=/opt/mesa \
--enable-opengl --disable-gles1 --disable-gles2 \
--disable-va --disable-xvmc --disable-vdpau \
--enable-shared-glapi \
--disable-texture-float \
--enable-gallium-llvm --enable-llvm-shared-libs \
--with-gallium-drivers=swrast,swr \
--disable-dri --with-dri-drivers= \
--disable-egl --with-egl-platforms= --disable-gbm \
--disable-glx \
--disable-osmesa --enable-gallium-osmesa && \
make -j"$(nproc)" && \
make -j"$(nproc)" install
ENV LD_LIBRARY_PATH "${LD_LIBRARY_PATH}:/opt/mesa/lib/"
### VTK
RUN git clone -b v8.1.2 --depth 1 https://gitlab.kitware.com/vtk/vtk.git
RUN mkdir -p VTK_build && \
cd VTK_build && \
cmake \
-DCMAKE_INSTALL_PREFIX=/opt/vtk/ \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=ON \
-DBUILD_TESTING=OFF \
-DVTK_Group_Qt=OFF \
-DVTK_Group_StandAlone=ON \
-DVTK_RENDERING_BACKEND=OpenGL2 \
-DVTK_OPENGL_HAS_OSMESA=ON \
-DOSMESA_INCLUDE_DIR=/opt/mesa/include \
-DOSMESA_LIBRARY=/opt/mesa/lib/libOSMesa.so \
-DVTK_USE_X=OFF \
-DModule_vtkInfovisBoostGraphAlgorithms=ON \
-DModule_vtkIOExport=ON \
../vtk && \
make -j"$(nproc)" && \
make -j"$(nproc)" install
### VTK-CLIs
COPY . /code/
RUN mkdir -p /build/ && \
cd /build/ && \
cmake \
-DCMAKE_INSTALL_PREFIX=/opt/VTK-CLIs/ \
-DCMAKE_PREFIX_PATH=/opt/vtk/lib/cmake/ \
-DCMAKE_BUILD_TYPE=Release \
/code/ && \
make -j"$(nproc)" && \
make -j"$(nproc)" install
################################################################################
# install
################################################################################
FROM system as install
COPY --from=builder /opt/vtk/ /opt/vtk/
COPY --from=builder /opt/mesa/ /opt/mesa/
COPY --from=builder /opt/VTK-CLIs/ /opt/VTK-CLIs/
RUN apt-get update && apt-get install -y --no-install-recommends \
libllvm6.0
ENV LD_LIBRARY_PATH "${LD_LIBRARY_PATH}:/opt/vtk/lib/"
ENV LD_LIBRARY_PATH "${LD_LIBRARY_PATH}:/opt/mesa/lib/"
ENV PATH "/opt/VTK-CLIs/bin/:${PATH}"
WORKDIR /data