Merge pull request #22 from matrix-org/travis-docker

Add a simple dockerfile (and other stuff for early bot support)
This commit is contained in:
Travis Ralston 2019-10-09 12:53:36 +01:00 committed by GitHub
commit 6b4f958d53
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 47 additions and 1 deletions

18
Dockerfile Normal file
View File

@ -0,0 +1,18 @@
FROM python:3.7-slim-stretch
# Many of these dependencies are required to build the app's dependencies, so staging these out doesn't help much
RUN mkdir -p /app
RUN apt-get update && apt-get install -y git gcc clang cmake pkg-config libdbus-1-dev libglib2.0-dev libcairo2-dev python3-dev libgirepository1.0-dev wget
WORKDIR /app
RUN wget https://gitlab.matrix.org/matrix-org/olm/-/archive/master/olm-master.tar.bz2 \
&& tar -xvf olm-master.tar.bz2 \
&& cd olm-master && make && make PREFIX="/usr" install && cd ../ \
&& rm -r olm-master
COPY . /app
RUN pip install . PyGObject && python setup.py install
VOLUME /data
ENTRYPOINT ["pantalaimon"]
CMD ["-c", "/data/pantalaimon.conf", "--data-path", "/data"]

View File

@ -67,6 +67,32 @@ cd notification-daemon-mac-py
./notify.py
```
### Docker
An experimental Docker image can be built for Pantalaimon, primarily for use in bots.
```bash
docker build -t pantalaimon .
# Create a pantalaimon.conf before running. The directory mentioned in the
# volume below is for where Pantalaimon should dump some data.
docker run -it --rm -v /path/to/pantalaimon/dir:/data -p 8008:8008 pantalaimon
```
An example `pantalaimon.conf` for Docker is:
```conf
[Default]
LogLevel = Debug
SSL = True
[local-matrix]
Homeserver = https://matrix.org
ListenAddress = 0.0.0.0
ListenPort = 8008
SSL = False
UseKeyring = False
IgnoreVerification = True
```
### Experimental E2E search support.
Pantalaimon can handle the search endpoint of a Matrix server as well, providing

View File

@ -128,8 +128,9 @@ async def message_router(receive_queue, send_queue, proxies):
default=None,
)
@click.option("-c", "--config", type=click.Path(exists=True))
@click.option("--data-path", type=click.Path(exists=True))
@click.pass_context
def main(context, log_level, config):
def main(context, log_level, config, data_path):
loop = asyncio.get_event_loop()
conf_dir = user_config_dir("pantalaimon", "")
@ -137,6 +138,7 @@ def main(context, log_level, config):
create_dirs(data_dir, conf_dir)
config = config or os.path.join(conf_dir, "pantalaimon.conf")
data_dir = data_path or data_dir
if log_level:
log_level = parse_log_level(log_level)