├── Dockerfile ├── LICENSE.txt └── README.md /Dockerfile: -------------------------------------------------------------------------------- 1 | ARG postgres_image_version=16.2 2 | FROM docker.io/postgres:${postgres_image_version} AS builder 3 | ARG postgres_version=16 4 | ARG boost_dev_version=1.74 5 | ARG rdkit_git_url=https://github.com/rdkit/rdkit.git 6 | ARG rdkit_git_ref=Release_2024_03_1 7 | 8 | RUN apt-get update \ 9 | && apt-get install -yq --no-install-recommends \ 10 | ca-certificates \ 11 | curl \ 12 | gnupg \ 13 | lsb-release \ 14 | && curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \ 15 | && echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list 16 | 17 | RUN apt-get update \ 18 | && apt-get install -yq --no-install-recommends \ 19 | build-essential \ 20 | cmake \ 21 | git \ 22 | coreutils \ 23 | libboost-iostreams${boost_dev_version}-dev \ 24 | libboost-regex${boost_dev_version}-dev \ 25 | libboost-serialization${boost_dev_version}-dev \ 26 | libboost-system${boost_dev_version}-dev \ 27 | libeigen3-dev \ 28 | libfreetype6-dev \ 29 | postgresql-server-dev-${postgres_version}=$(postgres -V | awk '{print $3}')\* \ 30 | zlib1g-dev \ 31 | && apt-get clean \ 32 | && rm -rf /var/lib/apt/lists/* 33 | 34 | RUN mkdir -p /opt/RDKit-build \ 35 | && chown postgres:postgres /opt/RDKit-build 36 | 37 | USER postgres 38 | WORKDIR /opt/RDKit-build 39 | 40 | RUN git clone ${rdkit_git_url} 41 | WORKDIR /opt/RDKit-build/rdkit 42 | RUN git checkout ${rdkit_git_ref} 43 | 44 | RUN cmake \ 45 | -D RDK_BUILD_CAIRO_SUPPORT=OFF \ 46 | -D RDK_BUILD_INCHI_SUPPORT=ON \ 47 | -D RDK_BUILD_AVALON_SUPPORT=ON \ 48 | -D RDK_BUILD_PYTHON_WRAPPERS=OFF \ 49 | -D RDK_BUILD_DESCRIPTORS3D=OFF \ 50 | -D RDK_BUILD_FREESASA_SUPPORT=OFF \ 51 | -D RDK_BUILD_COORDGEN_SUPPORT=ON \ 52 | -D RDK_BUILD_MOLINTERCHANGE_SUPPORT=OFF \ 53 | -D RDK_BUILD_YAEHMOP_SUPPORT=OFF \ 54 | -D RDK_BUILD_STRUCTCHECKER_SUPPORT=OFF \ 55 | -D RDK_USE_URF=OFF \ 56 | -D RDK_BUILD_PGSQL=ON \ 57 | -D RDK_PGSQL_STATIC=ON \ 58 | -D PostgreSQL_CONFIG=pg_config \ 59 | -D PostgreSQL_INCLUDE_DIR=`pg_config --includedir` \ 60 | -D PostgreSQL_TYPE_INCLUDE_DIR=`pg_config --includedir-server` \ 61 | -D PostgreSQL_LIBRARY_DIR=`pg_config --libdir` \ 62 | -D RDK_INSTALL_INTREE=OFF \ 63 | -D CMAKE_INSTALL_PREFIX=/opt/RDKit \ 64 | -D CMAKE_BUILD_TYPE=Release \ 65 | . 66 | RUN make -j$(nproc) 67 | 68 | USER root 69 | WORKDIR /opt/RDKit-build/rdkit 70 | 71 | RUN make install 72 | RUN /bin/bash /opt/RDKit-build/rdkit/Code/PgSQL/rdkit/pgsql_install.sh 73 | 74 | USER postgres 75 | WORKDIR /opt/RDKit-build/rdkit 76 | 77 | RUN initdb -D /opt/RDKit-build/pgdata \ 78 | && pg_ctl -D /opt/RDKit-build/pgdata -l /opt/RDKit-build/pgdata/log.txt start \ 79 | && RDBASE="$PWD" LD_LIBRARY_PATH="$PWD/lib" ctest -j4 --output-on-failure \ 80 | && pg_ctl -D /opt/RDKit-build/pgdata stop 81 | 82 | 83 | FROM docker.io/postgres:${postgres_image_version} 84 | ARG postgres_version=16 85 | ARG boost_version=1.74.0 86 | 87 | RUN apt-get update \ 88 | && apt-get install -yq --no-install-recommends \ 89 | libboost-iostreams${boost_version} \ 90 | libboost-regex${boost_version} \ 91 | libboost-serialization${boost_version} \ 92 | libboost-system${boost_version} \ 93 | libfreetype6 \ 94 | zlib1g \ 95 | && apt-get clean \ 96 | && rm -rf /var/lib/apt/lists/* 97 | 98 | COPY --from=builder /usr/share/postgresql/${postgres_version}/extension/*rdkit* /usr/share/postgresql/${postgres_version}/extension/ 99 | COPY --from=builder /usr/lib/postgresql/${postgres_version}/lib/rdkit.so /usr/lib/postgresql/${postgres_version}/lib/rdkit.so 100 | 101 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2020-2024 Riccardo Vianello and other contributors 4 | 5 | All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions are 9 | met: 10 | 11 | * Redistributions of source code must retain the above copyright 12 | notice, this list of conditions and the following disclaimer. 13 | * Redistributions in binary form must reproduce the above 14 | copyright notice, this list of conditions and the following 15 | disclaimer in the documentation and/or other materials provided 16 | with the distribution. 17 | * Neither the name of the copyright owners nor the names of theirs 18 | contributors may be used to endorse or promote products derived 19 | from this software without specific prior written permission. 20 | 21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | 33 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | postgres-rdkit 2 | ============== 3 | 4 | This repository provides a Dockerfile for extending the official PostgreSQL debian-based Docker image, with the installation of the RDKit cartridge. 5 | 6 | Example command to build the image: 7 | 8 | ```bash 9 | docker build -f Dockerfile --build-arg postgres_image_version="12.17-bullseye" --build-arg postgres_version=12 --build-arg rdkit_git_ref=Release_2023_09_6 --tag rdkit-postgres-12-rdkit_2023_09_6:latest . 10 | ``` 11 | 12 | For everything related to how to run postgres, you should be able to just refer to the documentation for the [upstream image](https://hub.docker.com/_/postgres). 13 | 14 | For everything related to how to use the RDKit cartridge, you can refer to the related [documentation](https://www.rdkit.org/docs/Cartridge.html). 15 | 16 | --------------------------------------------------------------------------------