diff --git a/Dockerfile b/Dockerfile index bd6830e..91d5bf9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 diff --git a/docker-run.sh b/docker-run.sh index f4bded7..ffeab63 100755 --- a/docker-run.sh +++ b/docker-run.sh @@ -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