Skip to content

Commit 26c7265

Browse files
author
Vladislav_Kamerdinerov
committed
Init with PSQL Version 13 and RDKit 2021_09_4
0 parents  commit 26c7265

File tree

5 files changed

+213
-0
lines changed

5 files changed

+213
-0
lines changed

Dockerfile

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
ARG postgres_image_version=13
2+
ARG postgres_pkg_server_version=13
3+
ARG rdkit_git_ref=Release_2021_09_4
4+
ARG rdkit_git_url=https://github.com/rdkit/rdkit.git
5+
6+
7+
FROM docker.io/postgres:${postgres_image_version} AS builder
8+
9+
ARG postgres_pkg_server_version
10+
ARG rdkit_git_ref
11+
ARG rdkit_git_url
12+
13+
RUN apt-get update \
14+
&& DEBIAN_FRONTEND=noninteractive apt-get install -yqq --no-install-recommends \
15+
ca-certificates \
16+
curl \
17+
gnupg \
18+
lsb-release \
19+
&& curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \
20+
&& echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list
21+
22+
RUN apt-get update \
23+
&& DEBIAN_FRONTEND=noninteractive apt-get install -yqq --no-install-recommends \
24+
build-essential \
25+
cmake \
26+
git \
27+
libboost-iostreams-dev \
28+
libboost-regex-dev \
29+
libboost-serialization-dev \
30+
libboost-system-dev \
31+
libeigen3-dev \
32+
libfreetype6-dev \
33+
postgresql-server-dev-${postgres_pkg_server_version} \
34+
zlib1g-dev \
35+
&& apt-get clean \
36+
&& rm -rf /var/lib/apt/lists/*
37+
38+
RUN mkdir -p /opt/RDKit-build \
39+
&& chown postgres:postgres /opt/RDKit-build
40+
41+
USER postgres
42+
WORKDIR /opt/RDKit-build
43+
44+
RUN git clone ${rdkit_git_url}
45+
WORKDIR /opt/RDKit-build/rdkit
46+
RUN git checkout ${rdkit_git_ref}
47+
48+
RUN cmake \
49+
-D RDK_BUILD_CAIRO_SUPPORT=OFF \
50+
-D RDK_BUILD_INCHI_SUPPORT=ON \
51+
-D RDK_BUILD_AVALON_SUPPORT=ON \
52+
-D RDK_BUILD_PYTHON_WRAPPERS=OFF \
53+
-D RDK_BUILD_DESCRIPTORS3D=OFF \
54+
-D RDK_BUILD_FREESASA_SUPPORT=OFF \
55+
-D RDK_BUILD_COORDGEN_SUPPORT=ON \
56+
-D RDK_BUILD_MOLINTERCHANGE_SUPPORT=OFF \
57+
-D RDK_BUILD_YAEHMOP_SUPPORT=OFF \
58+
-D RDK_BUILD_STRUCTCHECKER_SUPPORT=OFF \
59+
-D RDK_USE_URF=OFF \
60+
-D RDK_BUILD_PGSQL=ON \
61+
-D RDK_PGSQL_STATIC=ON \
62+
-D PostgreSQL_CONFIG=pg_config \
63+
-D PostgreSQL_INCLUDE_DIR=`pg_config --includedir` \
64+
-D PostgreSQL_TYPE_INCLUDE_DIR=`pg_config --includedir-server` \
65+
-D PostgreSQL_LIBRARY_DIR=`pg_config --libdir` \
66+
-D RDK_INSTALL_INTREE=OFF \
67+
-D CMAKE_INSTALL_PREFIX=/opt/RDKit \
68+
-D CMAKE_BUILD_TYPE=Release \
69+
.
70+
RUN make -j4
71+
72+
USER root
73+
WORKDIR /opt/RDKit-build/rdkit
74+
75+
RUN make install
76+
RUN /bin/bash /opt/RDKit-build/rdkit/Code/PgSQL/rdkit/pgsql_install.sh
77+
78+
USER postgres
79+
WORKDIR /opt/RDKit-build/rdkit
80+
81+
RUN initdb -D /opt/RDKit-build/pgdata \
82+
&& pg_ctl -D /opt/RDKit-build/pgdata -l /opt/RDKit-build/pgdata/log.txt start \
83+
&& RDBASE="$PWD" LD_LIBRARY_PATH="$PWD/lib" ctest -j4 --output-on-failure \
84+
&& pg_ctl -D /opt/RDKit-build/pgdata stop
85+
86+
87+
ARG postgres_image_version
88+
89+
FROM docker.io/postgres:${postgres_image_version}
90+
91+
ARG postgres_pkg_server_version
92+
93+
RUN apt-get update \
94+
&& DEBIAN_FRONTEND=noninteractive apt-get install -yqq --no-install-recommends \
95+
libboost-iostreams-dev \
96+
libboost-regex-dev \
97+
libboost-serialization-dev \
98+
libboost-system-dev \
99+
libfreetype6-dev \
100+
zlib1g-dev \
101+
&& apt-get clean \
102+
&& rm -rf /var/lib/apt/lists/*
103+
104+
COPY --from=builder /usr/share/postgresql/${postgres_pkg_server_version}/extension/*rdkit* /usr/share/postgresql/${postgres_pkg_server_version}/extension/
105+
COPY --from=builder /usr/lib/postgresql/${postgres_pkg_server_version}/lib/rdkit.so /usr/lib/postgresql/${postgres_pkg_server_version}/lib/rdkit.so

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License
2+
3+
Copyright 2018 Matt Swain
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
13+
all 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
21+
THE SOFTWARE.

README.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# PostgreSQL Docker Image with RDKit Cartridge
2+
3+
This is a PostgreSQL Docker image with the RDKit cartridge installed.
4+
5+
Based on [docker-library/postgres](https://github.com/docker-library/postgres) and [mcs07/docker-postgres-rdkit](https://github.com/mcs07/docker-postgres-rdkit)
6+
7+
8+
This image inherits from the [official postgres image](https://hub.docker.com/_/postgres/), and therefore has all the same environment variables for configuration, and can be extended by adding entrypoint scripts to the `/docker-entrypoint-initdb.d` directory to be run on first launch.
9+
10+
## Running
11+
12+
Start Postgres server running in the background:
13+
14+
docker run --name mypostgres -p 5432:5432 -e POSTGRES_PASSWORD=mypassword -d vladkmrdnv/postgres-rdkit
15+
16+
Or run with an application via Docker Compose:
17+
18+
```yaml
19+
version: "3.0"
20+
services:
21+
22+
db:
23+
image: vladkmrdnv/postgres-rdkit
24+
restart: always
25+
ports:
26+
- 5432:5432
27+
environment:
28+
POSTGRES_PASSWORD: mypassword
29+
volumes:
30+
- pgdata:/var/lib/postgresql/data
31+
- ./db/init.sql:/docker-entrypoint-initdb.d/init.sql
32+
33+
adminer:
34+
image: adminer
35+
restart: always
36+
ports:
37+
- 8080:8080
38+
39+
volumes:
40+
pgdata:
41+
```
42+
43+
This image exposes port 5432 (the postgres port), so standard container linking will make it automatically available to the linked containers.
44+
45+
## Environment Variables
46+
47+
- `POSTGRES_PASSWORD`: Superuser password for PostgreSQL.
48+
- `POSTGRES_USER`: Superuser username (default `postgres`).
49+
- `POSTGRES_DB`: Default database that is created when the image is first started.
50+
- `PGDATA`: Location for the database files (default `/var/lib/postgresql/data`).
51+
52+
See the [official postgres image](https://hub.docker.com/_/postgres/) for more details.
53+
54+
## Building
55+
56+
A multi-stage docker build is used to produce a lightweight production image without all the build dependencies.
57+
Required postgres versions and RDkit version using ARG.
58+
- `postgres_image_version`: Version of Docker image
59+
- `postgres_pkg_server_version`: Version of Postgres-server pkg. Must be Major from docker image version
60+
- `rdkit_git_ref`: RDKit version
61+
62+
To build, run:
63+
64+
docker build -t postgres-rdkit .

db/init.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
create extension rdkit

docker-compose.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
version: "3.0"
2+
services:
3+
4+
db:
5+
image: vladkmrdnv/postgres-rdkit
6+
restart: always
7+
ports:
8+
- 5432:5432
9+
environment:
10+
POSTGRES_PASSWORD: mypassword
11+
volumes:
12+
- pgdata:/var/lib/postgresql/data
13+
- ./db/init.sql:/docker-entrypoint-initdb.d/init.sql
14+
15+
adminer:
16+
image: adminer
17+
restart: always
18+
ports:
19+
- 8080:8080
20+
21+
volumes:
22+
pgdata:

0 commit comments

Comments
 (0)