2019-01-13 23:33:50 +00:00
FROM python:3.7.2-slim-stretch as build
2017-11-15 03:08:04 +00:00
2017-11-17 03:50:51 +00:00
# Setup build dependencies
2018-05-23 17:43:34 +00:00
RUN apt update \
2019-01-13 23:09:48 +00:00
&& apt install -y python3-dev build-essential wget libxml2-dev libproj-dev libgeos-dev libsqlite3-dev zlib1g-dev pkg-config git \
2018-05-23 17:43:34 +00:00
&& apt clean
2020-03-06 06:15:19 +00:00
RUN wget "https://www.sqlite.org/2020/sqlite-autoconf-3310100.tar.gz" && tar xzf sqlite-autoconf-3310100.tar.gz \
&& cd sqlite-autoconf-3310100 && ./configure --disable-static --enable-fts5 --enable-json1 CFLAGS = "-g -O2 -DSQLITE_ENABLE_FTS3=1 -DSQLITE_ENABLE_FTS4=1 -DSQLITE_ENABLE_RTREE=1 -DSQLITE_ENABLE_JSON1" \
2018-05-23 17:43:34 +00:00
&& make && make install
2020-08-12 20:49:50 +00:00
RUN wget "http://www.gaia-gis.it/gaia-sins/freexl-sources/freexl-1.0.5.tar.gz" && tar zxf freexl-1.0.5.tar.gz \
2018-05-23 17:43:34 +00:00
&& cd freexl-1.0.5 && ./configure && make && make install
2020-08-12 20:49:50 +00:00
RUN wget "http://www.gaia-gis.it/gaia-sins/libspatialite-sources/libspatialite-4.4.0-RC0.tar.gz" && tar zxf libspatialite-4.4.0-RC0.tar.gz \
2018-05-23 17:43:34 +00:00
&& cd libspatialite-4.4.0-RC0 && ./configure && make && make install
2020-08-12 20:49:50 +00:00
RUN wget "http://www.gaia-gis.it/gaia-sins/readosm-sources/readosm-1.1.0.tar.gz" && tar zxf readosm-1.1.0.tar.gz && cd readosm-1.1.0 && ./configure && make && make install
2018-05-23 17:43:34 +00:00
2020-08-12 20:49:50 +00:00
RUN wget "http://www.gaia-gis.it/gaia-sins/spatialite-tools-sources/spatialite-tools-4.4.0-RC0.tar.gz" && tar zxf spatialite-tools-4.4.0-RC0.tar.gz \
2018-05-23 17:43:34 +00:00
&& cd spatialite-tools-4.4.0-RC0 && ./configure && make && make install
2017-11-17 03:50:51 +00:00
# Add local code to the image instead of fetching from pypi.
2018-05-23 17:43:34 +00:00
COPY . /datasette
2017-11-15 03:08:04 +00:00
2017-11-17 03:50:51 +00:00
RUN pip install /datasette
2017-11-15 03:08:04 +00:00
2019-01-13 23:33:50 +00:00
FROM python:3.7.2-slim-stretch
2017-11-17 03:50:51 +00:00
2018-05-23 17:43:34 +00:00
# Copy python dependencies and spatialite libraries
COPY --from= build /usr/local/lib/ /usr/local/lib/
2017-11-17 03:50:51 +00:00
# Copy executables
2017-11-15 03:08:04 +00:00
COPY --from= build /usr/local/bin /usr/local/bin
2017-11-17 03:50:51 +00:00
# Copy spatial extensions
COPY --from= build /usr/lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu
2017-11-15 03:08:04 +00:00
2018-05-23 17:43:34 +00:00
ENV LD_LIBRARY_PATH = /usr/local/lib
2017-11-15 03:08:04 +00:00
EXPOSE 8001
CMD [ "datasette" ]