|
1 | | -FROM ubuntu:bionic |
2 | | - |
3 | | -# Update system |
4 | | -RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections |
5 | | - |
6 | | -# Configure locales |
7 | | -RUN apt-get update -y && \ |
8 | | - apt-get install -y --no-install-recommends locales && \ |
9 | | - apt-get clean -y && \ |
10 | | - rm -rf /var/lib/apt/lists/* |
11 | | -ENV LANG en_US.UTF-8 |
12 | | -ENV LANGUAGE en_US:en |
13 | | -ENV LC_ALL en_US.UTF-8 |
14 | | -RUN locale-gen en_US.UTF-8 |
15 | | - |
16 | | -# Install necessary packages |
17 | | -RUN apt-get update -y && \ |
18 | | - apt-get install -y --no-install-recommends git pkg-config libtool automake autoconf make g++ liblzma-dev coreutils meson ninja-build wget zlib1g-dev libicu-dev libgumbo-dev libmagic-dev ca-certificates && \ |
19 | | - apt-get clean -y && \ |
20 | | - rm -rf /var/lib/apt/lists/* |
21 | | - |
22 | | -# Update CA certificates |
23 | | -RUN update-ca-certificates |
24 | | - |
25 | | -# Install Xapian (wget zlib1g-dev) |
26 | | -RUN wget https://oligarchy.co.uk/xapian/1.4.14/xapian-core-1.4.14.tar.xz |
27 | | -RUN tar xvf xapian-core-1.4.14.tar.xz |
28 | | -RUN cd xapian-core-1.4.14 && ./configure |
29 | | -RUN cd xapian-core-1.4.14 && make all install |
30 | | -RUN rm -rf xapian |
31 | | - |
32 | | -# Install zimlib (libicu-dev) |
33 | | -RUN git clone https://github.com/openzim/libzim.git |
34 | | -RUN cd libzim && git checkout 6.0.2 |
35 | | -RUN cd libzim && meson . build |
36 | | -RUN cd libzim && ninja -C build install |
37 | | -RUN rm -rf libzim |
38 | | - |
39 | | -RUN ldconfig |
40 | | -ENV LD_LIBRARY_PATH /usr/local/lib/x86_64-linux-gnu/ |
41 | | - |
42 | | -# Install python dependecies |
43 | | - |
44 | | -RUN apt-get update -y && \ |
45 | | - apt-get install -y --no-install-recommends python-dev python3-dev python3-pip && \ |
46 | | - apt-get clean -y && \ |
47 | | - rm -rf /var/lib/apt/lists/* |
48 | | - |
49 | | -# Install Cython |
50 | | - |
51 | | -RUN pip3 install Cython |
| 1 | +# A minimal runtime environment for python-libzim using pre-built releases. |
| 2 | +# Usage: |
| 3 | +# docker build . --tag openzim:python-libzim |
| 4 | +# docker run -it openzim:python-libzim |
| 5 | +# >>> from libzim import ZimCreator, ZimArticle, ZimBlob |
| 6 | +# docker run -it openzim:python-libzim ./some_example_script.py |
| 7 | + |
| 8 | +FROM python:3.7-buster |
| 9 | + |
| 10 | +ENV LIBZIM_VERSION 6.1.1 |
| 11 | +ENV LIBZIM_RELEASE libzim_linux-x86_64-$LIBZIM_VERSION |
| 12 | +ENV LIBZIM_LIBRARY_PATH lib/x86_64-linux-gnu/libzim.so.$LIBZIM_VERSION |
| 13 | +ENV LIBZIM_INCLUDE_PATH include/zim |
| 14 | + |
| 15 | +# Install libzim from pre-built release |
| 16 | +RUN wget -qO- https://download.openzim.org/release/libzim/$LIBZIM_RELEASE.tar.gz \ |
| 17 | + | tar -xz -C . \ |
| 18 | + && mv $LIBZIM_RELEASE/$LIBZIM_LIBRARY_PATH /usr/lib/libzim.so \ |
| 19 | + && mv $LIBZIM_RELEASE/$LIBZIM_INCLUDE_PATH /usr/include/zim \ |
| 20 | + && ldconfig |
| 21 | + # installing these system-wide inside of docker allows |
| 22 | + # users to run their dockerized code without needing to muck |
| 23 | + # around with LDFLAGS and CPPFLAGS to find libzim. |
| 24 | + # there will be only one copy of libzim, and it will be |
| 25 | + # automatically available to all software system-wide |
| 26 | + |
| 27 | +# Install python dependencies |
| 28 | +RUN pip3 install --no-cache-dir --upgrade \ |
| 29 | + pip cython==0.29.6 setuptools wheel pytest |
| 30 | + |
| 31 | +# Install python-libzim from local source |
| 32 | +ADD . /opt/python-libzim |
| 33 | +WORKDIR /opt/python-libzim |
| 34 | +RUN pip install -e . |
| 35 | +VOLUME /opt/python-libzim |
| 36 | + |
| 37 | +ENTRYPOINT ["/usr/bin/env", "python3"] |
0 commit comments