This repository has been archived by the owner on Aug 2, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
144 lines (125 loc) · 5.06 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
### 1. STAGE (BUILD)
# Ubuntu 16.04 LTS with Baseimage and Runit
FROM phusion/baseimage:0.10.1 AS builder
# mapping core git branch
ARG MAPPING_CORE_VERSION=master
WORKDIR /app
# copy files
COPY cmake mapping-gfbio/cmake
COPY conf mapping-gfbio/conf
COPY docker-files mapping-gfbio/docker-files
COPY src mapping-gfbio/src
COPY test mapping-gfbio/test
COPY CMakeLists.txt mapping-gfbio/CMakeLists.txt
# set terminal to noninteractive
ARG DEBIAN_FRONTEND=noninteractive
# update packages and upgrade system
RUN apt-get update && \
apt-get upgrade --yes -o Dpkg::Options::="--force-confold"
# install git and grab mapping-core
RUN apt-get install --yes git && \
git clone --depth 1 --branch $MAPPING_CORE_VERSION https://github.com/umr-dbs/mapping-core.git
# install OpenCL
RUN chmod +x mapping-core/docker-files/install-opencl-build.sh && \
mapping-core/docker-files/install-opencl-build.sh
# install MAPPING dependencies
RUN chmod +x mapping-core/docker-files/ppas.sh && \
mapping-core/docker-files/ppas.sh && \
python3 mapping-core/docker-files/read_dependencies.py mapping-core/docker-files/dependencies.csv "build dependencies" \
| xargs -d '\n' -- apt-get install --yes
# install MAPPING GFBIO dependencies
RUN python3 mapping-core/docker-files/read_dependencies.py mapping-gfbio/docker-files/dependencies.csv "build dependencies" \
| xargs -d '\n' -- apt-get install --yes
# Build MAPPING
RUN cd mapping-core && \
cmake -DCMAKE_BUILD_TYPE=Release -DMAPPING_MODULES=mapping-gfbio . && \
make -j$(cat /proc/cpuinfo | grep processor | wc -l)
### 2. STAGE (RUNTIME)
# Ubuntu 16.04 LTS with Baseimage and Runit
FROM phusion/baseimage:0.10.1
WORKDIR /app
COPY --from=builder /app/mapping-core/target/bin /app
COPY --from=builder \
/app/mapping-core/docker-files \
/app/mapping-gfbio/docker-files \
/app/docker-files/
# set terminal to noninteractive
ARG DEBIAN_FRONTEND=noninteractive
RUN \
# update packages and upgrade system
apt-get update && \
apt-get upgrade --yes -o Dpkg::Options::="--force-confold" && \
# install OpenCL
chmod +x docker-files/install-opencl-runtime.sh && \
docker-files/install-opencl-runtime.sh && \
# install MAPPING dependencies
chmod +x docker-files/ppas.sh && \
docker-files/ppas.sh && \
python3 docker-files/read_dependencies.py docker-files/dependencies.csv "runtime dependencies" \
| xargs -d '\n' -- apt-get install --yes && \
# install MAPPING GFBIO dependencies
python3 docker-files/read_dependencies.py docker-files/gfbio-dependencies.csv "runtime dependencies" \
| xargs -d '\n' -- apt-get install --yes && \
# Make mountable files and give rights to www-data
chown www-data:www-data . && \
touch userdb.sqlite && \
chown www-data:www-data userdb.sqlite && \
mkdir rastersources && \
chown www-data:www-data rastersources && \
mkdir gdalsources_data && \
chown www-data:www-data gdalsources_data && \
mkdir gdalsources_description && \
chown www-data:www-data gdalsources_description && \
mkdir ogrsources_data && \
chown www-data:www-data ogrsources_data && \
mkdir ogrsources_description && \
chown www-data:www-data ogrsources_description && \
# Copy default config
cp docker-files/settings.toml /etc/mapping.conf && \
# module mounts
mkdir abcd_files && \
chown www-data:www-data abcd_files && \
# Make service available
mkdir --parents /etc/service/mapping/ && \
mv docker-files/mapping-service.sh /etc/service/mapping/run && \
chmod +x /etc/service/mapping/run && \
ln -sfT /dev/stderr /var/log/mapping.log && \
# Serve through apache httpd
apt-get install --yes apache2 && \
a2enmod proxy_fcgi && \
awk '{ if ($0 == "</VirtualHost>") print "\n\tProxyPass /cgi-bin/mapping_cgi fcgi://localhost:10100\n</VirtualHost>"; else print $0}' \
/etc/apache2/sites-enabled/000-default.conf > /etc/apache2/sites-enabled/tmp.conf && \
mv -f /etc/apache2/sites-enabled/tmp.conf /etc/apache2/sites-enabled/000-default.conf && \
# service apache2 restart && \
mkdir --parents /etc/service/apache/ && \
echo "#!/bin/sh\n\
\n\
set -e\n\
\n\
. /etc/apache2/envvars\
\n\
exec /usr/sbin/apache2 -f /etc/apache2/apache2.conf -DNO_DETACH 2>&1\n\
" > /etc/service/apache/run && \
mkdir /var/lock/apache2 && \
mkdir /var/run/apache2 && \
chmod +x /etc/service/apache/run && \
ln -sfT /dev/stdout /var/log/apache2/access.log && \
ln -sfT /dev/stderr /var/log/apache2/error.log && \
# Clean APT and install scripts
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /app/docker-files
# Make port 10100 available to the world outside this container
# EXPOSE 10100
EXPOSE 80
# Expose mountable volumes
VOLUME /app/rastersources \
/app/gdalsources_data \
/app/gdalsources_description \
# /app/userdb.sqlite \
# /app/conf/settings.toml \
/app/ogrsources_data \
/app/ogrsources_description \
# module mounts
/app/abcd_files
# Use baseimage-docker's init system.
CMD ["/sbin/my_init"]