Build Gerrit on top of our python-base images

This is done for a number of reasons. First it will allow us to update
the python version used in the images as we can have a 3.10 builder and
base images (but not a 3.10 openjdk:11 image). Second it will allow us
to easily switch to openjdk 17 by simply updating the package we install
and some paths for the jdk location.

The goal here is to have more control over the images so that we can do
things like change python and java versions when we want to.

Depends-On: https://review.opendev.org/c/opendev/jeepyb/+/870873
Change-Id: I7ea2658caf71336d582c01be17a91759e9ac2043
This commit is contained in:
Clark Boylan 2023-01-17 15:24:40 -08:00 committed by Ian Wienand
parent ed14a9805b
commit c95726ed1e
No known key found for this signature in database
4 changed files with 14 additions and 10 deletions

View File

@ -20,17 +20,17 @@ FROM docker.io/opendevorg/python-builder:3.9-bullseye as builder
COPY . /tmp/src
RUN assemble
FROM docker.io/library/openjdk:11-bullseye as gerrit-base
FROM docker.io/opendevorg/python-base:3.9-bullseye as gerrit-base
RUN echo 'APT::Install-Recommends "0";' > /etc/apt/apt.conf.d/95disable-recommends
RUN apt-get update \
&& apt-get install -y dumb-init git python3-launchpadlib python3-distutils unzip \
&& apt-get install -y dumb-init git openjdk-11-jre-headless unzip \
# This next set of installs helps align us with the old openjdk image \
# but they may not all be necessary \
&& apt-get install -y xz-utils bzip2 wget curl gnupg \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& curl https://bootstrap.pypa.io/get-pip.py > /tmp/get-pip.py \
&& python3 /tmp/get-pip.py \
&& rm /tmp/get-pip.py
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder /output/ /output
RUN /output/install-from-bindep

View File

@ -35,7 +35,7 @@
{% if gerrit_heap_limit is defined %}
heapLimit = {{ gerrit_heap_limit }}
{% endif %}
javaHome = /usr/local/openjdk-11/jre
javaHome = /usr/lib/jvm/java-11-openjdk-amd64
javaOptions = "-Dflogger.backend_factory=com.google.common.flogger.backend.log4j.Log4jBackendFactory#getInstance"
javaOptions = "-Dflogger.logging_context=com.google.gerrit.server.logging.LoggingContext#getInstance"
[gc]

View File

@ -1,4 +1,4 @@
#!/bin/sh
# The /dev/./urandom is not a typo. https://stackoverflow.com/questions/58991966/what-java-security-egd-option-is-for
/usr/local/openjdk-11/bin/java -Djava.security.egd=file:/dev/./urandom ${JAVA_OPTIONS} -jar /var/gerrit/bin/gerrit.war daemon -d /var/gerrit
/usr/lib/jvm/java-11-openjdk-amd64/bin/java -Djava.security.egd=file:/dev/./urandom ${JAVA_OPTIONS} -jar /var/gerrit/bin/gerrit.war daemon -d /var/gerrit

View File

@ -6,7 +6,9 @@
required-projects: &gerrit_base_projects
- opendev/jeepyb
- opendev/system-config
requires: python-builder-3.9-bullseye-container-image
requires:
- python-builder-3.9-bullseye-container-image
- python-base-3.9-bullseye-container-image
provides: gerrit-base-container-image
pre-run: &gerrit-base_prerun
- playbooks/zuul/gerrit/base.yaml
@ -24,7 +26,9 @@
name: system-config-upload-image-gerrit-base
description: Build and upload a gerrit-base image.
parent: system-config-upload-image
requires: python-builder-3.9-bullseye-container-image
requires:
- python-builder-3.9-bullseye-container-image
- python-base-3.9-bullseye-container-image
provides: gerrit-base-container-image
pre-run: *gerrit-base_prerun
required-projects: *gerrit_base_projects