feat: migrate to baseimage
All checks were successful
the build was successful

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

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