# # Copyright (C) 2018 XueTong Tech Co., Ltd. # # 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 ubuntu:16.04 MAINTAINER xt COPY sources.list /etc/apt/sources.list # Add Gerrit packages repository # Allow remote connectivity and sudo # Install OpenJDK and Gerrit in two subsequent transactions # (pre-trans Gerrit script needs to have access to the Java command) RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 1871F775 && \ apt-get update && \ apt-key update && \ apt-get -y install openssh-client sudo && \ apt-get -y install openjdk-8-jdk && \ apt-get -y install gerrit=2.16.8-1 && \ rm -f /var/gerrit/logs/* && \ rm -rf /var/lib/apt/lists/* COPY jre/java.security /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/security/java.security USER gerrit RUN java -jar /var/gerrit/bin/gerrit.war init --batch --install-all-plugins -d /var/gerrit && \ java -jar /var/gerrit/bin/gerrit.war reindex -d /var/gerrit && \ git config -f /var/gerrit/etc/gerrit.config --add container.javaOptions "-Djava.security.egd=file:/dev/./urandom" ENV TZ=Asia/Shanghai ENV CANONICAL_WEB_URL= # Allow incoming traffic EXPOSE 29418 8080 VOLUME ["/var/gerrit"] # Start Gerrit CMD git config -f /var/gerrit/etc/gerrit.config noteDb.changes.autoMigrate true && \ /var/gerrit/bin/gerrit.sh run