docker-compose compatibility

This commit is contained in:
Aeris 2021-09-03 02:46:08 +02:00
parent 8ef02aec12
commit 485026be21
2 changed files with 23 additions and 2 deletions

View file

@ -94,8 +94,12 @@ RUN set -x \
FROM alpine
RUN apk add --no-cache ca-certificates
RUN apk add --no-cache ca-certificates sqlite
COPY --from=builder /tmp/whatsxmpp /whatsxmpp
ENTRYPOINT /whatsxmpp
ADD schema.sql /
ADD docker-entrypoint.sh /
ENTRYPOINT /docker-entrypoint.sh

17
docker-entrypoint.sh Executable file
View file

@ -0,0 +1,17 @@
#!/bin/sh
if [ ! -f /data/data.sqlite3 ]; then
echo "Creating new Database!"
sqlite3 /data/data.sqlite3 < /schema.sql
sqlite3 /data/data.sqlite3 "INSERT INTO configuration (rev, server, port, component_name, shared_secret, upload_component_name) VALUES (1, \"$SERVER\", \"$PORT\", \"$COMPONENT_NAME\", \"$SECRET\", \"$UPLOAD_NAME\"); " ".exit"
fi
if [ ! -z $MAM ]; then
sqlite3 /data/data.sqlite3 "UPDATE configuration SET allow_archiving = true;" ".exit"
fi
if [ ! -z $HISTORY ]; then
sqlite3 /data/data.sqlite3 "UPDATE configuration SET allow_history_fetches = true;" ".exit"
fi
/whatsxmpp /data/data.sqlite3