Initial Commit

This commit is contained in:
Jan Christian Grünhage 2017-01-27 19:56:04 +01:00
commit 71518d7921
2 changed files with 68 additions and 0 deletions

36
Dockerfile Normal file
View file

@ -0,0 +1,36 @@
FROM alpine:edge
MAINTAINER Jan Christian Grünhage
RUN apk add --update \
python2 \
py-pip \
py-virtualenv \
py-setuptools \
python-dev \
postgresql-dev \
build-base \
linux-headers \
libffi-dev \
jpeg-dev \
tiff-dev \
bash \
sqlite \
su-exec \
openldap-dev \
&& virtualenv -p python2.7 /synapse \
&& source /synapse/bin/activate \
&& pip install --upgrade \
setuptools \
cffi \
incremental \
python-ldap \
psycopg2 \
&& pip install https://github.com/matrix-org/synapse/tarball/master \
&& mkdir /data
ADD root /
VOLUME /data
EXPOSE 8448 8008
ENTRYPOINT ["/usr/local/bin/run.sh"]
CMD ["start"]

32
root/usr/local/bin/run.sh Executable file
View file

@ -0,0 +1,32 @@
#!/usr/bin/env bash
COMMAND="${1}"
prepare() {
chown ${UID}:${GID} /data
cd /synapse
source bin/activate
}
case ${COMMAND} in
"start")
prepare
su-exec ${UID}:${GID} python2 -m synapse.app.homeserver \
--config-path /data/config/homeserver.yaml
;;
"generate")
breakup="0"
[[ -z "${SERVER_NAME}" ]] && echo "STOP! environment variable SERVER_NAME must be set" && breakup="1"
[[ -z "${REPORT_STATS}" ]] && echo "STOP! environment variable REPORT_STATS must be set to 'no' or 'yes'" && breakup="1"
[[ "${breakup}" == "1" ]] && exit 1
[[ "${REPORT_STATS}" != "yes" ]] && [[ "${REPORT_STATS}" != "no" ]] && \
echo "STOP! REPORT_STATS needs to be 'no' or 'yes'" && breakup="1"
prepare
su-exec ${UID}:${GID} python2 -m synapse.app.homeserver \
-c /data/config/homeserver.yaml \
--generate-config \
-H ${SERVER_NAME} \
--report-stats ${REPORT_STATS}
;;
esac