-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
74 lines (63 loc) · 3.69 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
FROM registry.cloudogu.com/official/java:17.0.13-1
LABEL maintainer="[email protected]"
ARG SCM_PKG_URL=https://packages.scm-manager.org/repository/releases/sonia/scm/packaging/unix/3.7.1/unix-3.7.1.tar.gz
ARG SCM_PKG_SHA256=c6043424de183a5676baa52e8f09ad412c18e2ac31d8d3f4709cc11a4d160d61
ARG SCM_CODE_EDITOR_PLUGIN_URL=https://packages.scm-manager.org/repository/plugin-releases/sonia/scm/plugins/scm-code-editor-plugin/3.0.0/scm-code-editor-plugin-3.0.0.smp
ARG SCM_CODE_EDITOR_PLUGIN_SHA256=2d4821f1930bd19407a0bfc386edebc26f2cd03ef6a855e4bb7abaf8bb0a4220
ARG SCM_SCRIPT_PLUGIN_URL=https://packages.scm-manager.org/repository/plugin-releases/sonia/scm/plugins/scm-script-plugin/3.0.0/scm-script-plugin-3.0.0.smp
ARG SCM_SCRIPT_PLUGIN_SHA256=249eaa3bafc8347d940dff1431d353a05e1a14c5c795f58ad2e10e785a73c657
ARG SCM_CAS_PLUGIN_URL=https://packages.scm-manager.org/repository/plugin-releases/sonia/scm/plugins/scm-cas-plugin/3.2.0/scm-cas-plugin-3.2.0.smp
ARG SCM_CAS_PLUGIN_SHA256=516621680507121c7feccb28d9bbf837be31e8223fc672b87147b4f2142ded54
ARG SCM_CES_PLUGIN_URL=https://packages.scm-manager.org/repository/plugin-releases/sonia/scm/plugins/scm-ces-plugin/3.0.0/scm-ces-plugin-3.0.0.smp
ARG SCM_CES_PLUGIN_SHA256=860e71fc1c2120ba1c515d15dcbbc696c2101d044641f852d38657638fea85f2
# scm-server environment
ENV SCM_HOME=/var/lib/scm \
SCM_REQUIRED_PLUGINS=/opt/scm-server/required-plugins \
SSL_CERT_FILE=/opt/scm-server/conf/ca-certificates.crt \
CES_TOKEN_HEADER=X-CES-Token \
CES_TOKEN_CONFIGURATION_KEY=serviceaccount_token \
# mark as webapp for nginx
SERVICE_8080_TAGS="webapp" \
SERVICE_8080_NAME="scm"
## install scm-server
RUN set -x -o errexit -o nounset -o pipefail \
&& apk update \
&& apk upgrade \
&& apk add --no-cache graphviz ttf-dejavu mercurial jq unzip curl \
&& curl --fail -Lks ${SCM_PKG_URL} -o /tmp/scm-server.tar.gz \
&& echo "${SCM_PKG_SHA256} */tmp/scm-server.tar.gz" | sha256sum -c - \
&& addgroup -S -g 1000 scm \
&& adduser -S -h /opt/scm-server -s /bin/bash -G scm -u 1000 scm \
&& gunzip /tmp/scm-server.tar.gz \
&& tar -C /opt -xf /tmp/scm-server.tar \
&& cd /tmp \
# download scm-script-plugin & scm-cas-plugin
&& mkdir ${SCM_REQUIRED_PLUGINS} \
&& curl --fail -Lks ${SCM_CODE_EDITOR_PLUGIN_URL} -o ${SCM_REQUIRED_PLUGINS}/scm-code-editor-plugin.smp \
&& echo "${SCM_CODE_EDITOR_PLUGIN_SHA256} *${SCM_REQUIRED_PLUGINS}/scm-code-editor-plugin.smp" | sha256sum -c - \
&& curl --fail -Lks ${SCM_SCRIPT_PLUGIN_URL} -o ${SCM_REQUIRED_PLUGINS}/scm-script-plugin.smp \
&& echo "${SCM_SCRIPT_PLUGIN_SHA256} *${SCM_REQUIRED_PLUGINS}/scm-script-plugin.smp" | sha256sum -c - \
&& curl --fail -Lks ${SCM_CAS_PLUGIN_URL} -o ${SCM_REQUIRED_PLUGINS}/scm-cas-plugin.smp \
&& echo "${SCM_CAS_PLUGIN_SHA256} *${SCM_REQUIRED_PLUGINS}/scm-cas-plugin.smp" | sha256sum -c - \
&& curl --fail -Lks ${SCM_CES_PLUGIN_URL} -o ${SCM_REQUIRED_PLUGINS}/scm-ces-plugin.smp \
&& echo "${SCM_CES_PLUGIN_SHA256} *${SCM_REQUIRED_PLUGINS}/scm-ces-plugin.smp" | sha256sum -c - \
# cleanup
&& rm -rf /tmp/* /var/cache/apk/* \
# set mercurial system ca-certificates
# see https://github.com/cloudogu/ecosystem/issues/193
&& mkdir /etc/mercurial \
&& printf "[web]\ncacerts = /opt/scm-server/conf/ca-certificates.crt\n" > /etc/mercurial/hgrc
# copy resources after package installation, that we can override package defaults
COPY ./resources /
# set permissions
RUN mkdir -p ${SCM_HOME} \
&& chown scm:scm ${SCM_HOME} \
&& chown -R scm:scm /opt/scm-server
# run scm-manager
WORKDIR ${SCM_HOME}
VOLUME ${SCM_HOME}
EXPOSE 8080 2222
USER scm
HEALTHCHECK CMD doguctl healthy scm || exit 1
# start scm
CMD ["/startup.sh"]