2020-08-12 02:37:23 +02:00
|
|
|
# This dockerfile is crafted specifically for development purposes.
|
|
|
|
# Please use `Dockerfile` instead if you wish to deploy for production.
|
|
|
|
#
|
|
|
|
# This file differs as it does not use a builder container, nor does it
|
|
|
|
# reinstall the project's python package after copying the source code,
|
|
|
|
# saving significant time during rebuilds.
|
|
|
|
#
|
|
|
|
# To build the image, run `docker build` command from the root of the
|
|
|
|
# repository:
|
|
|
|
#
|
|
|
|
# docker build -f docker/Dockerfile .
|
|
|
|
#
|
|
|
|
# There is an optional PYTHON_VERSION build argument which sets the
|
|
|
|
# version of python to build against. For example:
|
|
|
|
#
|
2022-01-27 17:35:44 +01:00
|
|
|
# docker build -f docker/Dockerfile --build-arg PYTHON_VERSION=3.10 .
|
2020-08-12 02:37:23 +02:00
|
|
|
#
|
|
|
|
# An optional LIBOLM_VERSION build argument which sets the
|
|
|
|
# version of libolm to build against. For example:
|
|
|
|
#
|
2022-01-27 17:28:47 +01:00
|
|
|
# docker build -f docker/Dockerfile --build-arg LIBOLM_VERSION=3.2.10 .
|
2020-08-12 02:37:23 +02:00
|
|
|
#
|
|
|
|
|
2022-01-27 17:35:44 +01:00
|
|
|
ARG PYTHON_VERSION=3.10
|
2022-01-27 17:27:16 +01:00
|
|
|
FROM docker.io/python:${PYTHON_VERSION}-alpine
|
2020-08-12 02:37:23 +02:00
|
|
|
|
|
|
|
##
|
|
|
|
## Build libolm for matrix-nio e2e support
|
|
|
|
##
|
|
|
|
|
|
|
|
# Install libolm build dependencies
|
2022-01-27 17:28:47 +01:00
|
|
|
ARG LIBOLM_VERSION=3.2.10
|
2020-08-12 02:37:23 +02:00
|
|
|
RUN apk add --no-cache \
|
|
|
|
make \
|
|
|
|
cmake \
|
|
|
|
gcc \
|
|
|
|
g++ \
|
|
|
|
git \
|
|
|
|
libffi-dev \
|
|
|
|
yaml-dev \
|
|
|
|
python3-dev
|
|
|
|
|
|
|
|
# Build libolm
|
|
|
|
COPY docker/build_and_install_libolm.sh /scripts/
|
|
|
|
RUN /scripts/build_and_install_libolm.sh ${LIBOLM_VERSION}
|
|
|
|
|
|
|
|
# Install native runtime dependencies
|
|
|
|
RUN apk add --no-cache \
|
|
|
|
musl-dev \
|
|
|
|
libpq \
|
|
|
|
postgresql-dev \
|
|
|
|
libstdc++
|
|
|
|
|
|
|
|
# Install python runtime modules. We do this before copying the source code
|
|
|
|
# such that these dependencies can be cached
|
2022-06-13 20:55:01 +02:00
|
|
|
RUN mkdir -p /src/matrix_alertbot
|
|
|
|
COPY matrix_alertbot/__init__.py /src/matrix_alertbot/
|
|
|
|
COPY README.md matrix-alertbot /src/
|
2020-08-12 02:37:23 +02:00
|
|
|
COPY setup.py /src/setup.py
|
|
|
|
RUN pip install -e "/src/.[postgres]"
|
|
|
|
|
|
|
|
# Now copy the source code
|
2022-06-13 20:55:01 +02:00
|
|
|
COPY matrix_alertbot/*.py /src/matrix_alertbot/
|
2020-08-12 02:37:23 +02:00
|
|
|
COPY *.py /src/
|
|
|
|
|
|
|
|
# Specify a volume that holds the config file, SQLite3 database,
|
|
|
|
# and the matrix-nio store
|
|
|
|
VOLUME ["/data"]
|
|
|
|
|
|
|
|
# Start the app
|
2022-06-13 20:55:01 +02:00
|
|
|
ENTRYPOINT ["matrix-alertbot", "/data/config.yaml"]
|