Simplify docker setup

This commit is contained in:
Tulir Asokan
2018-07-15 00:49:24 +03:00
parent 2aa0ed3825
commit b4dd05ab04
5 changed files with 23 additions and 24 deletions
+4
View File
@@ -0,0 +1,4 @@
.editorconfig
.codeclimate.yml
*.png
*.md
+8 -10
View File
@@ -1,11 +1,14 @@
FROM docker.io/alpine:3.7
FROM docker.io/alpine:3.8
ENV UID=1337 \
GID=1337
GID=1337 \
FFMPEG_BINARY=/usr/bin/ffmpeg
COPY . /opt/mautrixtelegram
COPY . /opt/mautrix-telegram
WORKDIR /opt/mautrix-telegram
RUN apk add --no-cache \
python3-dev \
build-base \
py3-virtualenv \
py3-pillow \
py3-aiohttp \
@@ -14,17 +17,12 @@ RUN apk add --no-cache \
py3-numpy \
py3-asn1crypto \
py3-sqlalchemy \
build-base \
py3-markdown \
ffmpeg \
bash \
ca-certificates \
su-exec \
s6 \
&& cd /opt/mautrixtelegram \
&& cp -r docker/root/* / \
&& rm docker -rf \
&& pip3 install -r requirements.txt -r optional-requirements.txt
VOLUME /data
CMD ["/bin/s6-svscan", "/etc/s6.d"]
CMD ["/opt/mautrix-telegram/run.sh"]
@@ -1,22 +1,22 @@
#!/bin/bash
#!/bin/sh
# Define functions
# Define functions.
function fixperms {
chown -R ${UID}:${GID} /data /opt/mautrixtelegram
chown -R $UID:$GID /data /opt/mautrix-telegram
}
# Go into env
cd /opt/mautrixtelegram
export FFMPEG_BINARY=/usr/bin/ffmpeg
cd /opt/mautrix-telegram
# Replace database path in config.
sed -i "s#sqlite:///mautrix-telegram.db#sqlite:////data/mautrix-telegram.db#" /data/config.yaml
if [ -f /data/mx-state.json ]; then
ln -s /data/mx-state.json
fi
# 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
echo "Didn't find a config file."
echo "Copied default config file to /data/config.yaml"
@@ -26,14 +26,14 @@ if [[ ! -f /data/config.yaml ]]; then
exit
fi
if [[ ! -f /data/registration.yaml ]]; then
if [ ! -f /data/registration.yaml ]; then
python3 -m mautrix_telegram -g -c /data/config.yaml -r /data/registration.yaml
echo "Didn't find a registration file."
echo "Generated ode for you."
echo "Generated one for you."
echo "Copy that over to synapses app service directory."
fixperms
exit
fi
fixperms
exec su-exec ${UID}:${GID} python3 -m mautrix_telegram -c /data/config.yaml
exec su-exec $UID:$GID python3 -m mautrix_telegram -c /data/config.yaml
-1
View File
@@ -1 +0,0 @@
#!/bin/sh
@@ -1,2 +0,0 @@
#!/bin/bash
s6-svscanctl -t /etc/s6.d