kopia lustrzana https://github.com/simonw/datasette
Dockerfile consistency and FTS5 detection
This makes sure the compile steps for the various libraries are done in only one layer. Also updates the query used to check for FTS5 as the old version wasn't detecting FTS5 for some reason.pull/280/head
rodzic
f7e89ad00b
commit
5cf78eded6
23
Dockerfile
23
Dockerfile
|
@ -2,33 +2,34 @@ FROM python:3.6-slim-stretch as build
|
||||||
|
|
||||||
# Setup build dependencies
|
# Setup build dependencies
|
||||||
RUN apt update \
|
RUN apt update \
|
||||||
&& apt install -y python3-dev build-essential wget libxml2 libxml2-dev libproj-dev libgeos-dev libsqlite3-dev zlib1g-dev pkg-config unzip \
|
&& apt install -y python3-dev build-essential wget libxml2-dev libproj-dev libgeos-dev libsqlite3-dev zlib1g-dev pkg-config \
|
||||||
&& apt clean
|
&& apt clean
|
||||||
|
|
||||||
|
|
||||||
RUN wget "https://www.sqlite.org/2018/sqlite-autoconf-3230100.tar.gz" && tar xzvf sqlite-autoconf-3230100.tar.gz \
|
RUN wget "https://www.sqlite.org/2018/sqlite-autoconf-3230100.tar.gz" && tar xzf sqlite-autoconf-3230100.tar.gz \
|
||||||
&& cd sqlite-autoconf-3230100 && ./configure --disable-static --enable-fts5 --enable-json1 CFLAGS="-g -O2 -DSQLITE_ENABLE_FTS3=1 -DSQLITE_ENABLE_FTS4=1 -DSQLITE_ENABLE_RTREE=1" \
|
&& cd sqlite-autoconf-3230100 && ./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" \
|
||||||
&& make && make install
|
&& make && make install
|
||||||
|
|
||||||
RUN wget "https://www.gaia-gis.it/gaia-sins/freexl-1.0.5.tar.gz" && tar zxvf freexl-1.0.5.tar.gz && cd freexl-1.0.5 && ./configure && make && make install
|
RUN wget "https://www.gaia-gis.it/gaia-sins/freexl-1.0.5.tar.gz" && tar zxf freexl-1.0.5.tar.gz \
|
||||||
|
&& cd freexl-1.0.5 && ./configure && make && make install
|
||||||
|
|
||||||
RUN wget "https://www.gaia-gis.it/gaia-sins/libspatialite-4.4.0-RC0.tar.gz" && tar zxvf libspatialite-4.4.0-RC0.tar.gz
|
RUN wget "https://www.gaia-gis.it/gaia-sins/libspatialite-4.4.0-RC0.tar.gz" && tar zxf libspatialite-4.4.0-RC0.tar.gz \
|
||||||
RUN cd libspatialite-4.4.0-RC0 && ./configure && make && make install
|
&& cd libspatialite-4.4.0-RC0 && ./configure && make && make install
|
||||||
|
|
||||||
RUN wget "https://www.gaia-gis.it/gaia-sins/readosm-1.1.0.tar.gz" && tar zxvf readosm-1.1.0.tar.gz && cd readosm-1.1.0 && ./configure && make && make install
|
RUN wget "https://www.gaia-gis.it/gaia-sins/readosm-1.1.0.tar.gz" && tar zxf readosm-1.1.0.tar.gz && cd readosm-1.1.0 && ./configure && make && make install
|
||||||
|
|
||||||
RUN wget "https://www.gaia-gis.it/gaia-sins/spatialite-tools-4.4.0-RC0.tar.gz" && tar zxvf spatialite-tools-4.4.0-RC0.tar.gz && cd spatialite-tools-4.4.0-RC0 && ./configure && make && make install
|
RUN wget "https://www.gaia-gis.it/gaia-sins/spatialite-tools-4.4.0-RC0.tar.gz" && tar zxf spatialite-tools-4.4.0-RC0.tar.gz \
|
||||||
|
&& cd spatialite-tools-4.4.0-RC0 && ./configure && make && make install
|
||||||
|
|
||||||
|
|
||||||
# Add local code to the image instead of fetching from pypi.
|
# Add local code to the image instead of fetching from pypi.
|
||||||
ADD . /datasette
|
COPY . /datasette
|
||||||
|
|
||||||
RUN pip install /datasette
|
RUN pip install /datasette
|
||||||
|
|
||||||
|
|
||||||
FROM python:3.6-slim-stretch
|
FROM python:3.6-slim-stretch
|
||||||
|
|
||||||
# Copy python dependencies
|
# Copy python dependencies and spatialite libraries
|
||||||
COPY --from=build /usr/local/lib/ /usr/local/lib/
|
COPY --from=build /usr/local/lib/ /usr/local/lib/
|
||||||
# Copy executables
|
# Copy executables
|
||||||
COPY --from=build /usr/local/bin /usr/local/bin
|
COPY --from=build /usr/local/bin /usr/local/bin
|
||||||
|
|
|
@ -377,7 +377,7 @@ class Datasette:
|
||||||
for fts in ("FTS5", "FTS4", "FTS3"):
|
for fts in ("FTS5", "FTS4", "FTS3"):
|
||||||
try:
|
try:
|
||||||
conn.execute(
|
conn.execute(
|
||||||
"CREATE VIRTUAL TABLE v{fts} USING {fts} (t TEXT)".format(fts=fts)
|
"CREATE VIRTUAL TABLE v{fts} USING {fts} (data)".format(fts=fts)
|
||||||
)
|
)
|
||||||
fts_versions.append(fts)
|
fts_versions.append(fts)
|
||||||
except sqlite3.OperationalError:
|
except sqlite3.OperationalError:
|
||||||
|
|
1
setup.py
1
setup.py
|
@ -38,7 +38,6 @@ setup(
|
||||||
'hupper==1.0',
|
'hupper==1.0',
|
||||||
'pint==0.8.1',
|
'pint==0.8.1',
|
||||||
'pluggy>=0.1.0,<1.0',
|
'pluggy>=0.1.0,<1.0',
|
||||||
'pysqlite3==0.1.4',
|
|
||||||
],
|
],
|
||||||
entry_points='''
|
entry_points='''
|
||||||
[console_scripts]
|
[console_scripts]
|
||||||
|
|
Ładowanie…
Reference in New Issue