├── .dockerignore ├── Dockerfile ├── LICENSE └── Readme.md /.dockerignore: -------------------------------------------------------------------------------- 1 | .git 2 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM golang:1.17.8-buster 2 | 3 | ARG COMMIT 4 | ENV COMMIT ${COMMIT:-master} 5 | ENV DEBIAN_FRONTEND noninteractive 6 | 7 | RUN apt-get update && apt-get install -y \ 8 | autoconf automake build-essential curl git libsnappy-dev libtool pkg-config 9 | 10 | WORKDIR / 11 | RUN git clone https://github.com/openvenues/libpostal -b $COMMIT 12 | 13 | WORKDIR /libpostal 14 | 15 | COPY build_libpostal.sh . 16 | RUN ./build_libpostal.sh 17 | 18 | COPY build_libpostal_rest.sh . 19 | RUN ./build_libpostal_rest.sh 20 | 21 | EXPOSE 8080 22 | 23 | CMD /libpostal/workspace/bin/libpostal-rest 24 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 John Longanecker 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Readme.md: -------------------------------------------------------------------------------- 1 | # Libpostal REST Docker 2 | 3 | libpostal (https://github.com/openvenues/libpostal) is a C library for 4 | parsing and normalizing street addresses. Using libpostal requires 5 | compiling a C program that downloads ~2GB of training data. 6 | 7 | This Dockerfile automates that compilation and creates a container 8 | with libpostal and [libpostal-rest](https://github.com/johnlonganecker/libpostal-rest) libpostal-rest which allows for a simple REST API 9 | that makes it easy interact with libpostal. 10 | 11 | ## Build image and start up container 12 | ``` 13 | docker build -t libpostal-rest . 14 | docker run -d -p 8080:8080 libpostal-rest 15 | ``` 16 | 17 | ## Build image from specific libpostal git hash 18 | ``` 19 | docker build -t libpostal-rest --build-arg COMMIT=e816b4f77e8c6a7f35207ca77282ffab3712c5b6 . 20 | ``` 21 | 22 | **Works with branch names as well** 23 | ``` 24 | docker build -t libpostal-rest --build-arg COMMIT=parser-data . 25 | ``` 26 | 27 | If a commit/hash is not specified it defaults to the **master** branch 28 | 29 | ## Feature Requests and Bugs 30 | File a Github issue 31 | 32 | ## Contributing 33 | Just submit a pull request :D 34 | 35 | See REST API [here](https://github.com/johnlonganecker/libpostal-rest) 36 | --------------------------------------------------------------------------------