-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathDockerfile
47 lines (35 loc) · 1.28 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
# builder image
FROM pelias/baseimage as builder
# libpostal apt dependencies
# note: this is done in one command in order to keep down the size of intermediate containers
RUN apt-get update && \
apt-get install -y build-essential autoconf automake libtool pkg-config python3
# clone libpostal
RUN git clone https://github.com/openvenues/libpostal /code/libpostal
WORKDIR /code/libpostal
# install libpostal
RUN ./bootstrap.sh
# https://github.com/openvenues/libpostal/pull/632#issuecomment-1648303654
ARG TARGETARCH
RUN if [ "$TARGETARCH" = "arm64" ]; then \
./configure --datadir='/usr/share/libpostal' --disable-sse2; \
else \
./configure --datadir='/usr/share/libpostal'; \
fi
# compile
RUN make -j4
RUN DESTDIR=/libpostal make install
RUN ldconfig
# copy address_parser executable
RUN cp /code/libpostal/src/.libs/address_parser /libpostal/usr/local/bin/
# -------------------------------------------------------------
# main image
FROM pelias/baseimage
# copy data
COPY --from=builder /usr/share/libpostal /usr/share/libpostal
# copy build
COPY --from=builder /libpostal /
# ensure /usr/local/lib is on LD_LIBRARY_PATH
ENV LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH"
# test model / executable load correctly
RUN echo '12 example lane, example' | address_parser