forked from webknjaz/docker-freecad-cli
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
167 lines (144 loc) · 4.71 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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
FROM ubuntu:16.04 AS base
MAINTAINER Sviatoslav Sydorenko <[email protected]>
ENV PYTHON_VERSION 3.7.2
ENV PYTHON_MINOR_VERSION 3.7
ENV PYTHON_SUFFIX_VERSION .cpython-37m
ENV PYTHON_BIN_VERSION python3.7m
# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
ENV PYTHON_PIP_VERSION 18.1
ENV FREECAD_VERSION master
ENV FREECAD_REPO git://github.com/FreeCAD/FreeCAD.git
FROM base as builder
RUN \
pack_build="git \
wget \
build-essential \
cmake \
libtool \
libxerces-c-dev \
libboost-dev \
libboost-filesystem-dev \
libboost-regex-dev \
libboost-program-options-dev \
libboost-signals-dev \
libboost-thread-dev \
libboost-python-dev \
libqt4-dev \
libqt4-opengl-dev \
qt4-dev-tools \
liboce-modeling-dev \
liboce-visualization-dev \
liboce-foundation-dev \
liboce-ocaf-lite-dev \
liboce-ocaf-dev \
oce-draw \
libeigen3-dev \
libqtwebkit-dev \
libode-dev \
libzipios++-dev \
libfreetype6 \
libfreetype6-dev \
netgen-headers \
libmedc-dev \
libvtk6-dev \
libffi-dev \
libproj-dev \
gmsh " \
&& apt update \
&& apt install -y --no-install-recommends software-properties-common \
&& apt update \
&& apt install -y --no-install-recommends $pack_build
FROM builder AS python_builder
ENV GPG_KEY 0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D
RUN set -ex \
\
&& wget -O python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" \
&& wget -O python.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" \
&& export GNUPGHOME="$(mktemp -d)" \
&& gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEY" \
&& gpg --batch --verify python.tar.xz.asc python.tar.xz \
&& { command -v gpgconf > /dev/null && gpgconf --kill all || :; } \
&& rm -rf "$GNUPGHOME" python.tar.xz.asc \
&& mkdir -p /usr/src/python \
&& tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \
&& rm python.tar.xz \
\
&& cd /usr/src/python \
&& gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \
&& ./configure \
--build="$gnuArch" \
--enable-loadable-sqlite-extensions \
--enable-shared \
--with-system-expat \
--with-system-ffi \
--without-ensurepip \
&& make -j "$(nproc)" \
&& make install \
&& ldconfig \
\
&& 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 -rf /usr/src/python \
\
&& python3 --version
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
RUN cd /usr/local/bin \
&& ln -s python3 python
FROM python_builder AS clone_freecad
# get FreeCAD Git
RUN \
cd \
&& git clone --branch "$FREECAD_VERSION" "$FREECAD_REPO"
FROM clone_freecad AS compile_fc
ENV PYTHONPATH "/usr/local/lib:$PYTHONPATH"
RUN \
cd \
&& 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 \
&& ln -s /usr/local/bin/FreeCAD /usr/bin/freecad-git
# Clean
RUN apt-get clean \
&& rm /var/lib/apt/lists/* \
/usr/share/doc/* \
/usr/share/locale/* \
/usr/share/man/* \
/usr/share/info/* -fR