-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile.ddd
153 lines (114 loc) · 5.23 KB
/
Dockerfile.ddd
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
# ddd - DDD123
# Library for simple scene modelling.
# Jose Juan Montes and Contributors 2020-2023
#FROM ubuntu:20.04
# Last version using ubuntu-focal (20.04)
FROM linuxserver/blender:3.3.1
# Update apt-get and install common packages
RUN apt-get -y update --fix-missing
# Upgrade Packages
#RUN DEBIAN_FRONTEND=noninteractive apt-get -y upgrade
# This adds support for locales and avoid Python3 using POSIX with no UTF8 support as default,
# which causes issues with some UTF-8 JSON encoded files
RUN apt-get install -y language-pack-en
#RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && locale-gen
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y \
curl sqlite3 \
python3.8 python3.8-venv nodejs
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y \
gdal-bin gdal-data libgdal-dev
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y \
git cmake build-essential python3.8-dev gfortran
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y \
bzip2 libboost-dev libexpat1-dev zlib1g-dev libbz2-dev liblz4-dev \
libcairo2 osmctools osmium-tool \
dict-freedict-spa-eng
# Install blender for CSG operations
# Blender "avoids" releasing through standard means, and snaps are difficult to use in docker, so here we use a 3rd party PPA
# Still, this install 2.92.0 and we use 3.6 in development
# RUN DEBIAN_FRONTEND=noninteractive apt-get install -y software-properties-common
# RUN DEBIAN_FRONTEND=noninteractive add-apt-repository ppa:thomas-schiex/blender -y
# RUN DEBIAN_FRONTEND=noninteractive apt-get update
# RUN DEBIAN_FRONTEND=noninteractive apt-get install -y "blender=2.92.0--release~103106-02948a2cab4+nano+optix+kernels-0thomas~focal2"
# Install npm
WORKDIR /tmp
## 16.13.0
#ENV NODE_VERSION=18
#RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
#ENV NVM_DIR=/root/.nvm
#RUN . "$NVM_DIR/nvm.sh" && nvm install ${NODE_VERSION}
#RUN . "$NVM_DIR/nvm.sh" && nvm use v${NODE_VERSION}
#RUN . "$NVM_DIR/nvm.sh" && nvm alias default v${NODE_VERSION}
#ENV PATH="/root/.nvm/versions/node/v${NODE_VERSION}/bin/:${PATH}"
# Not needed with linuxserver/blender:3.3.1
#RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends npm
# Check Node and NPM
RUN node --version
RUN npm --version
# Install osmtogeojson
WORKDIR /root
RUN git clone https://github.com/tyrasd/osmtogeojson/
WORKDIR /root/osmtogeojson
RUN npm install
# Install draco
RUN mkdir /root/ddd-gltf-draco
COPY files/draco/package.json /root/ddd-gltf-draco
WORKDIR /root/ddd-gltf-draco
RUN npm install
WORKDIR /tmp
# Prepare DDD environment
# DDD files are copied later to improve docker build cache reuse
RUN mkdir /root/ddd
WORKDIR /root/ddd
RUN python3 -m venv venv
ENV PATH="/root/ddd/venv/bin:$PATH"
RUN pip install pip --upgrade
# Install pyembree which requires upgrading setuptools and NumPy, earlier.
# Pip will comply about this dependency being in conflict, but trimesh/pyembree still work in our use cases.
RUN pip install 'pyembree==0.2.11'
# Setuptools setuptools<61.0.0,>=60.9.3 is required by 'pyembree'
# Pinned <58.0.0 for GDAL as per:
# - https://github.com/pypa/setuptools/issues/2781
# - https://stackoverflow.com/questions/69123406/error-building-pygdal-unknown-distribution-option-use-2to3-fixers-and-use-2
RUN python3 -m pip install --upgrade --no-cache-dir setuptools==58.0.4
#RUN env/bin/pip install 'setuptools == 58.0.2'
#RUN env/bin/pip install 'setuptools >=56,<58.0.0'
#RUN env/bin/pip install 'setuptools <61.0.0,>=60.9.3'
#RUN env/bin/pip install 'setuptools == 60.10.0'
# Wheel is required for Pygdal, and later for Rtree install by Trimesh
RUN python3 -m pip install --upgrade --no-cache-dir wheel requests
# GDAL needs to be installed after numpy (https://gis.stackexchange.com/questions/153199/import-error-no-module-named-gdal-array)
# Using numpy < 1.20 due to our usage (via trimesh) of deprecated numpy features (https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations)
RUN pip install 'numpy < 1.20'
# Install pygdal
RUN python3 -m pip install --no-cache-dir pygdal==3.0.4.*
#RUN CPLUS_INCLUDE_PATH=/usr/include/gdal/ C_INCLUDE_PATH=/usr/include/gdal/ env/bin/pip install GDAL==3.0.4
# Trimesh depends on scipy and scikit-image and will install a newer version (which requires Python 3.7), install our pinned version before.
# These would upgrade numpy above 1.20
#RUN pip install 'scipy < 1.6.0'
#RUN pip install 'scikit-image < 0.18.0'
RUN pip install 'numpy<1.20' 'scipy<1.6.0' 'scikit-image<0.18.0'
# Chardet <4.0 required by aiohttp
#RUN env/bin/pip install 'chardet < 4.0'
# Copy ddd files (note this will not copy hidden files starting with ., such as .git)
RUN mkdir -p /tmp/files
COPY files/ddd/ /tmp/files/ddd
RUN cp -a /tmp/files/ddd/* /root/ddd/
# Install ddd (in develop mode)
WORKDIR /root/ddd
RUN python3 setup.py develop
# Downgrade trimesh, it was upgraded, and seems newer versions dont support 'extras' in 'add_geometry'
RUN pip install 'trimesh[all] == 3.15.1'
# Copy configuration...
COPY files/ddd.conf /root/.ddd.conf
# Workdir
WORKDIR /root/ddd
# Cleanup
RUN rm -rf /tmp/files
# Default docker command
#CMD /bin/bash
#ENTRYPOINT ["/root/ddd/env/bin/ddd"]
CMD ["/root/ddd/env/bin/ddd"]