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 24, 2024
1 parent 41fca9a commit 87cd4a1
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 87cd4a1

Please sign in to comment.