Add FDB to all images; add new Ubuntu focal image
diff --git a/bin/apt-dependencies.sh b/bin/apt-dependencies.sh
index 03a9841..6bdd57f 100755
--- a/bin/apt-dependencies.sh
+++ b/bin/apt-dependencies.sh
@@ -30,7 +30,7 @@
 # TODO: support Mint, Devuan, etc.
 
 # Check if running as root
-if [[ ${EUID} -ne 0 ]]; then
+if [ ${EUID} -ne 0 ]; then
   echo "Sorry, this script must be run as root."
   echo "Try: sudo $0 $*"
   exit 1
@@ -43,11 +43,11 @@
 . ${SCRIPTPATH}/detect-arch.sh >/dev/null
 . ${SCRIPTPATH}/detect-os.sh >/dev/null
 debians='(wheezy|jessie|stretch|buster)'
-ubuntus='(precise|trusty|xenial|artful|bionic)'
+ubuntus='(xenial|bionic|focal)'
 echo "Detected Ubuntu/Debian version: ${VERSION_CODENAME}   arch: ${ARCH}"
 
 # bionic Docker image seems to be missing /etc/timezone...
-if [[ ! -f /etc/timezone ]]; then
+if [ ! -f /etc/timezone ]; then
   rm -f /etc/localtime
   ln -snf /usr/share/zoneinfo/Etc/UTC /etc/localtime
   echo "Etc/UTC" > /etc/timezone
@@ -60,26 +60,25 @@
 apt-get -y dist-upgrade
 
 # install build-time dependencies
-if [[ ${VERSION_CODENAME} == "trusty" ]]; then
-  VENV=python3.4-venv
-else
-  VENV=python3-venv
-fi
 
 # build deps, doc build deps, pkg building, then userland helper stuff
 apt-get install -y apt-transport-https curl git pkg-config \
-    python3 libpython3-dev python3-setuptools python3-pip ${VENV} \
+    python3 libpython3-dev python3-setuptools python3-pip python3-venv \
     sudo wget zip unzip \
     build-essential ca-certificates libcurl4-openssl-dev \
     libicu-dev libnspr4-dev \
     help2man python3-sphinx \
-    curl debhelper devscripts dh-exec dh-python equivs \
+    curl debhelper devscripts dh-exec dh-python dh-systemd equivs \
     dialog equivs lintian libwww-perl quilt \
-    reprepro createrepo rsync \
+    reprepro rsync \
     vim-tiny screen procps
 
-if [[ ${VERSION_CODENAME} == "xenial" ]]; then
-  apt remove -y ${VENV}
+# python 2 based; gone from focal / bullseye. look for createrepo_c eventually
+# hopefully via: https://github.com/rpm-software-management/createrepo_c/issues/145
+apt-get install -y createrepo || true
+
+if [ ${VERSION_CODENAME} == "xenial" ]; then
+  apt remove -y python3-venv
   apt install -y software-properties-common
   add-apt-repository ppa:deadsnakes/ppa
   apt-get update
@@ -95,15 +94,21 @@
   apt-get install -y nodejs npm
 else
   wget https://deb.nodesource.com/setup_${NODEVERSION}.x
-  /bin/bash setup_${NODEVERSION}.x
-  apt-get install -y nodejs
+  if /bin/bash setup_${NODEVERSION}.x; then
+    apt-get install -y nodejs
+  fi
   rm setup_${NODEVERSION}.x
 fi
 # maybe install node from scratch if pkg install failed...
 if [ -z "$(which node)" ]; then
   apt-get purge -y nodejs || true
   # extracting the right version to dl is a pain :(
-  node_filename="$(curl -s https://nodejs.org/dist/latest-v${NODEVERSION}.x/SHASUMS256.txt | grep linux-${ARCH}.tar.gz | cut -d ' ' -f 3)"
+  if [ ${ARCH} == "x86_64" ]; then
+    NODEARCH=x64
+  else
+    NODEARCH=${ARCH}
+  fi
+  node_filename="$(curl -s https://nodejs.org/dist/latest-v${NODEVERSION}.x/SHASUMS256.txt | grep linux-${NODEARCH}.tar.gz | cut -d ' ' -f 3)"
   wget https://nodejs.org/dist/latest-v${NODEVERSION}.x/${node_filename}
   tar --directory=/usr --strip-components=1 -xzf ${node_filename}
   rm ${node_filename}
