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 3
/
Dockerfile
91 lines (76 loc) · 2.86 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
### 1. STAGE (BUILD)
# Ubuntu 16.04 LTS with Baseimage and Runit
FROM phusion/baseimage:0.10.1 AS builder
WORKDIR /app/mapping-core
# copy files
COPY cmake cmake
COPY conf conf
COPY docker-files docker-files
COPY src src
COPY test test
COPY CMakeLists.txt 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 OpenCL
RUN chmod +x docker-files/install-opencl-build.sh && \
docker-files/install-opencl-build.sh
# install MAPPING dependencies
RUN chmod +x docker-files/ppas.sh && \
docker-files/ppas.sh && \
python3 docker-files/read_dependencies.py docker-files/dependencies.csv "build dependencies" \
| xargs -d '\n' -- apt-get install --yes
# Build MAPPING
RUN cmake -DCMAKE_BUILD_TYPE=Release . && \
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 docker-files /app/docker-files
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 && \
# 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 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 && \
# 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 && \
# 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 mountable volumes
VOLUME /app/gdalsources_data \
/app/gdalsources_description \
# /app/userdb.sqlite \
# /app/conf/settings.toml \
/app/ogrsources_data \
/app/ogrsources_description
# Use baseimage-docker's init system.
CMD ["/sbin/my_init"]