-
-
Notifications
You must be signed in to change notification settings - Fork 29
/
Dockerfile
62 lines (42 loc) · 1.5 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
# builder image for node-postal (requires c++ toolchain and python3)
FROM pelias/libpostal_baseimage as builder
ENV WORKDIR /code/pelias/interpolation
WORKDIR ${WORKDIR}
# install dependencies for node-postal build
RUN apt-get update && apt-get install -y python3 build-essential
COPY --chown=pelias ./package.json ${WORKDIR}
RUN npm install
# base image
FROM pelias/libpostal_baseimage
# interpolation dependencies
RUN apt-get update && \
apt-get install -y sqlite3 gdal-bin lftp unzip pigz time gawk && \
rm -rf /var/lib/apt/lists/*
# change working dir
ENV WORKDIR /code/pelias/interpolation
WORKDIR ${WORKDIR}
RUN chown -R pelias /code
# de-escalate to non-root user
USER pelias
# copy npm dependencies from builder image
COPY --chown=pelias --from=builder $WORKDIR/node_modules node_modules/
# add the code
COPY --chown=pelias . ${WORKDIR}
# run a quick test that libpostal and node-postal are fully working
RUN node test/test_libpostal.js
# run tests
RUN npm test && npm run funcs && rm -rf test
# location where the db files will be created
ENV BUILDDIR '/data/interpolation'
# location of the openstreetmap data
ENV OSMPATH '/data/openstreetmap'
# location of the polylines data
ENV POLYLINEPATH '/data/polylines'
# location of the openaddresses data
ENV OAPATH '/data/openaddresses'
# location of TIGER data
ENV TIGERPATH '/data/tiger'
# root location of data files
ENV WORKINGDIR '/data'
# entrypoint
CMD [ "./interpolate", "server", "/data/interpolation/address.db", "/data/interpolation/street.db" ]