mirror of
https://github.com/maubot/maubot
synced 2025-09-03 03:30:38 +00:00
docker : cleanup and fixes
- run as dedicated user instead of root - avoid running sed on a already existing config.yaml - fix typo in sed command for db line
This commit is contained in:
parent
2736a1f47f
commit
8c58048169
2 changed files with 17 additions and 16 deletions
|
@ -8,9 +8,12 @@ RUN apk add --no-cache \
|
||||||
py3-attrs \
|
py3-attrs \
|
||||||
py3-bcrypt \
|
py3-bcrypt \
|
||||||
py3-cffi \
|
py3-cffi \
|
||||||
ca-certificates \
|
ca-certificates &&\
|
||||||
&& pip3 install -r requirements.txt
|
pip3 install -r requirements.txt &&\
|
||||||
|
mkdir -p /data /var/log/maubot &&\
|
||||||
|
adduser -D maubot &&\
|
||||||
|
chown -R maubot: /opt/maubot /data /var/log/maubot
|
||||||
|
|
||||||
VOLUME /data
|
VOLUME /data
|
||||||
|
USER maubot
|
||||||
CMD ["/opt/maubot/docker-run.sh"]
|
CMD ["/opt/maubot/docker-run.sh"]
|
||||||
|
|
|
@ -2,21 +2,19 @@
|
||||||
|
|
||||||
cd /opt/maubot
|
cd /opt/maubot
|
||||||
|
|
||||||
# Replace database path in config.
|
mkdir -p /data/plugins /data/trash /data/dbs
|
||||||
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#upload: ./plugins#upload: /data/plugins#" /data/config.yaml
|
|
||||||
sed -i "s#trash: ./trash#trash: /data/trash#" /data/config.yaml
|
|
||||||
sed -i "s#db: ./plugins#trash: /data/dbs#" /data/config.yaml
|
|
||||||
sed -i "s#./logs/maubot.log#/var/log/maubot/maubot.log#" /data/config.yaml
|
|
||||||
|
|
||||||
mkdir -p /var/log/maubot /data/plugins /data/trash /data/dbs
|
|
||||||
|
|
||||||
# Check that database is in the right state
|
|
||||||
alembic -x config=/data/config.yaml upgrade head
|
|
||||||
|
|
||||||
if [ ! -f /data/config.yaml ]; then
|
if [ ! -f /data/config.yaml ]; then
|
||||||
cp example-config.yaml /data/config.yaml
|
cp example-config.yaml /data/config.yaml
|
||||||
|
|
||||||
|
# Replace database path in example 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#upload: ./plugins#upload: /data/plugins#" /data/config.yaml
|
||||||
|
sed -i "s#trash: ./trash#trash: /data/trash#" /data/config.yaml
|
||||||
|
sed -i "s#db: ./plugins#db: /data/dbs#" /data/config.yaml
|
||||||
|
sed -i "s#./logs/maubot.log#/var/log/maubot/maubot.log#" /data/config.yaml
|
||||||
|
|
||||||
echo "Config file not found. Example config copied to /data/config.yaml"
|
echo "Config file not found. Example config copied to /data/config.yaml"
|
||||||
echo "Please modify the config file to your liking and restart the container."
|
echo "Please modify the config file to your liking and restart the container."
|
||||||
exit
|
exit
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue