-
Notifications
You must be signed in to change notification settings - Fork 9
Multiple Workspaces
So far the only way I have been able to get this working reliably is to use docker-compose
and multiple services with different configs and Dockerfile
s to build from. Below is a guide on writing your docker-compose
file and Dockerfiles
to run multiple workspaces.
First: You want to run python3 -m slacky
once to setup a base config.json. Then run python3 -m slacky --config <workspace>.json
for each workspace to setup your config in there.
Second: You need to build your Dockerfiles for each service. Below is an example of 2 Dockerfiles for 2 workspaces.
FROM python:3.7.4
MAINTAINER Max Bridgland <mabridgland@protonmail.com>
RUN mkdir -p /usr/src/slacky-workspace1
WORKDIR /usr/src/slacky-workspace1
ADD requirements.txt /usr/src/slacky-workspace1/requirements.txt
RUN pip install -r requirements.txt
RUN apt-get update && apt-get install libopencv-dev python3-opencv -y
ADD . /usr/src/slacky-workspace1
CMD python -m slacky
This would be ./Dockerfile
FROM python:3.7.4
MAINTAINER Max Bridgland <mabridgland@protonmail.com>
RUN mkdir -p /usr/src/slacky-workspace2
WORKDIR /usr/src/slacky-workspace2
ADD requirements.txt /usr/src/slacky-workspace2/requirements.txt
RUN pip install -r requirements.txt
RUN apt-get update && apt-get install libopencv-dev python3-opencv -y
ADD . /usr/src/slacky-workspace2
CMD python -m slacky --config workspace2.json
This would be ./Dockerfile-workspace2
Third: You need to build your docker-compose.yml
file for running your services. Below you can see an example using the two Dockerfiles from above.
version: '3.7'
services:
slacky-workspace1:
build:
context: .
dockerfile: Dockerfile
image: slacky-workspace1
stdin_open: true
tty: true
volumes:
- ./:/usr/src/slacky-workspace1
slacky-workspace2:
build:
context: .
dockerfile: Dockerfile-workspace2
image: slacky-workspace2
stdin_open: true
tty: true
volumes:
- ./:/usr/src/slacky-workspace2
Fourth: Now you can run your services with docker-compose up --build
and it will build both bots for both config files. This means you will have to run config based commands on both bots to get their features (listeners
and customrs
).