@@ -127,17 +132,12 @@
 # rest of python dependencies
 pip3 --default-timeout=10000 install --upgrade sphinx_rtd_theme nose requests hypothesis==3.79.0
 
-# install dh-systemd if available
-if [[ ${VERSION_CODENAME} != "precise" ]]; then
-  apt-get install -y dh-systemd
-fi
-
 # relaxed lintian rules for CouchDB
 mkdir -p /usr/share/lintian/profiles/couchdb
 chmod 0755 /usr/share/lintian/profiles/couchdb
 if [[ ${VERSION_CODENAME} =~ ${debians} ]]; then
   cp ${SCRIPTPATH}/../files/debian.profile /usr/share/lintian/profiles/couchdb/main.profile
-  if [[ ${VERSION_CODENAME} == "jessie" ]]; then
+  if [ ${VERSION_CODENAME} == "jessie" ]; then
     # remove unknown lintian rule privacy-breach-uses-embedded-file
     sed -i -e 's/, privacy-breach-uses-embedded-file//' /usr/share/lintian/profiles/couchdb/main.profile
     # add rule to suppress python-script-but-no-python-dep
@@ -145,7 +145,7 @@
   fi
 elif [[ ${VERSION_CODENAME} =~ ${ubuntus} ]]; then
   cp ${SCRIPTPATH}/../files/ubuntu.profile /usr/share/lintian/profiles/couchdb/main.profile
-  if [[ ${VERSION_CODENAME} == "xenial" ]]; then
+  if [ ${VERSION_CODENAME} == "xenial" ]; then
     # add rule to suppress python-script-but-no-python-dep
     sed -i -e 's/Disable-Tags: /Disable-Tags: python-script-but-no-python-dep, /' /usr/share/lintian/profiles/couchdb/main.profile
   fi
@@ -154,21 +154,28 @@
 fi
 
 MAINPROFILE=/usr/share/lintian/profiles/couchdb/main.profile
-if [[ -e ${MAINPROFILE} ]]; then
+if [ -e ${MAINPROFILE} ]; then
     chmod 0644 ${MAINPROFILE}
 fi
 
 # js packages, as long as we're not told to skip them
-if [[ $1 != "nojs" ]]; then
-  # config the CouchDB repo & install the JS packages
-  echo "deb https://apache.bintray.com/couchdb-deb ${VERSION_CODENAME} main" | \
-      sudo tee /etc/apt/sources.list.d/couchdb.list
-  apt-key adv --keyserver keyserver.ubuntu.com --recv-keys \
-      8756C4F765C9AC3CB6B85D62379CE192D401AB61
-  apt-get update && apt-get install -y couch-libmozjs185-dev
-  if [ "${VERSION_CODENAME}" == "buster" ]; then
+if [ $1 != "nojs" ]; then
+  # older releases don't have libmozjs60+, and we provide 1.8.5
+  if [ "${VERSION_CODENAME}" != "focal" && "${VERSION_CODENAME}" != "bullseye" ]; then
+    echo "deb https://apache.bintray.com/couchdb-deb ${VERSION_CODENAME} main" | \
+    sudo tee /etc/apt/sources.list.d/couchdb.list
+    apt-key adv --keyserver keyserver.ubuntu.com --recv-keys \
+        8756C4F765C9AC3CB6B85D62379CE192D401AB61
+    apt-get update
+    apt-get install -y couch-libmozjs185-dev
+  fi
+  # newer releases have newer libmozjs
+  if [ "${VERSION_CODENAME}" != "xenial" && "${VERSION_CODENAME}" != "stretch" ]; then
     apt-get install -y libmozjs-60-dev
   fi
