-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
149 lines (135 loc) · 5.12 KB
/
Dockerfile
File metadata and controls
149 lines (135 loc) · 5.12 KB
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
FROM ubuntu:20.04
# NOTE: This Dockerfile works with version v1.1.0 of Analysis Situs (requiring OCC 7.4.0)
# The development branch of Analysis Situs requires a newer version of OCC
###############################################################################
#
# - OpenCascade: this is the geometric modeling kernel which provides the
# essential services such as B-rep modeling & shape
# interrogation, data exchange, shape healing, etc.
# https://github.com/Open-Cascade-SAS/OCCT
#
# - Analysis Situs: the open-source CAD platform providing the feature recognition
# services, data model, VTK-based visualization services for
# CAD models, and GUI/scripting prototyping framework.
# https://gitlab.com/ssv/AnalysisSitus
#
# - Eigen: linear algebra, vectors, matrices.
# https://eigen.tuxfamily.org/index.php?title=Main_Page
#
# - Rapidjson: output to JSON and export to glTF (Analysis Situs).
# https://rapidjson.org
#
# Ex. to build:
# > docker build --pull --rm -f "Dockerfile" -t analysis-situs:latest "." --no-cache
###############################################################################
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update
RUN apt-get -y install build-essential git cmake wget
# Installing QT
# =============
RUN apt-get -y install qtcreator qt5-default
RUN apt-get -y install libqt5x11extras5-dev
RUN apt-get -y install qttools5-dev
# Building VTK
# ============
# VTK dependencies
RUN apt-get -y install libxt-dev libgl1-mesa-dev
# Clone our fork of VTK-8.2, and build it
WORKDIR /home
RUN wget https://gitlab.com/ssv/vtk-analysis-situs/-/archive/master/vtk-analysis-situs-master.zip
RUN unzip ./vtk-analysis-situs-master.zip -d /home
RUN mv /home/vtk-analysis-situs-master /home/VTK-8.2.0
WORKDIR /home/VTK-8.2.0
RUN mkdir build
WORKDIR /home/VTK-8.2.0/build
RUN cmake .. \
-DVTK_Group_Qt=ON \
-DVTK_QT_VERSION=5 \
-DVTK_RENDERING_BACKEND=OpenGL2 \
-DVTK_Group_Imaging=YES \
-DVTK_Group_Qt=YES \
-DVTK_Group_Views=YES \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr
RUN make -j8
RUN make -j8 install
# Building OpenCascade
# ====================
# Opencascade dependencies
RUN apt-get install -y tcl tcl-dev tk tk-dev libfreeimage-dev
RUN apt-get install -y libxmu-dev libxi-dev
RUN apt-get install -y libglfw3-dev libgl1-mesa-dev libglu1-mesa-dev libosmesa6-dev
# Following dependencies might only be needed in a docker image, not on a host
RUN apt-get install -y libqt5gui5 && rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -y xvfb
# OpenCascade
RUN mkdir /home/opencascade
WORKDIR /home/opencascade
RUN wget https://github.com/Open-Cascade-SAS/OCCT/archive/refs/tags/V7_6_0.tar.gz
RUN tar zxvf V7_6_0.tar.gz
RUN mkdir /home/opencascade/OCCT-7_6_0/build
WORKDIR /home/opencascade/OCCT-7_6_0/build
RUN cmake .. \
-DCMAKE_BUILD_TYPE=release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DUSE_FREEIMAGE=ON
RUN make -j8
RUN make -j8 install
# Installing Freetype
# ===================
RUN apt-get install -y libfreetype6-dev
# Building Analysis Situs
# =======================
# Copy sources of Analysis Situs
COPY cmake /as/cmake
COPY src /as/src
COPY data /as/data
COPY asiExe.sh /as
COPY asiExeOffscreen.sh /as
COPY asiExeServer.sh /as
COPY CMakeLists.txt /as
# Analysis Situs dependencies
RUN apt-get -y install libeigen3-dev rapidjson-dev
# Hack: symlink the VTK build/lib directory to /usr/lib/vtk-8.2, as the VTK installation doesn't seem to
# copy its files to the /usr/lib directory
RUN ln -s /home/VTK-8.2.0/build/lib /usr/lib/vtk-8.2
# Analysis Situs
WORKDIR /as
RUN mkdir -p build
WORKDIR /as/build
RUN cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr/local \
-DCMAKE_INSTALL_RPATH="" \
-DINSTALL_DIR=/usr/local/bin/analysissitus \
-DDISTRIBUTION_TYPE=Complete \
-D3RDPARTY_DIR=/usr/lib \
-D3RDPARTY_OCCT_INCLUDE_DIR=/usr/include/opencascade \
-D3RDPARTY_OCCT_LIBRARY_DIR=/usr/lib \
-D3RDPARTY_EIGEN_DIR=/usr/include/eigen3/ \
-D3RDPARTY_QT_DIR_NAME=/usr/lib/qt5/ \
-D3RDPARTY_tcl_DIR=/usr/lib/x86_64-linux-gnu \
-D3RDPARTY_tcl_INCLUDE_DIR=/usr/include/tcl8.6 \
-D3RDPARTY_tcl_LIBRARY_DIR=/usr/lib/x86_64-linux-gnu \
-D3RDPARTY_vtk_DIR=/usr \
-D3RDPARTY_vtk_INCLUDE_DIR=/usr/include/vtk-8.2 \
-D3RDPARTY_vtk_LIBRARY_DIR=/usr/lib/vtk-8.2 \
-D3RDPARTY_freetype_DIR=/usr \
-D3RDPARTY_freetype_INCLUDE_DIR=/usr/include/freetype2 \
-D3RDPARTY_freetype_LIBRARY_DIR=/usr/lib/x86_64-linux-gnu \
-D3RDPARTY_freeimage_DIR=/usr \
-D3RDPARTY_freeimage_INCLUDE_DIR=/usr/include \
-D3RDPARTY_freeimage_LIBRARY_DIR=/usr/lib \
-DUSE_MOBIUS=off \
-DUSE_INSTANT_MESHES=off \
-DUSE_RAPIDJSON=off \
-DUSE_NETGEN=off \
-DUSE_THREADING=off \
-D3RDPARTY_DIR=/usr/lib
RUN make -j8
RUN make -j8 install
WORKDIR /usr/local/bin/analysissitus/bin
### Run with: docker run --rm -it -e DISPLAY=192.168.1.42:0.0 analysis-situs:latest
### Headless run:
### ./asiExeOffscreen.sh "/runcommand='make-box a 0 0 0 1 1 1; set-as-part a; save-step s.stp'"