1
0
Fork 0

feat: migrate to baseimage
the build was successful Details

This commit is contained in:
Jan Christian Grünhage 2018-01-06 11:35:52 +01:00
parent 71518d7921
commit f7868ae828
Signed by: jcgruenhage
GPG Key ID: 6594C449C633D10C
6 changed files with 58 additions and 66 deletions

6
.drone.yml Normal file
View File

@ -0,0 +1,6 @@
pipeline:
docker:
image: plugins/docker
repo: docker.jcg.re/synapse
registry: docker.jcg.re
secrets: [ docker_username, docker_password ]

View File

@ -1,36 +1,31 @@
FROM alpine:edge
MAINTAINER Jan Christian Grünhage
FROM docker.jcg.re/base-alpine
MAINTAINER Jan Christian Grünhage <jan.christian@gruenhage.xyz>
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
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 \
&& 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"]
ADD root /
VOLUME /data
EXPOSE 8448 8008

2
root/etc/s6.d/synapse/finish Executable file
View File

@ -0,0 +1,2 @@
#!/bin/sh
exec /bin/true

4
root/etc/s6.d/synapse/run Executable file
View File

@ -0,0 +1,4 @@
#!/bin/sh
cd /data
exec su-exec ${UID}:${GID} python2 -m synapse.app.homeserver \
--config-path /data/config/homeserver.yaml

17
root/usr/local/bin/generate Executable file
View File

@ -0,0 +1,17 @@
#!/bin/sh
chown ${UID}:${GID} /data
[[ -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"
[[ "${REPORT_STATS}" != "yes" ]] && [[ "${REPORT_STATS}" != "no" ]] && \
echo "STOP! REPORT_STATS needs to be 'no' or 'yes'" && breakup="1"
[[ "${breakup}" == "1" ]] && exit 1
su-exec ${UID}:${GID} python2 -m synapse.app.homeserver \
-c /data/config/homeserver.yaml \
--generate-config \
-H ${SERVER_NAME} \
--report-stats ${REPORT_STATS}
sed -e 's#/homeserver.db#/data/database/homeserver.db#' \
-e 's#/homeserver.log#/data/log/homeserver.log#' \
-e 's#/media_store#/data/media_store#' \
-e 's#/uploads#/data/uploads#' -i /data/config/homeserver.yaml

View File

@ -1,32 +0,0 @@
#!/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