forked from silvio/docker-matrix
-
-
Notifications
You must be signed in to change notification settings - Fork 19
/
Dockerfile
147 lines (114 loc) · 3.83 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# target architecture
FROM debian:trixie-slim AS builder
# Git branch to build from
ARG BV_SYN=release-v1.120
ARG BV_TUR=master
ARG TAG_SYN=v1.121.0
# user configuration
ENV MATRIX_UID=991 MATRIX_GID=991
# use --build-arg REBUILD=$(date) to invalidate the cache and upgrade all
# packages
ARG REBUILD=1
RUN set -ex \
&& export ARCH=`dpkg --print-architecture` \
&& export MARCH=`uname -m` \
&& touch /synapse.version \
&& export DEBIAN_FRONTEND=noninteractive \
&& mkdir -p /var/cache/apt/archives \
&& touch /var/cache/apt/archives/lock \
&& apt-get clean \
&& apt-get update -y -q --fix-missing\
&& apt-get upgrade -y
RUN apt-get install -y --no-install-recommends rustc cargo file gcc git libevent-dev libffi-dev libgnutls28-dev libjpeg62-turbo-dev libldap2-dev libsasl2-dev libsqlite3-dev \
libssl-dev libtool libxml2-dev libxslt1-dev make zlib1g-dev python3-dev python3-setuptools libpq-dev pkg-config libicu-dev g++
RUN apt-get install -y --no-install-recommends \
bash \
coreutils \
coturn \
libjpeg62-turbo \
libssl3 \
libtool \
libxml2 \
libxslt1.1 \
pwgen \
libffi8 \
sqlite3 \
python3 \
python3-pip \
python3-jinja2 \
python3-venv
RUN groupadd -r -g $MATRIX_GID matrix
RUN useradd -r -d /matrix -m -u $MATRIX_UID -g matrix matrix
RUN git clone --branch $BV_SYN --depth 1 https://github.com/element-hq/synapse.git /synapse
RUN cd /synapse \
&& git checkout -b tags/$TAG_SYN
RUN chown -R $MATRIX_UID:$MATRIX_GID /matrix
RUN chown -R $MATRIX_UID:$MATRIX_GID /synapse
RUN chown -R $MATRIX_UID:$MATRIX_GID /synapse.version
RUN python3 -m venv /matrix/venv
RUN . /matrix/venv/bin/activate
ENV PATH=/matrix/venv/bin:$PATH
RUN pip3 install --upgrade wheel ;\
pip3 install --upgrade psycopg2;\
pip3 install --upgrade setuptools ;\
pip3 install --upgrade python-ldap ;\
pip3 install --force-reinstall -v "Twisted==24.7.0" ;\
pip3 install --upgrade redis ;\
pip3 install --upgrade cryptography ;\
pip3 install --upgrade lxml ; \
pip3 install --upgrade pyicu
RUN cd /synapse \
&& pip3 install --upgrade .[all]
RUN cd /synapse \
&& GIT_SYN=$(git ls-remote https://github.com/element-hq/synapse $BV_SYN | cut -f 1) \
&& echo "synapse: $BV_SYN ($GIT_SYN)" >> /synapse.version
USER root
RUN rm -rf /matrix/.cargo \
rm -rf /matrix/.cache
FROM debian:trixie-slim
# Maintainer
LABEL maintainer="Andreas Peters <support@aventer.biz>"
LABEL org.opencontainers.image.title="docker-matrix"
LABEL org.opencontainers.image.description="The one fits all docker image for synapse (matrix) chat server."
LABEL org.opencontainers.image.vendor="AVENTER UG (haftungsbeschränkt)"
LABEL org.opencontainers.image.source="https://github.com/AVENTER-UG/docker-matrix"
# install homerserver template
COPY adds/start.sh /start.sh
ENV COTURN_ENABLE=true
ENV MATRIX_UID=991 MATRIX_GID=991
ENV REPORT_STATS=no
RUN groupadd -r -g $MATRIX_GID matrix
RUN useradd -r -d /matrix -m -u $MATRIX_UID -g matrix matrix
RUN mkdir /data \
mkdir /uploads
RUN apt-get update -y -q --fix-missing
RUN apt-get upgrade -y
RUN apt-get install -y --no-install-recommends \
bash \
coturn \
sqlite3 \
zlib1g \
libjpeg62-turbo \
libtool \
libxml2 \
libxslt1.1 \
libffi8 \
python3 \
python3-venv \
pwgen
RUN rm -rf /var/lib/apt/* /var/cache/apt/*
RUN chown -R $MATRIX_UID:$MATRIX_GID /data
RUN chown -R $MATRIX_UID:$MATRIX_GID /uploads
COPY --from=builder /matrix /matrix
COPY --from=builder /synapse.version /synapse.version
RUN chown -R $MATRIX_UID:$MATRIX_GID /matrix
RUN chmod 777 /matrix
RUN chmod 777 /synapse.version
USER matrix
RUN python3 -m venv /matrix/venv
RUN . /matrix/venv/bin/activate
ENV PATH=/matrix/venv/bin:$PATH
EXPOSE 8448
ENTRYPOINT ["/start.sh"]
CMD ["autostart"]
#ENV LD_PRELOAD="/usr/lib/libjemalloc.so.2"