forked from amrit3701/docker-freecad-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
151 lines (137 loc) · 4.89 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
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
150
151
# Adaptation from the great work in https://github.com/amrit3701/docker-freecad-cli
FROM ubuntu:18.04
LABEL maintainer="Licínio Carvalho <https://github.com/LCNCC>"
ENV DEBIAN_FRONTEND noninteractive
ENV PYTHON_VERSION 3.8.5
ENV PYTHON_MINOR_VERSION 3.8
ENV PYTHON_SUFFIX_VERSION .cpython-38
ENV PYTHON_BIN_VERSION python3.8
# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
ENV PYTHON_PIP_VERSION 18.0
# # By branch
# ENV FREECAD_VERSION master
ENV FREECAD_VERSION releases/FreeCAD-0-19
ENV FREECAD_REPO git://github.com/FreeCAD/FreeCAD.git
# python3.8-distutils https://github.com/deadsnakes/issues/issues/82
RUN \
pack_build="git \
python$PYTHON_MINOR_VERSION \
python$PYTHON_MINOR_VERSION-dev \
python$PYTHON_MINOR_VERSION-distutils \
wget \
build-essential \
cmake \
libtool \
libboost-dev \
libboost-date-time-dev \
libboost-filesystem-dev \
libboost-graph-dev \
libboost-iostreams-dev \
libboost-program-options-dev \
libboost-python-dev \
libboost-regex-dev \
libboost-serialization-dev \
libboost-signals-dev \
libboost-thread-dev \
libqt4-dev \
libqt4-opengl-dev \
qt4-dev-tools \
libqtwebkit-dev \
libocct-data-exchange-dev \
libocct-draw-dev \
libocct-foundation-dev \
libocct-modeling-algorithms-dev \
libocct-modeling-data-dev \
libocct-ocaf-dev \
libocct-visualization-dev \
occt-draw \
libeigen3-dev \
libgts-bin \
libgts-dev \
libkdtree++-dev \
libmedc-dev \
libopencv-dev \
libproj-dev \
libvtk7-dev \
libxerces-c-dev \
libzipios++-dev \
libode-dev \
libfreetype6 \
libfreetype6-dev \
netgen-headers \
netgen \
libmetis-dev \
gmsh " \
&& apt update \
&& apt install -y --no-install-recommends software-properties-common \
&& add-apt-repository -y ppa:deadsnakes/ppa \
&& add-apt-repository -y ppa:freecad-maintainers/freecad-stable \
&& apt update \
&& apt install -y --no-install-recommends $pack_build
RUN set -ex; \
\
wget -O get-pip.py 'https://bootstrap.pypa.io/get-pip.py'; \
\
python$PYTHON_MINOR_VERSION get-pip.py \
--disable-pip-version-check \
--no-cache-dir \
"pip==$PYTHON_PIP_VERSION" \
; \
pip --version; \
\
find /usr/local -depth \
\( \
\( -type d -a \( -name test -o -name tests \) \) \
-o \
\( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \
\) -exec rm -rf '{}' +; \
rm -f get-pip.py
ENV PYTHONPATH "/usr/local/lib:$PYTHONPATH"
RUN \
# get FreeCAD Git
cd \
&& git clone --branch "$FREECAD_VERSION" "$FREECAD_REPO" \
&& mkdir freecad-build \
&& cd freecad-build \
# Build
&& cmake \
-DBUILD_GUI=OFF \
-DBUILD_QT5=OFF \
-DPYTHON_EXECUTABLE=/usr/bin/$PYTHON_BIN_VERSION \
-DPYTHON_INCLUDE_DIR=/usr/include/$PYTHON_BIN_VERSION \
-DPYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/lib${PYTHON_BIN_VERSION}.so \
-DPYTHON_BASENAME=$PYTHON_SUFFIX_VERSION \
-DPYTHON_SUFFIX=$PYTHON_SUFFIX_VERSION \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_FEM_NETGEN=ON ../FreeCAD \
\
&& make -j$(nproc) \
&& make install \
&& cd \
\
# Clean
&& rm FreeCAD/ freecad-build/ -fR
# Install GUI libraries that require to import Draft, Arch modules.
RUN pip${PYTHON_MINOR_VERSION} install PySide2
RUN pip${PYTHON_MINOR_VERSION} install six
RUN \
ln -s \
/usr/local/lib/python${PYTHON_MINOR_VERSION}/dist-packages/PySide2 \
/usr/local/lib/python${PYTHON_MINOR_VERSION}/dist-packages/PySide
# Fixing issue with the exportIFC.py file
COPY ArchRoof.py /usr/local/Mod/Arch/ArchRoof.py
# Fixed import MeshPart module due to missing libnglib.so
# https://bugs.launchpad.net/ubuntu/+source/freecad/+bug/1866914
RUN echo "/usr/lib/x86_64-linux-gnu/netgen" >> /etc/ld.so.conf.d/x86_64-linux-gnu.conf
RUN ldconfig
# Make Python already know all FreeCAD modules / workbenches.
ENV FREECAD_STARTUP_FILE /.startup.py
RUN echo "import FreeCAD\n" > ${FREECAD_STARTUP_FILE}
ENV PYTHONSTARTUP ${FREECAD_STARTUP_FILE}
# Clean
RUN apt-get clean \
&& rm /var/lib/apt/lists/* \
/usr/share/doc/* \
/usr/share/locale/* \
/usr/share/man/* \
/usr/share/info/* -fR