From 87cd4a1ac02f15084e84f9e946287afe512e1f34 Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Tue, 21 May 2024 15:52:47 +0200 Subject: [PATCH] feat(docker): improved exposing of libs/headers/executables --- Dockerfile | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8f5a9eb..a642fd5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,21 +16,32 @@ RUN ./bootstrap.sh # https://github.com/openvenues/libpostal/pull/632#issuecomment-1648303654 ARG TARGETARCH RUN if [ "$TARGETARCH" = "arm64" ]; then \ - ./configure --prefix='/libpostal' --datadir='/usr/share/libpostal' --disable-sse2; \ + ./configure --datadir='/usr/share/libpostal' --disable-sse2; \ else \ - ./configure --prefix='/libpostal' --datadir='/usr/share/libpostal'; \ + ./configure --datadir='/usr/share/libpostal'; \ fi +# compile RUN make -j4 -RUN make install +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 --from=builder /libpostal /libpostal -COPY --from=builder /code/libpostal/src/.libs/address_parser /libpostal/bin/address_parser -# test model / executables load correctly -RUN /libpostal/bin/address_parser <<< '12 example lane, example' +# copy build +COPY --from=builder /libpostal / + +# ensure /usr/local/lib 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