forked from openfrontier/docker-gerrit
/
Dockerfile
98 lines (70 loc) · 2.49 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
FROM openjdk:8-jre-alpine
MAINTAINER zsx <thinkernel@gmail.com>
# Overridable defaults
ENV GERRIT_HOME /var/gerrit
ENV GERRIT_SITE ${GERRIT_HOME}/review_site
ENV GERRIT_WAR ${GERRIT_HOME}/gerrit.war
ENV GERRIT_VERSION 3.2.2
ENV GERRIT_USER gerrit
ENV GERRIT_INIT_ARGS ""
ENV GERRIT_CORE_PLUGINS "hooks \
delete-project \
commit-message-length-validator \
reviewnotes \
replication \
download-commands \
singleusergroup \
codemirror-editor"
# Add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
RUN adduser -D -h "${GERRIT_HOME}" -g "Gerrit User" -s /sbin/nologin "${GERRIT_USER}"
RUN set -x \
&& apk add --update --no-cache git openssh-client openssl bash perl perl-cgi git-gitweb curl su-exec procmail jq
RUN mkdir /docker-entrypoint-init.d
# Download gerrit.war
RUN curl -fSsL https://gerrit-releases.storage.googleapis.com/gerrit-${GERRIT_VERSION}.war -o $GERRIT_WAR
# Only for local test
#COPY gerrit-${GERRIT_VERSION}.war $GERRIT_WAR
ENV PLUGIN_VERSIONS stable-3.2,master-stable-3.2,master,master-master
# Download Plugins
COPY get-plugin.sh /
# events-log
# This plugin is required by gerrit-trigger plugin of Jenkins.
RUN /get-plugin.sh events-log
# metrics-reporter-graphite
RUN /get-plugin.sh metrics-reporter-graphite
# metrics-reporter-prometheus
RUN /get-plugin.sh metrics-reporter-prometheus
# lfs
RUN /get-plugin.sh lfs
# oauth plugin
RUN /get-plugin.sh oauth
# readonly
RUN /get-plugin.sh readonly
# rabbitmq
RUN /get-plugin.sh rabbitmq
# admin-console
RUN /get-plugin.sh admin-console
# healthcheck
RUN /get-plugin.sh healthcheck
# reviewers
RUN /get-plugin.sh reviewers
# owners
RUN /get-plugin.sh owners
# owners-autoassign
RUN /get-plugin.sh owners-autoassign
# find-owners
RUN /get-plugin.sh find-owners
# audit-sl4j
RUN /get-plugin.sh audit-sl4j "" gerritforge lastBuild
# Ensure the entrypoint scripts are in a fixed location
COPY gerrit-entrypoint.sh /
COPY gerrit-start.sh /
# A directory has to be created before a volume is mounted to it.
# So gerrit user can own this directory.
RUN su-exec ${GERRIT_USER} mkdir -p $GERRIT_SITE
# Gerrit site directory is a volume, so configuration and repositories
# can be persisted and survive image upgrades.
VOLUME $GERRIT_SITE
ENTRYPOINT ["/gerrit-entrypoint.sh"]
EXPOSE 8080 29418
CMD ["/gerrit-start.sh"]