diff --git a/docker/Dockerfile b/docker/Dockerfile index 03808af..9511044 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -42,7 +42,8 @@ RUN apk add --no-cache \ python3-dev ENV PROJECT_DIR="/opt/matrix_alertbot" -ENV LIBOLM_SRC_DIR="/opt/olm" +ENV LIBOLM_SRC_DIR="/usr/local/src/olm" +ENV LIBOLM_INSTALL_DIR="/opt/olm" ENV VIRTUAL_ENV="${PROJECT_DIR}/.venv" ENV PATH="$VIRTUAL_ENV/bin:$PATH" RUN python -m venv "${VIRTUAL_ENV}" @@ -54,7 +55,7 @@ WORKDIR "${PROJECT_DIR}" # We will later copy contents from both of these folders to the runtime # container COPY docker/build_and_install_libolm.sh /scripts/ -RUN /scripts/build_and_install_libolm.sh "${LIBOLM_VERSION}" "${LIBOLM_SRC_DIR}}" +RUN /scripts/build_and_install_libolm.sh "${LIBOLM_VERSION}" "${LIBOLM_SRC_DIR}" "${LIBOLM_INSTALL_DIR}" # Install python runtime modules. We do this before copying the source code # such that these dependencies can be cached @@ -64,7 +65,7 @@ COPY matrix_alertbot/__init__.py ./matrix_alertbot/ COPY README.md matrix-alertbot ./ # Build the dependencies -COPY setup.py ./setup.py +COPY setup.py setup.cfg ./ RUN pip install --no-warn-script-location ".[e2e]" # Now copy the source code diff --git a/docker/build_and_install_libolm.sh b/docker/build_and_install_libolm.sh index b9cd1ed..9cb7028 100755 --- a/docker/build_and_install_libolm.sh +++ b/docker/build_and_install_libolm.sh @@ -2,11 +2,11 @@ # # Call with the following arguments: # -# ./build_and_install_libolm.sh +# ./build_and_install_libolm.sh # # Example: # -# ./build_and_install_libolm.sh 3.1.4 /python-bindings +# ./build_and_install_libolm.sh 3.1.4 /usr/local/src/olm /python-bindings # # Note that if a python bindings installation directory is not supplied, bindings will # be installed to the default directory. @@ -14,8 +14,18 @@ set -ex +if [[ $# -ne 3 ]]; then + echo "Usage: $0 " + exit 1 +fi + +version="$1" +src_dir="$2" +install_dir="$3" + # Download the specified version of libolm -git clone -b "$1" https://gitlab.matrix.org/matrix-org/olm.git olm && cd olm +git clone -b "$version" https://gitlab.matrix.org/matrix-org/olm.git "$src_dir" +cd "$src_dir" # Build libolm cmake . -Bbuild @@ -25,8 +35,9 @@ cmake --build build make install # Build the python3 bindings -cd python && make olm-python3 +cd python +make olm-python3 # Install python3 bindings -mkdir -p "$2" || true -DESTDIR="$2" make install-python3 +mkdir -p "$install_dir" || true +DESTDIR="$install_dir" make install-python3 diff --git a/setup.cfg b/setup.cfg index 8309605..9a24810 100644 --- a/setup.cfg +++ b/setup.cfg @@ -40,7 +40,7 @@ test = pytest [options.entry_points] console_scripts = - matrix-alertbot = matrix_alertbot:main.main + matrix-alertbot = matrix_alertbot.main:main [options.extras_require] test =