Skip to content

Commit

Permalink
feat(docker): improved exposing of libs/headers/executables
Browse files Browse the repository at this point in the history
  • Loading branch information
missinglink committed May 21, 2024
1 parent 41fca9a commit 1e8f18c
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

0 comments on commit 1e8f18c

Please sign in to comment.