From 1e8f18ceae978464f3a263996915f02c6fbe8b1c 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 | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8f5a9eb..4465f16 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,9 +16,9 @@ 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 RUN make -j4 @@ -28,9 +28,19 @@ RUN ldconfig # main image FROM pelias/baseimage +# copy model COPY --from=builder /usr/share/libpostal /usr/share/libpostal -COPY --from=builder /libpostal /libpostal + +# copy libs +COPY --from=builder libpostal* /usr/local/lib/ /usr/local/lib/ +ENV LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH" + +# copy headers +COPY --from=builder /usr/local/include/libpostal/ /usr/local/include/libpostal/ + +# copy executables +COPY --from=builder /usr/local/bin/libpostal_data /libpostal/bin/libpostal_data 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' +RUN echo '12 example lane, example' | /libpostal/bin/address_parser