+  if [ "${VERSION_CODENAME}" != "focal" ]; then
+    apt-get install -y libmozjs-68-dev
+  fi
 else
   # install js build-time dependencies only
   # we can't add the CouchDB repo here because the plat may not exist yet
diff --git a/bin/yum-dependencies.sh b/bin/yum-dependencies.sh
index 23cbcce..fb6407c 100755
--- a/bin/yum-dependencies.sh
+++ b/bin/yum-dependencies.sh
@@ -202,11 +202,13 @@
 if [[ ${VERSION_ID} -eq 6 ]]; then
   wget https://www.foundationdb.org/downloads/6.2.15/rhel6/installers/foundationdb-clients-6.2.15-1.el6.x86_64.rpm
   wget https://www.foundationdb.org/downloads/6.2.15/rhel6/installers/foundationdb-server-6.2.15-1.el6.x86_64.rpm
+  yum --nogpgcheck localinstall -y foundationdb*rpm
 else
   wget https://www.foundationdb.org/downloads/6.2.15/rhel7/installers/foundationdb-clients-6.2.15-1.el7.x86_64.rpm
   wget https://www.foundationdb.org/downloads/6.2.15/rhel7/installers/foundationdb-server-6.2.15-1.el7.x86_64.rpm
+  # Buggy FoundationDB packages require this workaround
+  rpm -i --nodeps ./foundationdb*rpm
 fi
-yum --nogpgcheck localinstall -y foundationdb*rpm
 pkill -f fdb || true
 pkill -f foundation || true
 
diff --git a/build.sh b/build.sh
index 48f3ebe..77aabf8 100755
--- a/build.sh
+++ b/build.sh
@@ -38,11 +38,8 @@
 # some platforms!
 
 DEBIANS="debian-stretch debian-buster"
-UBUNTUS="ubuntu-xenial ubuntu-bionic"
-debs="(debian-stretch|debian-buster|ubuntu-xenial|ubuntu-bionic)"
-
+UBUNTUS="ubuntu-xenial ubuntu-bionic ubuntu-focal"
 CENTOSES="centos-6 centos-7 centos-8"
-rpms="(centos-6|centos-7|centos-8)"
 
 BINTRAY_API="https://api.bintray.com"
 
diff --git a/dockerfiles/ubuntu-focal b/dockerfiles/ubuntu-focal
new file mode 100644
index 0000000..16cff23
--- /dev/null
+++ b/dockerfiles/ubuntu-focal
@@ -0,0 +1,56 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you 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
+
+# NOTE: These are intended to be built using the arguments as
+# described in ../build.sh. See that script for more details.
+
+FROM ubuntu:focal
+
+# Choose whether to install SpiderMonkey 1.8.5, default yes
+ARG js=js
+# Choose whether to install Erlang, default yes
+ARG erlang=erlang
+# Select version of Node, Erlang and Elixir to install
+ARG erlangversion=20.3.8.25-1
+ARG elixirversion=v1.9.1
+ARG nodeversion=10
+
+# Create Jenkins user and group
+RUN groupadd --gid 910 jenkins; \
+  useradd --uid 910 --gid jenkins --create-home jenkins
+
+# Copy couchdb-ci repo into root's home directory
+ADD --chown=root:root bin /root/couchdb-ci/bin/
+ADD --chown=root:root files /root/couchdb-ci/files/
+
+# Jenkins builds in /usr/src/couchdb.
+RUN mkdir -p /usr/src/couchdb; \
+  chown -R jenkins:jenkins /usr/src/couchdb
+
+# Install all dependencies, and optionally SM 1.8.5
+# This allows us to use the same Dockerfile for building SM
+RUN ERLANGVERSION=$erlangversion \
+  ELIXIRVERSION=$elixirversion \
+  NODEVERSION=$nodeversion \
+  /root/couchdb-ci/bin/install-dependencies.sh $js $erlang
+
+# Allow Jenkins to sudo
+RUN echo "jenkins ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/jenkins
+
+USER jenkins
+
+# overwrite this with 'CMD []' in a dependent Dockerfile
+CMD ["/bin/bash"]