fix docker build for dev environment

This commit is contained in:
HgO 2022-08-27 13:44:12 +02:00
parent a393d4766f
commit 79112c7556
3 changed files with 22 additions and 10 deletions

View file

@ -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

View file

@ -2,11 +2,11 @@
#
# Call with the following arguments:
#
# ./build_and_install_libolm.sh <libolm version> <python bindings install dir>
# ./build_and_install_libolm.sh <libolm version> <git source dir> <python bindings install dir>
#
# 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 <libolm version> <source dir> <install dir>"
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

View file

@ -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 =