
To provide a stepwise upgrade path from 2.13 running directly to 2.15 in a container, make a container image containing the war we're using currently. This should let us make a change to how we run the war without changing the war at all, and then update the war. Instead of trying to make a clean build for gerrit 2.13 inside of a builder image, just have it wget the already built wars and jars we have. There are pieces of this that duplicate what's being done in puppet, but in this context it's not immediately clear these are important to do. However, it's also not clear they're a bad idea. The gerrit 2.15 build needs a newer bazel. Looking at the CI scripts that are used by gerrithub, we find that they use bazel 0.26.1 and nodesource v10. Use the bazel image published by google to get a bazel builder image. Set gerrit uid/git to 3000 in both images to match the existing directory ownership so that bindmounting doesn't face permissions problems. Change-Id: I3533f01c0859ed50640dcfd98023994c5867c056
67 lines
2.5 KiB
Docker
67 lines
2.5 KiB
Docker
# Copyright (c) 2019 Red Hat, Inc.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
# implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
FROM openjdk:8
|
|
|
|
# It's not 100% clear that unzip and libmysql-java are needed
|
|
RUN apt-get update \
|
|
&& apt-get install -y dumb-init wget unzip libmysql-java \
|
|
&& apt-get clean \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# 3000 is what the existing opendev gerrit2 user is
|
|
RUN addgroup gerrit --gid 3000 --system \
|
|
&& adduser \
|
|
--uid 3000 \
|
|
--system \
|
|
--home /var/gerrit \
|
|
--shell /bin/bash \
|
|
--ingroup gerrit \
|
|
gerrit
|
|
|
|
USER gerrit
|
|
|
|
# Download the gerrit war
|
|
RUN mkdir /var/gerrit/bin && \
|
|
wget https://tarballs.openstack.org/gerrit/gerrit-v2.13.12.11.1707fec.war -O /var/gerrit/bin/gerrit.war
|
|
|
|
# Install plugins
|
|
RUN mkdir /var/gerrit/plugins && \
|
|
wget https://tarballs.openstack.org/ci/gerrit/plugins/javamelody/javamelody-v2.13.3.e4233d6.jar -O /var/gerrit/plugins/javamelody.jar && \
|
|
wget https://tarballs.openstack.org/ci/gerrit/plugins/its-storyboard/its-storyboard-805f9ac.jar -O /var/gerrit/plugins/its-storyboard.jar
|
|
|
|
# Force gerrit to use bouncycastle for security things.
|
|
# Also use the distro-provided mysql-connector.
|
|
RUN mkdir /var/gerrit/lib && \
|
|
unzip -jo /var/gerrit/bin/gerrit.war WEB-INF/plugins/* -d /var/gerrit/plugins && \
|
|
wget https://repo1.maven.org/maven2/org/bouncycastle/bcprov-jdk15on/1.52/bcprov-jdk15on-1.52.jar -O /var/gerrit/lib/bcprov-1.52.jar && \
|
|
wget https://repo1.maven.org/maven2/org/bouncycastle/bcpkix-jdk15on/1.52/bcpkix-jdk15on-1.52.jar -O /var/gerrit/lib/bcpkix-1.52.jar && \
|
|
ln -s /usr/share/java/mysql-connector-java.jar /var/gerrit/lib/mysql-connector-java.jar
|
|
|
|
# Allow incoming traffic
|
|
EXPOSE 29418 8080
|
|
|
|
VOLUME /var/gerrit/git /var/gerrit/index /var/gerrit/cache /var/gerrit/db /var/gerrit/etc /var/log/gerrit
|
|
|
|
RUN ln -s /var/log/gerrit /var/gerrit/logs
|
|
|
|
# container.javaOptions
|
|
# Also include container.heapLimit - but with -Xmx prefixing it
|
|
ENV JAVA_OPTIONS ""
|
|
|
|
# Ulimits should be set on command line or in docker-compose.yaml
|
|
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
|
|
CMD ["/usr/bin/java", ${JAVA_OPTIONS}, "-jar", "/var/gerrit/bin/gerrit.war"]
|