]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
(no bug) remove database drivers from "slim" Docker image (#124)
authorDave Miller <justdave@bugzilla.org>
Sun, 28 Apr 2024 04:13:15 +0000 (00:13 -0400)
committerGitHub <noreply@github.com>
Sun, 28 Apr 2024 04:13:15 +0000 (00:13 -0400)
Adds other images that include them, per DB vendor.

18 files changed:
.github/workflows/ci.yml
Bugzilla/DaemonControl.pm
Dockerfile
Makefile.PL
docker-compose.test-pg.yml
docker-compose.test-sqlite.yml [new file with mode: 0644]
docker-compose.test.yml
docker-compose.yml
docker/gen-bugzilla-perl-slim.sh
docker/gen-bugzilla-slim-mysql8.sh [new file with mode: 0644]
docker/gen-bugzilla-slim-pg9.sh [new file with mode: 0644]
docker/gen-cpanfile-snapshot.sh
docker/images/Dockerfile.bugzilla-mysql8 [moved from Dockerfile.bugzilla-slim with 77% similarity]
docker/images/Dockerfile.bugzilla-pg9 [new file with mode: 0644]
docker/images/Dockerfile.bugzilla-slim [new file with mode: 0644]
docker/images/Dockerfile.cpanfile [moved from Dockerfile.cpanfile with 100% similarity]
docker/images/Dockerfile.mysql8 [moved from Dockerfile.mysql8 with 100% similarity]
docker/run-tests-in-docker.sh

index 88c3563b3a5138a15e16aac9a1a413ce822bf16f..0b42b44a4aec3f07670a817c574639f05e748035 100644 (file)
@@ -24,7 +24,7 @@ jobs:
 #      - name: Build the Docker images
 #        run: docker compose -f docker-compose.test.yml build
 #      - name: Run webservice tests
-#        run: docker-compose -f docker-compose.test.yml run bugzilla6.test test_webservices
+#        run: docker compose -f docker-compose.test.yml run bugzilla6.test test_webservices
 
   test_bugzilla6_mysql:
     runs-on: ubuntu-latest
@@ -35,7 +35,7 @@ jobs:
       - name: Build the Docker images
         run: docker compose -f docker-compose.test.yml build
       - name: Run bmo specific tests
-        run: docker-compose -f docker-compose.test.yml run -e CI=1 bugzilla6.test test_bmo -q -f t/bmo/*.t
+        run: docker compose -f docker-compose.test.yml run -e CI=1 bugzilla6.test test_bmo -q -f t/bmo/*.t
 
   test_bugzilla6_pg:
     runs-on: ubuntu-latest
@@ -46,5 +46,16 @@ jobs:
       - name: Build the Docker images
         run: docker compose -f docker-compose.test-pg.yml build
       - name: Run bmo specific tests
-        run: docker-compose -f docker-compose.test-pg.yml run -e CI=1 bugzilla6.test test_bmo -q -f t/bmo/*.t
+        run: docker compose -f docker-compose.test-pg.yml run -e CI=1 bugzilla6.test test_bmo -q -f t/bmo/*.t
+
+  test_bugzilla6_sqlite:
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v4
+      - name: Install docker-compose
+        run: sudo apt update && sudo apt install -y docker-compose
+      - name: Build the Docker images
+        run: docker compose -f docker-compose.test-sqlite.yml build
+      - name: Run bmo specific tests
+        run: docker compose -f docker-compose.test-sqlite.yml run -e CI=1 bugzilla6.test test_bmo -q -f t/bmo/*.t
 
index 40a1de2738b0ee0beaeeeb1105e282dc6600dd92..39095464940ea13f9f6e0e5032fbcb2d2b11484d 100644 (file)
@@ -235,6 +235,13 @@ sub assert_database {
   my $repeat = try_repeat_until_success {
     $loop->delay_future(after => 0.25)->then(sub {
       my $attrs = {RaiseError => 1, PrintError => 1};
+      if ($lc->{db_driver} eq 'sqlite') {
+        # If we're using sqlite, just assume we're connected, since it's just a
+        # file on the local filesystem. The driver will automatically create
+        # the DB file if it doesn't exist yet when checksetup runs.
+        Future->wrap("done");
+        return;
+      }
       if ($lc->{db_driver} eq 'mysql') {
         my ($ssl_ca_file, $ssl_ca_path, $ssl_cert, $ssl_key, $ssl_pubkey) =
           @$lc{qw(db_mysql_ssl_ca_file db_mysql_ssl_ca_path
index 85fdc8a7bc4dae06fbf7f54001a92d5ec4d7d613..44cca0f828b7e71581ca254fb3e578a70fff48cd 100644 (file)
@@ -1,4 +1,5 @@
-FROM bugzilla/bugzilla-perl-slim:20240322.1
+ARG BZDB="-mysql8"
+FROM bugzilla/bugzilla-perl-slim${BZDB}:20240410.1
 
 ENV DEBIAN_FRONTEND noninteractive
 
index ae5bc4f6f66671e4a42c78474a1629e55fa67e65..1fd18e7f7baa87f0a62215318775908b33f29dcc 100755 (executable)
@@ -159,6 +159,12 @@ my %optional_features = (
       runtime => {requires => {'File::Which' => 0, 'File::Copy::Recursive' => 0,}}
     },
   },
+  docker => {
+    description => 'Run Bugzilla inside Docker',
+    prereqs     => {
+      runtime => {requires => {'File::Copy::Recursive' => 0,}}
+    },
+  },
   graphical_reports => {
     description => 'Graphical Reports',
     prereqs     => {
index cd6deee5e63cbebad4c8a614f3e52e1ef4dd210b..06479194df047fb2b56688922756a95273ddbcc4 100644 (file)
@@ -7,6 +7,8 @@ version: '3.6'
 services:
   bugzilla6.test:
     build:
+      args:
+        - BZDB=-pg9
       context: .
       dockerfile: Dockerfile
     command: dev_httpd
@@ -59,5 +61,5 @@ services:
   selenium:
     image: selenium/standalone-firefox:3.141.59
     shm_size: '512m'
-    ports:
-      - "5900:5900"
+    #ports:
+    #  - "5900:5900"
diff --git a/docker-compose.test-sqlite.yml b/docker-compose.test-sqlite.yml
new file mode 100644 (file)
index 0000000..18d6e83
--- /dev/null
@@ -0,0 +1,53 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+version: '3.6'
+
+services:
+  bugzilla6.test:
+    build:
+      args:
+        - BZDB=
+      context: .
+      dockerfile: Dockerfile
+    command: dev_httpd
+    tmpfs:
+      - /tmp
+      - /run
+    environment:
+      - 'BMO_inbound_proxies=*'
+      - BMO_db_driver=sqlite
+      - BMO_db_host=localhost
+      - BMO_db_name=bugs
+      - BMO_db_pass=bugs
+      - BMO_db_user=bugs
+      - BMO_memcached_namespace=bugzilla
+      - BMO_memcached_servers=memcached:11211
+      - BMO_ses_username=ses@mozilla.bugs
+      - BMO_ses_password=password123456789!
+      - BMO_urlbase=AUTOMATIC
+      - BUGZILLA_ALLOW_INSECURE_HTTP=1
+      - BZ_ANSWERS_FILE=/app/conf/checksetup_answers.txt
+      - BZ_QA_ANSWERS_FILE=/app/.github/checksetup_answers.txt
+      - BZ_QA_CONF_FILE=/app/.github/selenium_test.conf
+      - BZ_QA_CONFIG=1
+      - LOCALCONFIG_ENV=1
+      - LOG4PERL_CONFIG_FILE=log4perl-test.conf
+      - LOGGING_PORT=5880
+      - PORT=8000
+      - TWD_BROWSER=firefox
+      - TWD_HOST=selenium
+      - TWD_PORT=4444
+    depends_on:
+      - memcached
+      - selenium
+
+  memcached:
+    image: memcached:latest
+
+  selenium:
+    image: selenium/standalone-firefox:3.141.59
+    shm_size: '512m'
+    #ports:
+    #  - "5900:5900"
index 5a6b06a4c3a01fb3fd013ee811307214571d58cc..f4f574066d9a19a68a88147fea0ae4626a005d6a 100644 (file)
@@ -43,7 +43,9 @@ services:
       - selenium
 
   bugzilla6.mysql8:
-    image: mysql:8
+    build:
+      context: .
+      dockerfile: docker/images/Dockerfile.mysql8
     tmpfs:
       - /tmp
     logging:
@@ -60,5 +62,5 @@ services:
   selenium:
     image: selenium/standalone-firefox:3.141.59
     shm_size: '512m'
-    ports:
-      - "5900:5900"
+    #ports:
+    #  - "5900:5900"
index 1e2fa04e4ee5c4b0cfe8cd543b5cb88c028da61a..299f951bd51976fcbd7e3b92a46c5b74dd4aad22 100644 (file)
@@ -97,7 +97,7 @@ services:
   bugzilla6.mysql8:
     build:
       context: .
-      dockerfile: Dockerfile.mysql8
+      dockerfile: docker/images/Dockerfile.mysql8
     volumes:
       - bugzilla6-mysql-db:/var/lib/mysql
     tmpfs:
index c1d757d79a7e660eebc0a2d525815064825d7535..95a4ca16588a54b1064aea2efbdea9b0906db6ff 100644 (file)
@@ -46,13 +46,20 @@ if [ $? != 0 ]; then
     echo
     exit -1
 fi
+if [ ! -f "docker/images/Dockerfile.bugzilla-slim" ]; then
+    echo
+    echo "Can't locate the Dockerfile, try running from the root of"
+    echo "your Bugzilla checkout."
+    echo
+    exit -1
+fi
 
 export DOCKER_CLI_HINTS=false
 export CI=""
 export CIRCLE_SHA1=""
 export CIRCLE_BUILD_URL=""
-$DOCKER build -t bugzilla-cpanfile -f Dockerfile.cpanfile .
-$DOCKER run -it -v "$(pwd):/app/result" bugzilla-cpanfile cp cpanfile cpanfile.snapshot /app/result
+#$DOCKER build -t bugzilla-cpanfile -f Dockerfile.cpanfile .
+#$DOCKER run -it -v "$(pwd):/app/result" bugzilla-cpanfile cp cpanfile cpanfile.snapshot /app/result
 
 # Figure out the tag name to use for the image. We'll do this by generating
 # a code based on today's date, then attempt to pull it from DockerHub. If
@@ -66,7 +73,7 @@ while [ $? == 0 ]; do
     ((ITER++))
     $DOCKER pull bugzilla/bugzilla-perl-slim:${DATE}.${ITER} >/dev/null 2>/dev/null
 done
-$DOCKER build -t bugzilla/bugzilla-perl-slim:${DATE}.${ITER} -f Dockerfile.bugzilla-slim .
+$DOCKER build -t bugzilla/bugzilla-perl-slim:${DATE}.${ITER} -f docker/images/Dockerfile.bugzilla-slim .
 if [ $? == 0 ]; then
     echo
     echo "The build appears to have succeeded. Don't forget to change the FROM line"
diff --git a/docker/gen-bugzilla-slim-mysql8.sh b/docker/gen-bugzilla-slim-mysql8.sh
new file mode 100644 (file)
index 0000000..2341f33
--- /dev/null
@@ -0,0 +1,113 @@
+#!/bin/bash
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+# This Source Code Form is "Incompatible With Secondary Licenses", as
+# defined by the Mozilla Public License, v. 2.0.
+
+if [ ! -e 'Makefile.PL' ]; then
+    echo
+    echo "Please run this from the root of the Bugzilla source tree."
+    echo
+    exit -1
+fi
+if [ -z "$DOCKER" ]; then
+    DOCKER=`which docker`
+fi
+if [ ! -x "$DOCKER" ]; then
+    echo
+    echo "You specified a custom Docker executable via the DOCKER"
+    echo "environment variable at $DOCKER"
+    echo "which either does not exist or is not executable."
+    echo "Please fix it to point at a working Docker or remove the"
+    echo "DOCKER environment variable to use the one in your PATH"
+    echo "if it exists."
+    echo
+    exit -1
+fi
+if [ -z "$DOCKER" ]; then
+    echo
+    echo "You do not appear to have docker installed or I can't find it."
+    echo "Windows and Mac versions can be downloaded from"
+    echo "https://www.docker.com/products/docker-desktop"
+    echo "Linux users can install using your package manager."
+    echo
+    echo "Please install docker or specify the location of the docker"
+    echo "executable in the DOCKER environment variable and try again."
+    echo
+    exit -1
+fi
+$DOCKER info 1>/dev/null 2>/dev/null
+if [ $? != 0 ]; then
+    echo
+    echo "The docker daemon is not running or I can't connect to it."
+    echo "Please make sure it's running and try again."
+    echo
+    exit -1
+fi
+if [ ! -f "docker/images/Dockerfile.bugzilla-mysql8" ]; then
+    echo
+    echo "Can't locate the Dockerfile, try running from the root of"
+    echo "your Bugzilla checkout."
+    echo
+    exit -1
+fi
+
+export DOCKER_CLI_HINTS=false
+export CI=""
+export CIRCLE_SHA1=""
+export CIRCLE_BUILD_URL=""
+
+# Figure out the tag name to use for the image. We'll do this by generating
+# a code based on today's date, then attempt to pull it from DockerHub. If
+# we successfully pull, then it already exists, and we bump the interation
+# number on the end.
+DATE=`date +"%Y%m%d"`
+ITER=1
+$DOCKER pull bugzilla/bugzilla-perl-slim-mysql8:${DATE}.${ITER} >/dev/null 2>/dev/null
+while [ $? == 0 ]; do
+    # as long as we succesfully pull, keep bumping the number on the end
+    ((ITER++))
+    $DOCKER pull bugzilla/bugzilla-perl-slim-mysql8:${DATE}.${ITER} >/dev/null 2>/dev/null
+done
+$DOCKER build -t bugzilla/bugzilla-perl-slim-mysql8:${DATE}.${ITER} -f docker/images/Dockerfile.bugzilla-mysql8 .
+if [ $? == 0 ]; then
+    echo
+    echo "The build appears to have succeeded. Don't forget to change the FROM line"
+    echo "at the top of Dockerfile to use:"
+    echo "  bugzilla/bugzilla-perl-slim-mysql8:${DATE}.${ITER}"
+    echo "to make use of this image."
+    echo
+    # check if the user is logged in
+    if [ -z "$PYTHON" ]; then
+        PYTHON=`which python`
+    fi
+    if [ -z "$PYTHON" ]; then
+        PYTHON=`which python3`
+    fi
+    if [ ! -x "$PYTHON" ]; then
+        echo "The python executable specified in your PYTHON environment value or your PATH is not executable or I can't find it."
+        exit -1
+    fi
+    AUTHINFO=`$PYTHON -c "import json; print(len(json.load(open('${HOME}/.docker/config.json','r',encoding='utf-8'))['auths']))"`
+    if [ $AUTHINFO -gt 0 ]; then
+        # user is logged in
+        read -p "Do you wish to push to DockerHub? [y/N]: " yesno
+        case $yesno in
+            [Yy]*)
+                echo "Pushing..."
+                $DOCKER push bugzilla/bugzilla-perl-slim-mysql8:${DATE}.${ITER}
+                ;;
+            *)
+                echo "Not pushing. You can just run this script again when you're ready"
+                echo "to push. The prior build result is cached."
+                ;;
+        esac
+    fi
+else
+    echo
+    echo "Docker build failed. See output above."
+    echo
+    exit -1
+fi
diff --git a/docker/gen-bugzilla-slim-pg9.sh b/docker/gen-bugzilla-slim-pg9.sh
new file mode 100644 (file)
index 0000000..92710d5
--- /dev/null
@@ -0,0 +1,113 @@
+#!/bin/bash
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+# This Source Code Form is "Incompatible With Secondary Licenses", as
+# defined by the Mozilla Public License, v. 2.0.
+
+if [ ! -e 'Makefile.PL' ]; then
+    echo
+    echo "Please run this from the root of the Bugzilla source tree."
+    echo
+    exit -1
+fi
+if [ -z "$DOCKER" ]; then
+    DOCKER=`which docker`
+fi
+if [ ! -x "$DOCKER" ]; then
+    echo
+    echo "You specified a custom Docker executable via the DOCKER"
+    echo "environment variable at $DOCKER"
+    echo "which either does not exist or is not executable."
+    echo "Please fix it to point at a working Docker or remove the"
+    echo "DOCKER environment variable to use the one in your PATH"
+    echo "if it exists."
+    echo
+    exit -1
+fi
+if [ -z "$DOCKER" ]; then
+    echo
+    echo "You do not appear to have docker installed or I can't find it."
+    echo "Windows and Mac versions can be downloaded from"
+    echo "https://www.docker.com/products/docker-desktop"
+    echo "Linux users can install using your package manager."
+    echo
+    echo "Please install docker or specify the location of the docker"
+    echo "executable in the DOCKER environment variable and try again."
+    echo
+    exit -1
+fi
+$DOCKER info 1>/dev/null 2>/dev/null
+if [ $? != 0 ]; then
+    echo
+    echo "The docker daemon is not running or I can't connect to it."
+    echo "Please make sure it's running and try again."
+    echo
+    exit -1
+fi
+if [ ! -f "docker/images/Dockerfile.bugzilla-pg9" ]; then
+    echo
+    echo "Can't locate the Dockerfile, try running from the root of"
+    echo "your Bugzilla checkout."
+    echo
+    exit -1
+fi
+
+export DOCKER_CLI_HINTS=false
+export CI=""
+export CIRCLE_SHA1=""
+export CIRCLE_BUILD_URL=""
+
+# Figure out the tag name to use for the image. We'll do this by generating
+# a code based on today's date, then attempt to pull it from DockerHub. If
+# we successfully pull, then it already exists, and we bump the interation
+# number on the end.
+DATE=`date +"%Y%m%d"`
+ITER=1
+$DOCKER pull bugzilla/bugzilla-perl-slim-pg9:${DATE}.${ITER} >/dev/null 2>/dev/null
+while [ $? == 0 ]; do
+    # as long as we succesfully pull, keep bumping the number on the end
+    ((ITER++))
+    $DOCKER pull bugzilla/bugzilla-perl-slim-pg9:${DATE}.${ITER} >/dev/null 2>/dev/null
+done
+$DOCKER build -t bugzilla/bugzilla-perl-slim-pg9:${DATE}.${ITER} -f docker/images/Dockerfile.bugzilla-pg9 .
+if [ $? == 0 ]; then
+    echo
+    echo "The build appears to have succeeded. Don't forget to change the FROM line"
+    echo "at the top of Dockerfile to use:"
+    echo "  bugzilla/bugzilla-perl-slim-pg9:${DATE}.${ITER}"
+    echo "to make use of this image."
+    echo
+    # check if the user is logged in
+    if [ -z "$PYTHON" ]; then
+        PYTHON=`which python`
+    fi
+    if [ -z "$PYTHON" ]; then
+        PYTHON=`which python3`
+    fi
+    if [ ! -x "$PYTHON" ]; then
+        echo "The python executable specified in your PYTHON environment value or your PATH is not executable or I can't find it."
+        exit -1
+    fi
+    AUTHINFO=`$PYTHON -c "import json; print(len(json.load(open('${HOME}/.docker/config.json','r',encoding='utf-8'))['auths']))"`
+    if [ $AUTHINFO -gt 0 ]; then
+        # user is logged in
+        read -p "Do you wish to push to DockerHub? [y/N]: " yesno
+        case $yesno in
+            [Yy]*)
+                echo "Pushing..."
+                $DOCKER push bugzilla/bugzilla-perl-slim-pg9:${DATE}.${ITER}
+                ;;
+            *)
+                echo "Not pushing. You can just run this script again when you're ready"
+                echo "to push. The prior build result is cached."
+                ;;
+        esac
+    fi
+else
+    echo
+    echo "Docker build failed. See output above."
+    echo
+    exit -1
+fi
index 9e1ddc896899599dd50e03aa9b249a3c0592f6fe..38676b4cc96fdd41656621e53ac0fb6a7efcd307 100644 (file)
@@ -40,8 +40,15 @@ if [ $? != 0 ]; then
     echo
     exit -1
 fi
+if [ ! -f "docker/images/Dockerfile.cpanfile" ]; then
+    echo
+    echo "Can't locate the Dockerfile, try running from the root of"
+    echo "your Bugzilla checkout."
+    echo
+    exit -1
+fi
 
 export DOCKER_CLI_HINTS=false
-$DOCKER build -t bugzilla-cpanfile -f Dockerfile.cpanfile .
+$DOCKER build -t bugzilla-cpanfile -f docker/images/Dockerfile.cpanfile .
 $DOCKER run -it -v "$(pwd):/app/result" bugzilla-cpanfile cp cpanfile cpanfile.snapshot /app/result
 
similarity index 77%
rename from Dockerfile.bugzilla-slim
rename to docker/images/Dockerfile.bugzilla-mysql8
index 980b014e7f7be4eaa09cb92fb273c8d92344b56e..5d1dff9f6d2e6f71802a0a21bf521b14bb301960 100644 (file)
@@ -1,8 +1,8 @@
-FROM perl:5.38.0-slim AS builder
+FROM bugzilla/bugzilla-perl-slim:20240410.1 AS builder
 
-RUN apt-get update
-RUN apt-get -y dist-upgrade
-RUN apt-get install -y \
+RUN apt-get update \
+ && apt-get dist-upgrade -y \
+ && apt-get install -y \
     apt-file \
     build-essential \
     cmake \
@@ -13,7 +13,9 @@ RUN apt-get install -y \
     libgd-dev \
     libssl-dev \
     openssl \
-    zlib1g-dev
+    zlib1g-dev \
+    unzip \
+    wget
 
 # The Perl image is based on Debian, which doesn't have MySQL 8, and the
 # current DBD::mysql requires MySQL 8 libraries to build, so we have
@@ -23,17 +25,19 @@ RUN gpg --homedir /tmp --no-default-keyring --keyring /usr/share/keyrings/mysql-
  && gpg --homedir /tmp --no-default-keyring --keyring /usr/share/keyrings/mysql-8.0.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys B7B3B788A8D3785C \
  && echo 'deb [arch=amd64 signed-by=/usr/share/keyrings/mysql-8.0.gpg] http://repo.mysql.com/apt/debian/ bookworm mysql-8.0' > /etc/apt/sources.list.d/mysql-8.0.list
 RUN apt-get update \
- && apt-get install -y libmysqlclient-dev libpq-dev
-
-RUN cpanm --notest --quiet App::cpm Module::CPANfile Carton::Snapshot
+ && apt-get install -y libmysqlclient-dev
 
 WORKDIR /app
 
-COPY cpanfile cpanfile.snapshot /app/
+COPY Makefile.PL Bugzilla.pm gen-cpanfile.pl /app/
+COPY extensions/ /app/extensions/
+
+RUN cpanm --notest --quiet App::cpm Module::CPANfile Carton::Snapshot
+
+RUN perl Makefile.PL
+RUN make cpanfile GEN_CPANFILE_ARGS="-D mysql"
 
-RUN cpm install
-# secure mail loop fixes
-RUN cpm install http://s3.amazonaws.com/moz-devservices-bmocartons/third-party/Crypt-OpenPGP-1.15.tar.gz
+RUN carton install
 
 RUN apt-file update
 RUN find local -name '*.so' -exec ldd {} \; \
@@ -43,7 +47,7 @@ RUN find local -name '*.so' -exec ldd {} \; \
     | xargs -IFILE apt-file search -l FILE \
     | sort -u > PACKAGES
 
-FROM perl:5.38.0-slim
+FROM bugzilla/bugzilla-perl-slim:20240410.1
 
 ENV DEBIAN_FRONTEND noninteractive
 
@@ -51,7 +55,12 @@ COPY --from=builder /app/local /app/local
 COPY --from=builder /app/PACKAGES /app/PACKAGES
 
 RUN apt-get update \
- && apt-get install -y gnupg
+    && apt-get install -y \
+       gnupg
+
+# The Perl image is based on Debian, which doesn't have MySQL 8, and the
+# current DBD::mysql requires MySQL 8 libraries to build, so we have
+# to get the client libraries from mysql.com
 RUN gpg --homedir /tmp --no-default-keyring --keyring /usr/share/keyrings/mysql-8.0.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 5072E1F5 \
  && gpg --homedir /tmp --no-default-keyring --keyring /usr/share/keyrings/mysql-8.0.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3A79BD29 \
  && gpg --homedir /tmp --no-default-keyring --keyring /usr/share/keyrings/mysql-8.0.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys B7B3B788A8D3785C \
@@ -59,14 +68,7 @@ RUN gpg --homedir /tmp --no-default-keyring --keyring /usr/share/keyrings/mysql-
 
 RUN apt-get update \
     && apt-get install -y \
-       curl \
-       git \
-       graphviz \
-       libcap2-bin \
        libmysqlclient21 \
-       postgresql-client \
-       rsync \
        $(cat /app/PACKAGES) \
     && rm -rf /var/cache/apt/* /var/lib/apt/lists/*
 
-RUN useradd -u 10001 -U app -m && setcap 'cap_net_bind_service=+ep' /usr/local/bin/perl
diff --git a/docker/images/Dockerfile.bugzilla-pg9 b/docker/images/Dockerfile.bugzilla-pg9
new file mode 100644 (file)
index 0000000..7698e85
--- /dev/null
@@ -0,0 +1,67 @@
+FROM bugzilla/bugzilla-perl-slim:20240410.1 AS builder
+
+# reinstall the build prereqs on the temporary image
+RUN apt-get update \
+ && apt-get dist-upgrade -y \
+ && apt-get install -y \
+    apt-file \
+    build-essential \
+    cmake \
+    curl \
+    git \
+    libcairo-dev \
+    libexpat-dev \
+    libgd-dev \
+    libssl-dev \
+    openssl \
+    zlib1g-dev \
+    unzip \
+    wget
+
+# install any custom build prereqs we need for this specific image
+# Postgres libraries in this case
+RUN apt-get install -y libpq-dev
+
+WORKDIR /app
+
+COPY Makefile.PL Bugzilla.pm gen-cpanfile.pl /app/
+COPY extensions/ /app/extensions/
+
+RUN cpanm --notest --quiet App::cpm Module::CPANfile Carton::Snapshot
+
+# GEN_CPANFILE_ARGS here needs to have the list of additional features
+# this images is supposed to contain
+# Postgres support in this case
+RUN perl Makefile.PL
+RUN make cpanfile GEN_CPANFILE_ARGS="-D pg"
+
+RUN carton install
+
+# make a list of all of the packages needed to run the libraries we've
+# installed
+RUN apt-file update
+RUN find local -name '*.so' -exec ldd {} \; \
+    | egrep -v 'not.found|not.a.dynamic.executable' \
+    | awk '$3 {print $3}' \
+    | sort -u \
+    | xargs -IFILE apt-file search -l FILE \
+    | sort -u > PACKAGES
+
+# now we start over with a new image so the final image doesn't contain
+# developer tools
+FROM bugzilla/bugzilla-perl-slim:20240410.1
+
+ENV DEBIAN_FRONTEND noninteractive
+
+# copy the stuff we built over from the temporary image
+COPY --from=builder /app/local /app/local
+COPY --from=builder /app/PACKAGES /app/PACKAGES
+
+# restore the package dependencies we saved earlier, and install any additional packages this image needs to contain.
+# The Postgres client libraries in this case.
+RUN apt-get update \
+    && apt-get install -y \
+       postgresql-client \
+       $(cat /app/PACKAGES) \
+    && rm -rf /var/cache/apt/* /var/lib/apt/lists/*
+
diff --git a/docker/images/Dockerfile.bugzilla-slim b/docker/images/Dockerfile.bugzilla-slim
new file mode 100644 (file)
index 0000000..8553134
--- /dev/null
@@ -0,0 +1,60 @@
+FROM perl:5.38.0-slim AS builder
+
+RUN apt-get update \
+ && apt-get dist-upgrade -y \
+ && apt-get install -y \
+    apt-file \
+    build-essential \
+    cmake \
+    curl \
+    git \
+    libcairo-dev \
+    libexpat-dev \
+    libgd-dev \
+    libssl-dev \
+    openssl \
+    zlib1g-dev \
+    unzip \
+    wget
+
+RUN cpanm --notest --quiet App::cpm Module::CPANfile Carton::Snapshot
+
+WORKDIR /app
+
+COPY Makefile.PL Bugzilla.pm gen-cpanfile.pl /app/
+COPY extensions/ /app/extensions/
+
+RUN perl Makefile.PL
+RUN make cpanfile GEN_CPANFILE_ARGS="-D better_xff -D jsonrpc -D xmlrpc -D docker"
+
+RUN carton install
+
+# secure mail loop fixes
+RUN cpm install http://s3.amazonaws.com/moz-devservices-bmocartons/third-party/Crypt-OpenPGP-1.15.tar.gz
+
+RUN apt-file update
+RUN find local -name '*.so' -exec ldd {} \; \
+    | egrep -v 'not.found|not.a.dynamic.executable' \
+    | awk '$3 {print $3}' \
+    | sort -u \
+    | xargs -IFILE apt-file search -l FILE \
+    | sort -u > PACKAGES
+
+FROM perl:5.38.0-slim
+
+ENV DEBIAN_FRONTEND noninteractive
+
+COPY --from=builder /app/local /app/local
+COPY --from=builder /app/PACKAGES /app/PACKAGES
+
+RUN apt-get update \
+    && apt-get install -y \
+       curl \
+       git \
+       graphviz \
+       libcap2-bin \
+       rsync \
+       $(cat /app/PACKAGES) \
+    && rm -rf /var/cache/apt/* /var/lib/apt/lists/*
+
+RUN useradd -u 10001 -U app -m && setcap 'cap_net_bind_service=+ep' /usr/local/bin/perl
index fd76880e628af4aafa91179479be4f89052cd085..e254998891836205ce7c28710c9bb826a58e686f 100644 (file)
@@ -54,6 +54,8 @@ export CIRCLE_BUILD_URL=""
 DOCKER_COMPOSE_FILE=docker-compose.test.yml
 if [ "$1" == "pg" ]; then
     DOCKER_COMPOSE_FILE=docker-compose.test-pg.yml
+elif [ "$1" == "sqlite" ]; then
+    DOCKER_COMPOSE_FILE=docker-compose.test-sqlite.yml
 fi
 $DOCKER compose -f $DOCKER_COMPOSE_FILE build
 if [ $? == 0 ]; then