Update docker setup

This commit is contained in:
Tulir Asokan 2018-10-18 15:31:18 +03:00
parent 3337ac52ea
commit ac5f059ef4
2 changed files with 4 additions and 14 deletions

View File

@ -1,18 +1,12 @@
FROM alpine:3.8
ENV UID=1338 \
GID=1338
COPY . /opt/maubot
WORKDIR /opt/maubot
RUN apk add --no-cache \
python3-dev \
build-base \
py3-aiohttp \
py3-sqlalchemy \
py3-attrs \
ca-certificates \
su-exec \
&& pip3 install -r requirements.txt
VOLUME /data

View File

@ -1,15 +1,13 @@
#!/bin/sh
# Define functions.
function fixperms {
chown -R $UID:$GID /data /opt/maubot
}
cd /opt/maubot
# Replace database path in config.
sed -i "s#sqlite:///maubot.db#sqlite:////data/maubot.db#" /data/config.yaml
sed -i "s#- ./plugins#- /data/plugins#" /data/config.yaml
sed -i "s#./logs/maubot.log#/var/log/maubot/maubot.log#" /data/config.yaml
mkdir -p /var/log/maubot
# Check that database is in the right state
alembic -x config=/data/config.yaml upgrade head
@ -20,9 +18,7 @@ if [ ! -f /data/config.yaml ]; then
echo "Copied default config file to /data/config.yaml"
echo "Modify that config file to your liking."
echo "Start the container again after that to generate the registration file."
fixperms
exit
fi
fixperms
exec su-exec $UID:$GID python3 -m maubot -c /data/config.yaml
python3 -m maubot -c /data/config.yaml