-
Notifications
You must be signed in to change notification settings - Fork 7
/
Dockerfile.release
77 lines (64 loc) · 2.19 KB
/
Dockerfile.release
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
#!/bin/sh
#
# Copyright 2018-2019 Kopano and its licensors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License, version 3 or
# later, as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
FROM alpine:3.12
LABEL maintainer="[email protected]"
# Expose ports.
EXPOSE 8778
EXPOSE 6778
# Version to include in this Docker image. Default to latest.
ENV VERSION latest
# Define basic environment variables.
ENV EXE=kwmserverd
ENV KWMSERVERD_LISTEN=0.0.0.0:8778
ENV KWMSERVERD_ADMIN_TOKENS_KEY_FILE=kwmserverd_admin_tokens_key
# Defaults which can be overwritten.
ENV ARGS=""
WORKDIR /var/lib/kwmserverd-docker
# Copy Docker specific scripts and ensure they are executable.
COPY \
scripts/docker-entrypoint.sh \
scripts/healthcheck.sh \
/usr/local/bin/
RUN chmod 755 /usr/local/bin/*.sh
# Add Docker specific runtime setup functions.
RUN mkdir /etc/defaults && echo $'\
setup_secrets() { \n\
local adminTokensFile="/run/secrets/${KWMSERVERD_ADMIN_TOKENS_KEY_FILE}" \n\
if [ -f "${adminTokensFile}" ]; then \n\
export KWMSERVERD_ADMIN_TOKENS_KEY="${adminTokensFile}" \n\
fi \n\
}\n\
setup_secrets\n\
' > /etc/defaults/docker-env
SHELL ["/bin/ash", "-eo", "pipefail", "-c"]
# Download
RUN apk add --no-cache \
ca-certificates=20191127-r3 \
curl=7.69.1-r0 \
&& curl -sSL https://download.kopano.io/community/kwmserver:/kopano-kwmserver-${VERSION}.tar.gz | \
tar -C /var/lib/kwmserverd-docker --strip 1 -vxzf - && \
mv ${EXE} /usr/local/bin/${EXE}
# Run as nobody by default is always a good idea.
USER nobody
ENTRYPOINT ["docker-entrypoint.sh"]
CMD [ \
"kwmserverd", \
"serve" \
]
# Health check support is cool too.
HEALTHCHECK --interval=30s --timeout=5s --start-period=30s \
CMD healthcheck.sh --hostname="${KWMSERVERD_LISTEN}" || exit 1