Simplify docker setup
This commit is contained in:
@@ -0,0 +1,4 @@
|
|||||||
|
.editorconfig
|
||||||
|
.codeclimate.yml
|
||||||
|
*.png
|
||||||
|
*.md
|
||||||
+8
-10
@@ -1,11 +1,14 @@
|
|||||||
FROM docker.io/alpine:3.7
|
FROM docker.io/alpine:3.8
|
||||||
|
|
||||||
ENV UID=1337 \
|
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 \
|
RUN apk add --no-cache \
|
||||||
python3-dev \
|
python3-dev \
|
||||||
|
build-base \
|
||||||
py3-virtualenv \
|
py3-virtualenv \
|
||||||
py3-pillow \
|
py3-pillow \
|
||||||
py3-aiohttp \
|
py3-aiohttp \
|
||||||
@@ -14,17 +17,12 @@ RUN apk add --no-cache \
|
|||||||
py3-numpy \
|
py3-numpy \
|
||||||
py3-asn1crypto \
|
py3-asn1crypto \
|
||||||
py3-sqlalchemy \
|
py3-sqlalchemy \
|
||||||
build-base \
|
py3-markdown \
|
||||||
ffmpeg \
|
ffmpeg \
|
||||||
bash \
|
|
||||||
ca-certificates \
|
ca-certificates \
|
||||||
su-exec \
|
su-exec \
|
||||||
s6 \
|
|
||||||
&& cd /opt/mautrixtelegram \
|
|
||||||
&& cp -r docker/root/* / \
|
|
||||||
&& rm docker -rf \
|
|
||||||
&& pip3 install -r requirements.txt -r optional-requirements.txt
|
&& pip3 install -r requirements.txt -r optional-requirements.txt
|
||||||
|
|
||||||
VOLUME /data
|
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 {
|
function fixperms {
|
||||||
chown -R ${UID}:${GID} /data /opt/mautrixtelegram
|
chown -R $UID:$GID /data /opt/mautrix-telegram
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cd /opt/mautrix-telegram
|
||||||
# Go into env
|
|
||||||
cd /opt/mautrixtelegram
|
|
||||||
export FFMPEG_BINARY=/usr/bin/ffmpeg
|
|
||||||
|
|
||||||
# Replace database path in config.
|
# Replace database path in config.
|
||||||
sed -i "s#sqlite:///mautrix-telegram.db#sqlite:////data/mautrix-telegram.db#" /data/config.yaml
|
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
|
# Check that database is in the right state
|
||||||
alembic -x config=/data/config.yaml upgrade head
|
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
|
||||||
echo "Didn't find a config file."
|
echo "Didn't find a config file."
|
||||||
echo "Copied default config file to /data/config.yaml"
|
echo "Copied default config file to /data/config.yaml"
|
||||||
@@ -26,14 +26,14 @@ if [[ ! -f /data/config.yaml ]]; then
|
|||||||
exit
|
exit
|
||||||
fi
|
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
|
python3 -m mautrix_telegram -g -c /data/config.yaml -r /data/registration.yaml
|
||||||
echo "Didn't find a registration file."
|
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."
|
echo "Copy that over to synapses app service directory."
|
||||||
fixperms
|
fixperms
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fixperms
|
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 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
s6-svscanctl -t /etc/s6.d
|
|
||||||
Reference in New Issue
Block a user