feat: add Dockerfile
Some checks failed
the build failed

This commit is contained in:
Jan Christian Gruenhage 2018-04-16 22:52:50 +01:00
parent 1bf8d195b2
commit 4364a25bc0
4 changed files with 73 additions and 0 deletions

7
.drone.yml Normal file
View file

@ -0,0 +1,7 @@
pipeline:
docker:
image: docker.io/plugins/docker
repo: docker.jcg.re/mautrix-telegram
registry: docker.jcg.re
secrets: [ docker_username, docker_password ]
tags: latest

24
Dockerfile Normal file
View file

@ -0,0 +1,24 @@
FROM docker.jcg.re/base-alpine
RUN apk add --no-cache \
python3-dev \
py3-virtualenv \
build-base \
zlib-dev \
jpeg-dev \
libxslt-dev \
libxml2-dev \
libmagic \
ffmpeg \
bash \
&& mkdir /mautrixtelegram
WORKDIR /mautrixtelegram
RUN virtualenv -p /usr/bin/python3 . \
&& source ./bin/activate \
&& pip install --upgrade https://github.com/tulir/mautrix-telegram/tarball/master#egg=mautrix_telegram[all]
COPY root /
VOLUME /data

View file

@ -0,0 +1,2 @@
#!/bin/bash
s6-svscanctl -t /etc/s6.d

View file

@ -0,0 +1,40 @@
#!/bin/bash
# Define functions
function fixperms {
chown -R ${UID}:${GID} /data
}
# Go into env
cd /mautrixtelegram
source ./bin/activate
# Replace database path in alembic.ini
sed -i "s#sqlite:///mautrix-telegram.db#sqlite:////data/mautrix-telegram.db#" alembic.ini
# Check that database is in the right state
alembic upgrade head
if [[ ! -f /data/config.yaml ]]; then
cp example-config.yaml /data/config.yaml
sed -i "s#sqlite:///mautrix-telegram.db#sqlite:////data/mautrix-telegram.db#" /data/config.yaml
echo "Didn't find a config file."
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
if [[ ! -f /data/registration.yaml ]]; then
python -m mautrix_telegram -g -c /data/config.yaml -f /data/registration.yaml
echo "Didn't find a registration file."
echo "Generated ode for you."
echo "Copy that over to synapses app service directory."
fixperms
exit
fi
fixperms
exec su-exec ${UID}:${GID} python -m mautrix_telegram