mirror of
https://github.com/rdkit/rdkit.git
synced 2026-06-03 21:44:30 +08:00
Consolidate MinimalLib Dockerfiles to avoid code duplication (#8412)
* Consolidate MinimalLib Dockerfiles to avoid code duplication Remove Dockerfile_legacy_browsers since IE11 is not used anymore * add project name to docker-compose YAML files * add projectName to azure pipelines DockerCompose section * updated scripts/build_rdkit.js and Dockerfiles to enable end-to-end builds * changes in response to review * - remove unused docker-compose file - update azure-pipelines.yml * fix service dependency * CI build should copy_from_local * docs update, make it work for local builds, minimize git clone * - changes in response to review - added an option to build from the local source tree to scripts/build_rdkitjs.sh --------- Co-authored-by: ptosco <paolo.tosco@novartis.com> Co-authored-by: greg landrum <greg.landrum@gmail.com>
This commit is contained in:
@@ -105,13 +105,27 @@ If you are using the MinimalLib for the first time, see the getting started exam
|
||||
|
||||
## Building the MinimalLib
|
||||
|
||||
Make sure you are at the root of the [MinimalLib](https://github.com/rdkit/rdkit/tree/master/Code/MinimalLib), and run the following script.
|
||||
### Building from Github
|
||||
|
||||
Make sure you are at the root of the [MinimalLib](https://github.com/rdkit/rdkit/tree/master/Code/MinimalLib), and run the following script:
|
||||
|
||||
```bash
|
||||
bash scripts/build_rdkitjs.sh <RDKit git release tag name>
|
||||
# Example: bash scripts/build_rdkitjs.sh Release_2021_03_1
|
||||
scripts/build_rdkitjs.sh <RDKit git release tag name>
|
||||
# Example: scripts/build_rdkitjs.sh Release_2025_03_2
|
||||
```
|
||||
|
||||
This command will take several minutes to complete, and will default to using the `master` branch if no version is provided. Also, checkout the `build_rdkitjs.sh` file and the minimallib `Dockerfile` to see how things are tied together.
|
||||
This command will take several minutes to complete, and will default to using the `master` branch if no version is provided. Also, checkout the `build_rdkitjs.sh` file to see how things are tied together.
|
||||
|
||||
### Building from the local source tree
|
||||
|
||||
Make sure you are at the root of the [MinimalLib](https://github.com/rdkit/rdkit/tree/master/Code/MinimalLib), and run the following script:
|
||||
|
||||
```bash
|
||||
GET_SRC=copy_from_local scripts/build_rdkitjs.sh
|
||||
```
|
||||
|
||||
This command will take several minutes to complete, and will use the local source tree
|
||||
|
||||
### Using the RDKit package assets
|
||||
|
||||
Once you have verified that the distribution files have been properly added in `Code/MinimalLib/dist`, refer to the [Using the RDKit package assets](#using-the-rdkit-package-assets) section for the next steps.
|
||||
|
||||
94
Code/MinimalLib/docker/Dockerfile_1_deps
Normal file
94
Code/MinimalLib/docker/Dockerfile_1_deps
Normal file
@@ -0,0 +1,94 @@
|
||||
# Example usage of this Dockerfile:
|
||||
# (the --build-arg arguments are all optional)
|
||||
#
|
||||
# 1. cd to Code/MinimalLib/docker
|
||||
# cd Code/MinimalLib/docker
|
||||
#
|
||||
# 2. build the MinimalLib rdkit-minimallib-deps image:
|
||||
# docker build --target deps-stage -t rdkit-minimallib-deps \
|
||||
# --build-arg http_proxy=$HTTP_PROXY \
|
||||
# --build-arg https_proxy=$HTTP_PROXY \
|
||||
# --network=host --build-arg "EXCEPTION_HANDLING=-fwasm-exceptions" \
|
||||
# -f Dockerfile_1_deps .
|
||||
|
||||
|
||||
ARG EMSDK_VERSION="latest"
|
||||
ARG EXCEPTION_HANDLING="-fexceptions -sNO_DISABLE_EXCEPTION_CATCHING"
|
||||
ARG BOOST_MAJOR_VERSION="1"
|
||||
ARG BOOST_MINOR_VERSION="87"
|
||||
ARG BOOST_PATCH_VERSION="0"
|
||||
ARG BOOST_DOT_VERSION
|
||||
ARG BOOST_UNDERSCORE_VERSION
|
||||
ARG FREETYPE_VERSION="2.13.3"
|
||||
ARG http_proxy
|
||||
ARG https_proxy
|
||||
|
||||
FROM debian:bookworm AS deps-stage
|
||||
ARG EMSDK_VERSION
|
||||
ARG EXCEPTION_HANDLING
|
||||
ARG RDKIT_GIT_URL
|
||||
ARG RDKIT_BRANCH
|
||||
ARG BOOST_MAJOR_VERSION
|
||||
ARG BOOST_MINOR_VERSION
|
||||
ARG BOOST_PATCH_VERSION
|
||||
ARG FREETYPE_VERSION
|
||||
ARG http_proxy
|
||||
ARG https_proxy
|
||||
|
||||
LABEL maintainer="Greg Landrum <greg.landrum@t5informatics.com>"
|
||||
|
||||
RUN [ -n "${http_proxy}" ] && echo "export http_proxy=${http_proxy}" >> ~/.bashrc || true
|
||||
RUN [ -n "${https_proxy}" ] && echo "export https_proxy=${https_proxy}" >> ~/.bashrc || true
|
||||
SHELL ["/bin/bash", "-c", "-l"]
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
RUN apt-get update && apt-get upgrade -y && apt install -y \
|
||||
curl \
|
||||
wget \
|
||||
cmake \
|
||||
python3 \
|
||||
g++ \
|
||||
libeigen3-dev \
|
||||
git \
|
||||
xz-utils \
|
||||
nodejs
|
||||
|
||||
# If you are in an organization, put your organization certs inside
|
||||
# the certs directory otherwise HTTPS might not work
|
||||
COPY certs /usr/local/share/ca-certificates/
|
||||
RUN update-ca-certificates
|
||||
|
||||
ENV LANG C
|
||||
|
||||
WORKDIR /opt
|
||||
RUN git clone https://github.com/emscripten-core/emsdk.git
|
||||
|
||||
WORKDIR /src
|
||||
ARG BOOST_DOT_VERSION="${BOOST_MAJOR_VERSION}.${BOOST_MINOR_VERSION}.${BOOST_PATCH_VERSION}"
|
||||
ARG BOOST_UNDERSCORE_VERSION="${BOOST_MAJOR_VERSION}_${BOOST_MINOR_VERSION}_${BOOST_PATCH_VERSION}"
|
||||
RUN wget -q https://archives.boost.io/release/${BOOST_DOT_VERSION}/source/boost_${BOOST_UNDERSCORE_VERSION}.tar.gz && \
|
||||
tar xzf boost_${BOOST_UNDERSCORE_VERSION}.tar.gz
|
||||
WORKDIR /src/boost_${BOOST_UNDERSCORE_VERSION}
|
||||
RUN ./bootstrap.sh --prefix=/opt/boost --with-libraries=system && \
|
||||
./b2 install
|
||||
|
||||
WORKDIR /opt/emsdk
|
||||
RUN ./emsdk install ${EMSDK_VERSION} && \
|
||||
./emsdk activate ${EMSDK_VERSION}
|
||||
|
||||
#RUN source ./emsdk_env.sh
|
||||
|
||||
RUN echo "source /opt/emsdk/emsdk_env.sh > /dev/null 2>&1" >> ~/.bashrc
|
||||
|
||||
WORKDIR /src
|
||||
RUN wget -q https://download.savannah.gnu.org/releases/freetype/freetype-${FREETYPE_VERSION}.tar.gz && \
|
||||
tar xzf freetype-${FREETYPE_VERSION}.tar.gz
|
||||
WORKDIR /src/freetype-${FREETYPE_VERSION}
|
||||
RUN mkdir build
|
||||
WORKDIR /src/freetype-${FREETYPE_VERSION}/build
|
||||
RUN emcmake cmake -DCMAKE_BUILD_TYPE=Release -DWITH_ZLIB=OFF -DWITH_BZip2=OFF -DWITH_PNG=OFF \
|
||||
-DCMAKE_C_FLAGS="${EXCEPTION_HANDLING}" -DCMAKE_EXE_LINKER_FLAGS="${EXCEPTION_HANDLING}" \
|
||||
-DCMAKE_INSTALL_PREFIX=/opt/freetype ..
|
||||
RUN make -j2 && make -j2 install
|
||||
RUN echo "export BOOST_DOT_VERSION=${BOOST_DOT_VERSION}" >> ~/.bashrc
|
||||
RUN echo "export BOOST_UNDERSCORE_VERSION=${BOOST_UNDERSCORE_VERSION}" >> ~/.bashrc
|
||||
28
Code/MinimalLib/docker/Dockerfile_2_rdkit_clone_from_github
Normal file
28
Code/MinimalLib/docker/Dockerfile_2_rdkit_clone_from_github
Normal file
@@ -0,0 +1,28 @@
|
||||
# Example usage of this Dockerfile:
|
||||
# (the --build-arg arguments are all optional)
|
||||
#
|
||||
# 1. cd to Code/MinimalLib/docker
|
||||
# cd Code/MinimalLib/docker
|
||||
#
|
||||
# 2. build the MinimalLib rdkit-minimallib-rdkit-src image:
|
||||
# docker build --target clone-stage -t rdkit-minimallib-rdkit-src \
|
||||
# --build-arg http_proxy=$HTTP_PROXY \
|
||||
# --build-arg https_proxy=$HTTP_PROXY \
|
||||
# --build-arg "RDKIT_GIT_URL=https://github.com/myfork/rdkit.git" \
|
||||
# --build-arg "RDKIT_BRANCH=mybranch" \
|
||||
# --network=host -f Dockerfile_rdkit_clone_from_github .
|
||||
|
||||
|
||||
ARG RDKIT_GIT_URL="https://github.com/rdkit/rdkit.git"
|
||||
ARG RDKIT_BRANCH="master"
|
||||
|
||||
FROM rdkit-minimallib-deps AS clone-stage
|
||||
ARG RDKIT_GIT_URL
|
||||
ARG RDKIT_BRANCH
|
||||
|
||||
LABEL maintainer="Greg Landrum <greg.landrum@t5informatics.com>"
|
||||
|
||||
WORKDIR /src
|
||||
ENV RDBASE=/src/rdkit
|
||||
RUN git clone -b ${RDKIT_BRANCH} --depth 1 --single-branch ${RDKIT_GIT_URL}
|
||||
WORKDIR $RDBASE
|
||||
21
Code/MinimalLib/docker/Dockerfile_2_rdkit_copy_from_local
Normal file
21
Code/MinimalLib/docker/Dockerfile_2_rdkit_copy_from_local
Normal file
@@ -0,0 +1,21 @@
|
||||
# Example usage of this Dockerfile:
|
||||
# (the --build-arg arguments are all optional)
|
||||
#
|
||||
# 1. cd to Code/MinimalLib/docker
|
||||
# cd Code/MinimalLib/docker
|
||||
#
|
||||
# 2. build the MinimalLib rdkit-minimallib-rdkit-src image:
|
||||
# docker build --target local-src-stage -t rdkit-minimallib-rdkit-src \
|
||||
# --build-arg http_proxy=$HTTP_PROXY \
|
||||
# --build-arg https_proxy=$HTTP_PROXY \
|
||||
# --network=host -f Dockerfile_2_rdkit_copy_from_local ../../..
|
||||
|
||||
|
||||
FROM rdkit-minimallib-deps AS local-src-stage
|
||||
|
||||
LABEL maintainer="Greg Landrum <greg.landrum@t5informatics.com>"
|
||||
|
||||
WORKDIR /
|
||||
COPY Code /src/rdkit/Code
|
||||
COPY External /src/rdkit/External
|
||||
COPY CMakeLists.txt license.txt *.in *.md *.cmake /src/rdkit/
|
||||
@@ -1,19 +1,49 @@
|
||||
# Note: there are docker-compose .yml files that handle the 3
|
||||
# build steps automatically for you; see the comments in the
|
||||
# respective docker-compose files for details.
|
||||
# However, if you prefer to run individual docker commands rather
|
||||
# than using docker-compose, you can do so by following the
|
||||
# instructions below.
|
||||
#
|
||||
# Example usage of this Dockerfile:
|
||||
# (the build-arg arguments are all optional)
|
||||
# (the --build-arg arguments are all optional)
|
||||
#
|
||||
# 1. cd to Code/MinimalLib/docker
|
||||
# cd Code/MinimalLib/docker
|
||||
#
|
||||
# 2. build the JS and WASM libraries
|
||||
# 2. build the MinimalLib rdkit-minimallib-deps image:
|
||||
# docker build --target deps-stage -t rdkit-minimallib-deps \
|
||||
# --build-arg http_proxy=$HTTP_PROXY \
|
||||
# --build-arg https_proxy=$HTTP_PROXY \
|
||||
# --network=host --build-arg "EXCEPTION_HANDLING=-fwasm-exceptions" \
|
||||
# -f Dockerfile_1_deps .
|
||||
#
|
||||
# 3. build the MinimalLib rdkit-minimallib-rdkit-src image:
|
||||
# 3a. from a git clone:
|
||||
# docker build --target clone-stage -t rdkit-minimallib-rdkit-src \
|
||||
# --build-arg http_proxy=$HTTP_PROXY \
|
||||
# --build-arg https_proxy=$HTTP_PROXY \
|
||||
# --build-arg "RDKIT_GIT_URL=https://github.com/myfork/rdkit.git" \
|
||||
# --build-arg "RDKIT_BRANCH=mybranch" \
|
||||
# --network=host -f Dockerfile_rdkit_clone_from_github .
|
||||
# or
|
||||
# 3b. from an existing local source tree:
|
||||
# docker build --target local-src-stage -t rdkit-minimallib-rdkit-src \
|
||||
# --build-arg http_proxy=$HTTP_PROXY \
|
||||
# --build-arg https_proxy=$HTTP_PROXY \
|
||||
# --network=host -f Dockerfile_2_rdkit_copy_from_local ../../..
|
||||
#
|
||||
# 4. build the MinimalLib rdkit-minimallib image:
|
||||
# (the build-arg arguments are all optional; in the following
|
||||
# example we select the more performant, though still experimental,
|
||||
# native WASM exception handling):
|
||||
# docker build -t rdkit-minimallib --network=host \
|
||||
# --build-arg "RDKIT_GIT_URL=https://github.com/myfork/rdkit.git" \
|
||||
# --build-arg "RDKIT_BRANCH=mybranch" \
|
||||
# --build-arg "EXCEPTION_HANDLING=-fwasm-exceptions".
|
||||
# --build-arg http_proxy=$HTTP_PROXY \
|
||||
# --build-arg https_proxy=$HTTP_PROXY \
|
||||
# --build-arg "EXCEPTION_HANDLING=-fwasm-exceptions" \
|
||||
# -f Dockerfile_3_rdkit_build .
|
||||
#
|
||||
# 3. create a temporary container and copy built libraries
|
||||
# 5. create a temporary container and copy built libraries
|
||||
# from the container to your local filesystem, then destroy
|
||||
# the temporary container
|
||||
# docker create --name=rdkit-minimallib-container rdkit-minimallib:latest --entrypoint /
|
||||
@@ -22,78 +52,15 @@
|
||||
# docker rm rdkit-minimallib-container
|
||||
|
||||
|
||||
ARG RDKIT_GIT_URL="https://github.com/rdkit/rdkit.git"
|
||||
ARG RDKIT_BRANCH="master"
|
||||
ARG EMSDK_VERSION="latest"
|
||||
ARG EXCEPTION_HANDLING="-fexceptions -sNO_DISABLE_EXCEPTION_CATCHING"
|
||||
ARG BOOST_MAJOR_VERSION="1"
|
||||
ARG BOOST_MINOR_VERSION="87"
|
||||
ARG BOOST_PATCH_VERSION="0"
|
||||
ARG FREETYPE_VERSION="2.13.3"
|
||||
|
||||
FROM debian:bookworm as build-stage
|
||||
ARG RDKIT_GIT_URL
|
||||
ARG RDKIT_BRANCH
|
||||
ARG EMSDK_VERSION
|
||||
FROM rdkit-minimallib-rdkit-src AS build-stage
|
||||
ARG EXCEPTION_HANDLING
|
||||
ARG BOOST_MAJOR_VERSION
|
||||
ARG BOOST_MINOR_VERSION
|
||||
ARG BOOST_PATCH_VERSION
|
||||
ARG FREETYPE_VERSION
|
||||
|
||||
LABEL maintainer="Greg Landrum <greg.landrum@t5informatics.com>"
|
||||
|
||||
RUN apt-get update && apt-get upgrade -y && apt install -y \
|
||||
curl \
|
||||
wget \
|
||||
cmake \
|
||||
python3 \
|
||||
g++ \
|
||||
libeigen3-dev \
|
||||
git \
|
||||
xz-utils \
|
||||
nodejs
|
||||
|
||||
ENV LANG C
|
||||
|
||||
WORKDIR /src
|
||||
ARG BOOST_DOT_VERSION="${BOOST_MAJOR_VERSION}.${BOOST_MINOR_VERSION}.${BOOST_PATCH_VERSION}"
|
||||
ARG BOOST_UNDERSCORE_VERSION="${BOOST_MAJOR_VERSION}_${BOOST_MINOR_VERSION}_${BOOST_PATCH_VERSION}"
|
||||
RUN wget -q https://archives.boost.io/release/${BOOST_DOT_VERSION}/source/boost_${BOOST_UNDERSCORE_VERSION}.tar.gz && \
|
||||
tar xzf boost_${BOOST_UNDERSCORE_VERSION}.tar.gz
|
||||
WORKDIR /src/boost_${BOOST_UNDERSCORE_VERSION}
|
||||
RUN ./bootstrap.sh --prefix=/opt/boost --with-libraries=system && \
|
||||
./b2 install
|
||||
|
||||
WORKDIR /opt
|
||||
RUN git clone https://github.com/emscripten-core/emsdk.git
|
||||
|
||||
WORKDIR /opt/emsdk
|
||||
RUN ./emsdk install ${EMSDK_VERSION} && \
|
||||
./emsdk activate ${EMSDK_VERSION}
|
||||
|
||||
#RUN source ./emsdk_env.sh
|
||||
|
||||
RUN echo "source /opt/emsdk/emsdk_env.sh > /dev/null 2>&1" >> ~/.bashrc
|
||||
SHELL ["/bin/bash", "-c", "-l"]
|
||||
|
||||
WORKDIR /src
|
||||
RUN wget -q https://download.savannah.gnu.org/releases/freetype/freetype-${FREETYPE_VERSION}.tar.gz && \
|
||||
tar xzf freetype-${FREETYPE_VERSION}.tar.gz
|
||||
WORKDIR /src/freetype-${FREETYPE_VERSION}
|
||||
RUN mkdir build
|
||||
WORKDIR /src/freetype-${FREETYPE_VERSION}/build
|
||||
RUN emcmake cmake -DCMAKE_BUILD_TYPE=Release -DWITH_ZLIB=OFF -DWITH_BZip2=OFF -DWITH_PNG=OFF \
|
||||
-DCMAKE_C_FLAGS="${EXCEPTION_HANDLING}" -DCMAKE_EXE_LINKER_FLAGS="${EXCEPTION_HANDLING}" \
|
||||
-DCMAKE_INSTALL_PREFIX=/opt/freetype ..
|
||||
RUN make -j2 && make -j2 install
|
||||
|
||||
WORKDIR /src
|
||||
ENV RDBASE=/src/rdkit
|
||||
RUN git clone ${RDKIT_GIT_URL}
|
||||
WORKDIR $RDBASE
|
||||
RUN git fetch --all --tags && \
|
||||
git checkout ${RDKIT_BRANCH}
|
||||
RUN mkdir build
|
||||
WORKDIR $RDBASE/build
|
||||
RUN emcmake cmake -DRDK_BUILD_FREETYPE_SUPPORT=ON -DRDK_BUILD_MINIMAL_LIB=ON \
|
||||
3
Code/MinimalLib/docker/Dockerfile_4_rdkit_export
Normal file
3
Code/MinimalLib/docker/Dockerfile_4_rdkit_export
Normal file
@@ -0,0 +1,3 @@
|
||||
FROM rdkit-minimallib AS export-stage
|
||||
|
||||
LABEL maintainer="Greg Landrum <greg.landrum@t5informatics.com>"
|
||||
@@ -1,133 +0,0 @@
|
||||
# Example usage of this Dockerfile:
|
||||
# (the build-arg arguments are all optional)
|
||||
#
|
||||
# 1. cd to Code/MinimalLib/docker
|
||||
# cd Code/MinimalLib/docker
|
||||
#
|
||||
# 2. build the JS and WASM libraries
|
||||
# (the build-arg arguments are all optional; in the following
|
||||
# example we select the more performant, though still experimental,
|
||||
# native WASM exception handling):
|
||||
# docker build -t rdkit-minimallib --network=host \
|
||||
# --build-arg "RDKIT_GIT_URL=https://github.com/myfork/rdkit.git" \
|
||||
# --build-arg "RDKIT_BRANCH=mybranch" \
|
||||
# --build-arg "EXCEPTION_HANDLING=-fwasm-exceptions".
|
||||
#
|
||||
# 3. create a temporary container and copy built libraries
|
||||
# from the container to your local filesystem, then destroy
|
||||
# the temporary container
|
||||
# docker create --name=rdkit-minimallib-container rdkit-minimallib:latest --entrypoint /
|
||||
# docker cp rdkit-minimallib-container:/RDKit_minimal.js ../demo
|
||||
# docker cp rdkit-minimallib-container:/RDKit_minimal.wasm ../demo
|
||||
# docker rm rdkit-minimallib-container
|
||||
|
||||
|
||||
ARG EMSDK_VERSION="latest"
|
||||
ARG EXCEPTION_HANDLING="-fexceptions -sNO_DISABLE_EXCEPTION_CATCHING"
|
||||
ARG BOOST_MAJOR_VERSION="1"
|
||||
ARG BOOST_MINOR_VERSION="87"
|
||||
ARG BOOST_PATCH_VERSION="0"
|
||||
ARG FREETYPE_VERSION="2.13.3"
|
||||
|
||||
FROM debian:bookworm AS build-stage
|
||||
ARG EMSDK_VERSION
|
||||
ARG EXCEPTION_HANDLING
|
||||
ARG BOOST_MAJOR_VERSION
|
||||
ARG BOOST_MINOR_VERSION
|
||||
ARG BOOST_PATCH_VERSION
|
||||
ARG FREETYPE_VERSION
|
||||
|
||||
LABEL maintainer="Greg Landrum <greg.landrum@t5informatics.com>"
|
||||
|
||||
RUN apt-get update && apt-get upgrade -y && apt install -y \
|
||||
curl \
|
||||
wget \
|
||||
cmake \
|
||||
python3 \
|
||||
g++ \
|
||||
libeigen3-dev \
|
||||
git \
|
||||
xz-utils \
|
||||
nodejs
|
||||
|
||||
ENV LANG C
|
||||
|
||||
WORKDIR /opt
|
||||
RUN git clone https://github.com/emscripten-core/emsdk.git
|
||||
|
||||
WORKDIR /src
|
||||
ARG BOOST_DOT_VERSION="${BOOST_MAJOR_VERSION}.${BOOST_MINOR_VERSION}.${BOOST_PATCH_VERSION}"
|
||||
ARG BOOST_UNDERSCORE_VERSION="${BOOST_MAJOR_VERSION}_${BOOST_MINOR_VERSION}_${BOOST_PATCH_VERSION}"
|
||||
RUN wget -q https://archives.boost.io/release/${BOOST_DOT_VERSION}/source/boost_${BOOST_UNDERSCORE_VERSION}.tar.gz && \
|
||||
tar xzf boost_${BOOST_UNDERSCORE_VERSION}.tar.gz
|
||||
WORKDIR /src/boost_${BOOST_UNDERSCORE_VERSION}
|
||||
RUN ./bootstrap.sh --prefix=/opt/boost --with-libraries=system && \
|
||||
./b2 install
|
||||
|
||||
WORKDIR /opt/emsdk
|
||||
RUN ./emsdk install ${EMSDK_VERSION} && \
|
||||
./emsdk activate ${EMSDK_VERSION}
|
||||
|
||||
#RUN source ./emsdk_env.sh
|
||||
|
||||
RUN echo "source /opt/emsdk/emsdk_env.sh > /dev/null 2>&1" >> ~/.bashrc
|
||||
SHELL ["/bin/bash", "-c", "-l"]
|
||||
|
||||
WORKDIR /src
|
||||
RUN wget -q https://download.savannah.gnu.org/releases/freetype/freetype-${FREETYPE_VERSION}.tar.gz && \
|
||||
tar xzf freetype-${FREETYPE_VERSION}.tar.gz
|
||||
WORKDIR /src/freetype-${FREETYPE_VERSION}
|
||||
RUN mkdir build
|
||||
WORKDIR /src/freetype-${FREETYPE_VERSION}/build
|
||||
RUN emcmake cmake -DCMAKE_BUILD_TYPE=Release -DWITH_ZLIB=OFF -DWITH_BZip2=OFF -DWITH_PNG=OFF \
|
||||
-DCMAKE_C_FLAGS="${EXCEPTION_HANDLING}" -DCMAKE_EXE_LINKER_FLAGS="${EXCEPTION_HANDLING}" \
|
||||
-DCMAKE_INSTALL_PREFIX=/opt/freetype ..
|
||||
RUN make -j2 && make -j2 install
|
||||
|
||||
WORKDIR /
|
||||
COPY Code /src/rdkit/Code
|
||||
COPY External /src/rdkit/External
|
||||
COPY CMakeLists.txt license.txt *.in *.md *.cmake /src/rdkit
|
||||
ENV RDBASE=/src/rdkit
|
||||
|
||||
WORKDIR $RDBASE
|
||||
RUN mkdir build
|
||||
WORKDIR $RDBASE/build
|
||||
RUN emcmake cmake -DRDK_BUILD_FREETYPE_SUPPORT=ON -DRDK_BUILD_MINIMAL_LIB=ON \
|
||||
-DRDK_BUILD_PYTHON_WRAPPERS=OFF -DRDK_BUILD_CPP_TESTS=OFF -DRDK_BUILD_INCHI_SUPPORT=ON \
|
||||
-DRDK_USE_BOOST_SERIALIZATION=OFF -DRDK_OPTIMIZE_POPCNT=OFF -DRDK_BUILD_THREADSAFE_SSS=OFF \
|
||||
-DRDK_BUILD_DESCRIPTORS3D=OFF -DRDK_TEST_MULTITHREADED=OFF \
|
||||
-DRDK_BUILD_MAEPARSER_SUPPORT=OFF -DRDK_BUILD_COORDGEN_SUPPORT=ON \
|
||||
-DBoost_DIR=/opt/boost/lib/cmake/Boost-${BOOST_DOT_VERSION} \
|
||||
-Dboost_headers_DIR=/opt/boost/lib/cmake/boost_headers-${BOOST_DOT_VERSION} \
|
||||
-DRDK_BUILD_SLN_SUPPORT=OFF -DRDK_USE_BOOST_IOSTREAMS=OFF \
|
||||
-DFREETYPE_INCLUDE_DIRS=/opt/freetype/include/freetype2 \
|
||||
-DFREETYPE_LIBRARY=/opt/freetype/lib/libfreetype.a \
|
||||
-DCMAKE_CXX_FLAGS="${EXCEPTION_HANDLING} -O3 -DNDEBUG" \
|
||||
-DCMAKE_C_FLAGS="${EXCEPTION_HANDLING} -O3 -DNDEBUG -DCOMPILE_ANSI_ONLY" \
|
||||
-DCMAKE_EXE_LINKER_FLAGS="${EXCEPTION_HANDLING} -s STACK_OVERFLOW_CHECK=1 -s USE_PTHREADS=0 -s ALLOW_MEMORY_GROWTH=1 -s MAXIMUM_MEMORY=4GB -s MODULARIZE=1 -s EXPORT_NAME=\"'initRDKitModule'\"" ..
|
||||
|
||||
# "patch" to make the InChI code work with emscripten:
|
||||
RUN cp /src/rdkit/External/INCHI-API/src/INCHI_BASE/src/util.c /src/rdkit/External/INCHI-API/src/INCHI_BASE/src/util.c.bak && \
|
||||
sed 's/&& defined(__APPLE__)//' /src/rdkit/External/INCHI-API/src/INCHI_BASE/src/util.c.bak > /src/rdkit/External/INCHI-API/src/INCHI_BASE/src/util.c
|
||||
|
||||
# comment out a line which causes a compilation error on some platforms
|
||||
# (based on the change which has already been applied to the RapidJSON master branch, see
|
||||
# https://github.com/Tencent/rapidjson/blob/ab1842a2dae061284c0a62dca1cc6d5e7e37e346/include/rapidjson/document.h#L414)
|
||||
RUN sed -i 's|^\( *\)\(GenericStringRef\& operator=(const GenericStringRef\& rhs) { s = rhs.s; length = rhs.length; } *\)$|\1//\2|' \
|
||||
/src/rdkit/External/rapidjson-1.1.0/include/rapidjson/document.h
|
||||
|
||||
# build and "install"
|
||||
RUN make -j2 RDKit_minimal && \
|
||||
cp Code/MinimalLib/RDKit_minimal.* ../Code/MinimalLib/demo/
|
||||
|
||||
# run the tests
|
||||
WORKDIR /src/rdkit/Code/MinimalLib/tests
|
||||
RUN /opt/emsdk/node/*/bin/node tests.js
|
||||
|
||||
# # Copy js and wasm rdkit files to use in browser
|
||||
# # This feature requires the BuildKit backend
|
||||
# # https://docs.docker.com/engine/reference/commandline/build/#custom-build-outputs
|
||||
# FROM scratch AS export-stage
|
||||
# COPY --from=build-stage /src/rdkit/Code/MinimalLib/demo /
|
||||
# COPY --from=build-stage /src/rdkit/Code/MinimalLib/docs /
|
||||
@@ -1,61 +0,0 @@
|
||||
# Example usage of this Dockerfile:
|
||||
# (the build-arg arguments are all optional)
|
||||
#
|
||||
# 1. cd to Code/MinimalLib/docker
|
||||
# cd Code/MinimalLib/docker
|
||||
#
|
||||
# 2. generate an image of the build-stage from the main Dockerfile.
|
||||
# The build-arg arguments are all optional and have appropriate
|
||||
# defaults. Regarding EMSDK_VERSION, 3.1.50 is the last
|
||||
# emsdk version that supports the MIN_IE_VERSION=11 flag.
|
||||
# docker build --target build-stage -t rdkit-minimallib-build-stage --network=host \
|
||||
# --build-arg "EMSDK_VERSION=3.1.50" \
|
||||
# --build-arg "RDKIT_GIT_URL=https://github.com/myfork/rdkit.git" \
|
||||
# --build-arg "RDKIT_BRANCH=mybranch" .
|
||||
#
|
||||
# 3. build the JS-only version of MinimalLib for legacy browsers
|
||||
# (requires the rdkit-minimallib-build-stage image built in step 2).
|
||||
# The build-arg arguments are all optional and have appropriate
|
||||
# defaults.
|
||||
# docker build -t rdkit-minimallib-legacy --network=host \
|
||||
# --build-arg "EXTRA_CMAKE_EXE_LINKER_FLAGS=-s MIN_IE_VERSION=11" \
|
||||
# -f Dockerfile_legacy_browsers .
|
||||
#
|
||||
# 4. create a temporary container and copy built libraries
|
||||
# from the container to your local filesystem, then destroy
|
||||
# the temporary container
|
||||
# docker create --name=rdkit-minimallib-legacy-container rdkit-minimallib-legacy:latest --entrypoint /
|
||||
# docker cp rdkit-minimallib-legacy-container:/RDKit_minimal_legacy.js ../demo
|
||||
# docker rm rdkit-minimallib-legacy-container
|
||||
#
|
||||
# To test in a legacy browser, do the following:
|
||||
# sed 's|RDKit_minimal\.js|RDKit_minimal_legacy.js|' < ../demo/demo.html > ../demo/demo_legacy.html
|
||||
# then point your browser to demo_legacy.html
|
||||
|
||||
|
||||
FROM rdkit-minimallib-build-stage as build-stage-legacy
|
||||
ARG EXTRA_CMAKE_EXE_LINKER_FLAGS=""
|
||||
|
||||
WORKDIR $RDBASE/build
|
||||
RUN emcmake cmake -DRDK_MINIMAL_LIB_SUPPORT_LEGACY_BROWSERS=ON \
|
||||
-DCMAKE_EXE_LINKER_FLAGS="-s SINGLE_FILE=1 -s LEGACY_VM_SUPPORT=1 ${EXTRA_CMAKE_EXE_LINKER_FLAGS} -s WASM=0 --memory-init-file 0 -s MODULARIZE=1 -s EXPORT_NAME=\"'initRDKitModule'\"" ..
|
||||
|
||||
# build and "install"
|
||||
RUN make -j2 RDKit_minimal && echo -e '\
|
||||
var toObj=function(c){if(null===c||"undefined"===typeof c)throw new TypeError("this is null or undefined");return Object(c)};Uint8Array.prototype.fill||Object.defineProperty(Uint8Array.prototype,"fill",{value:function(c,b,d){var e=toObj(this),a=e.length>>>0;b>>=0;b=0>b?Math.max(a+b,0):Math.min(b,a);d="undefined"===typeof d?a:d>>0;for(a=0>d?Math.max(a+d,0):Math.min(d,a);b<a;)e[b]=c,++b;return e}});\n\
|
||||
Uint8Array.prototype.copyWithin||Object.defineProperty(Uint8Array.prototype,"copyWithin",{value:function(c,b,d){var e=toObj(this),a=e.length>>>0;c>>=0;c=0>c?Math.max(a+c,0):Math.min(c,a);b>>=0;b=0>b?Math.max(a+b,0):Math.min(b,a);d="undefined"===typeof d?a:d>>0;a=Math.min((0>d?Math.max(a+d,0):Math.min(d,a))-b,a-c);d=1;b<c&&c<b+a&&(d=-1,b+=a-1,c+=a-1);for(;0<a;)b in e?e[c]=e[b]:delete e[c],b+=d,c+=d,--a;return e}});\n\
|
||||
String.prototype.includes||Object.defineProperty(String.prototype,"includes",{value:function(c,b){var d=toObj(this);if(c instanceof RegExp)throw new TypeError("first argument must not be a RegExp");return-1!==d.indexOf(c,b||0)}});\n\
|
||||
Array.prototype.includes||Object.defineProperty(Array.prototype,"includes",{value:function(c,b){var d=toObj(this),e=d.length>>>0;if(0===e)return!1;var a=b||0;for(a=Math.max(0<=a?a:e-Math.abs(a),0);a<e;){var f=d[a],g=c;if(f===g||"number"===typeof f&&"number"===typeof g&&isNaN(f)&&isNaN(g))return!0;++a}return!1}});String.prototype.startsWith||Object.defineProperty(String.prototype,"startsWith",{value:function(c,b){var d=toObj(this),e=0<b?b|0:0;return d.substring(e,e+c.length)===c}});\n\
|
||||
' > ../Code/MinimalLib/demo/RDKit_minimal_legacy.js && \
|
||||
sed 's|\(var *initRDKitModule *= *(\)\(() *=>\)\( *{\)|\1function()\3|' \
|
||||
< Code/MinimalLib/RDKit_minimal.js >> ../Code/MinimalLib/demo/RDKit_minimal_legacy.js
|
||||
|
||||
# run the tests
|
||||
WORKDIR /src/rdkit/Code/MinimalLib/tests
|
||||
RUN RDKIT_MINIMAL_JS="../demo/RDKit_minimal_legacy.js" /opt/emsdk/node/*/bin/node tests.js
|
||||
|
||||
# Copy pure js RDKit MinimalLib file to use in legacy browsers
|
||||
# This feature requires the BuildKit backend
|
||||
# https://docs.docker.com/engine/reference/commandline/build/#custom-build-outputs
|
||||
FROM scratch as export-stage-legacy
|
||||
COPY --from=build-stage-legacy /src/rdkit/Code/MinimalLib/demo/RDKit_minimal_legacy.js /
|
||||
0
Code/MinimalLib/docker/certs/.gitignore
vendored
Normal file
0
Code/MinimalLib/docker/certs/.gitignore
vendored
Normal file
66
Code/MinimalLib/docker/docker_compose_build_minimallib.yml
Normal file
66
Code/MinimalLib/docker/docker_compose_build_minimallib.yml
Normal file
@@ -0,0 +1,66 @@
|
||||
# This docker-compose file is used to build the RDKit MinimalLib
|
||||
# from either GitHub or a local source tree.
|
||||
# The build consists of three stages (services):
|
||||
# 1. `deps`: This service builds the dependencies required for RDKit.
|
||||
# 2. `rdkit_get_src`: This service gets the RDKit source code from
|
||||
# either from GitHub (GET_SRC=clone_from_github, the default)
|
||||
# or from a local source tree (GET_SRC=copy_from_local)
|
||||
# into the Docker image.
|
||||
# 3. `rdkit_build`: This service builds the RDKit MinimalLib using
|
||||
# the dependencies built in the first service and the source code
|
||||
# copied in the second service.
|
||||
#
|
||||
# Example usage:
|
||||
# (the --build-arg are all optional)
|
||||
#
|
||||
# GET_SRC=copy_from_local \
|
||||
# docker-compose -f docker_compose_build_minimallib.yml build \
|
||||
# --build-arg http_proxy=$HTTP_PROXY \
|
||||
# --build-arg http_proxy=$HTTP_PROXY \
|
||||
# --build-arg https_proxy=$HTTP_PROXY \
|
||||
# --build-arg "EXCEPTION_HANDLING=-fwasm-exceptions" \
|
||||
# 2>&1 | tee docker-compose.log
|
||||
#
|
||||
# Once the build is finished, you can run the following command to
|
||||
# export the buildartifacts to your local filesystem:
|
||||
#
|
||||
# DOCKER_BUILDKIT=1 docker build -f Dockerfile_4_rdkit_export -o ../demo .
|
||||
|
||||
services:
|
||||
rdkit_deps:
|
||||
environment:
|
||||
- NETWORK_MODE=${NETWORK_MODE:-bridge}
|
||||
- NETWORK=${NETWORK:-rdkit_network}
|
||||
network_mode: ${NETWORK_MODE}
|
||||
build:
|
||||
network: ${NETWORK}
|
||||
context: .
|
||||
dockerfile: Dockerfile_1_deps
|
||||
image: rdkit-minimallib-deps:latest
|
||||
|
||||
rdkit_get_src:
|
||||
environment:
|
||||
- NETWORK_MODE=${NETWORK_MODE:-bridge}
|
||||
- NETWORK=${NETWORK:-rdkit_network}
|
||||
- GET_SRC=${GET_SRC:-clone_from_github}
|
||||
network_mode: ${NETWORK_MODE}
|
||||
build:
|
||||
network: ${NETWORK}
|
||||
context: ../../..
|
||||
dockerfile: ./Code/MinimalLib/docker/Dockerfile_2_rdkit_${GET_SRC}
|
||||
image: rdkit-minimallib-rdkit-src:latest
|
||||
depends_on:
|
||||
- rdkit_deps
|
||||
|
||||
rdkit_build:
|
||||
environment:
|
||||
- NETWORK_MODE=${NETWORK_MODE:-bridge}
|
||||
- NETWORK=${NETWORK:-rdkit_network}
|
||||
network_mode: ${NETWORK_MODE}
|
||||
build:
|
||||
network: ${NETWORK}
|
||||
context: .
|
||||
dockerfile: Dockerfile_3_rdkit_build
|
||||
image: rdkit-minimallib:latest
|
||||
depends_on:
|
||||
- rdkit_get_src
|
||||
28
Code/MinimalLib/scripts/build_rdkitjs.sh
Normal file → Executable file
28
Code/MinimalLib/scripts/build_rdkitjs.sh
Normal file → Executable file
@@ -1,15 +1,33 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
# Clean and create distribution folder
|
||||
MINIMALLIB_OUTPUT_PATH="Code/MinimalLib/dist"
|
||||
cwd=$(realpath $0)
|
||||
cwd=$(dirname $cwd)
|
||||
cwd=$(dirname $cwd)
|
||||
cd $cwd
|
||||
MINIMALLIB_OUTPUT_PATH=$(realpath dist)
|
||||
rm -rf $MINIMALLIB_OUTPUT_PATH
|
||||
mkdir -p $MINIMALLIB_OUTPUT_PATH
|
||||
|
||||
# Build distribution files
|
||||
RDKIT_BRANCH=${1:-master}
|
||||
RDKIT_GIT_URL=${2:-"https://github.com/rdkit/rdkit.git"}
|
||||
echo "Building distribution files for release $RDKIT_BRANCH from repo $RDKIT_GIT_URL"
|
||||
DOCKER_BUILDKIT=1 docker build --no-cache -f docker/Dockerfile --build-arg RDKIT_BRANCH=$RDKIT_BRANCH --build-arg RDKIT_GIT_URL=$RDKIT_GIT_URL -o $MINIMALLIB_OUTPUT_PATH .
|
||||
if [ "$GET_SRC" = copy_from_local ]; then
|
||||
echo "Building distribution files from local source tree"
|
||||
docker-compose -f docker/docker_compose_build_minimallib.yml build \
|
||||
--no-cache \
|
||||
--build-arg "EXCEPTION_HANDLING=-fwasm-exceptions"
|
||||
else
|
||||
RDKIT_BRANCH=${1:-master}
|
||||
RDKIT_GIT_URL=${2:-"https://github.com/rdkit/rdkit.git"}
|
||||
echo "Building distribution files for release $RDKIT_BRANCH from repo $RDKIT_GIT_URL"
|
||||
GET_SRC=clone_from_github docker-compose -f docker/docker_compose_build_minimallib.yml build \
|
||||
--no-cache \
|
||||
--build-arg "EXCEPTION_HANDLING=-fwasm-exceptions" \
|
||||
--build-arg "RDKIT_GIT_URL=$RDKIT_GIT_URL" \
|
||||
--build-arg "RDKIT_GIT_BRANCH=$RDKIT_BRANCH"
|
||||
fi
|
||||
DOCKER_BUILDKIT=1 docker build -f docker/Dockerfile_4_rdkit_export -o $MINIMALLIB_OUTPUT_PATH .
|
||||
|
||||
# Make files executable
|
||||
chmod a+rwx $MINIMALLIB_OUTPUT_PATH/RDKit_minimal.js
|
||||
|
||||
Reference in New Issue
Block a user