From a387476d909a92a4b8943d55f10d8ec2789683da Mon Sep 17 00:00:00 2001 From: Buster Neece Date: Fri, 13 Jan 2023 00:46:27 -0600 Subject: [PATCH] Switch to directly using Ubuntu image. --- Dockerfile | 10 +++++++++- util/docker/mariadb/setup/mariadb.sh | 24 +++++++++++++++++++++--- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index ce023bd34..bced6664f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,13 +12,21 @@ RUN go install github.com/aptible/supercronic@v0.2.1 RUN go install github.com/centrifugal/centrifugo/v4@v4.1.2 +# +# MariaDB dependencies build step +# +FROM mariadb:10.9-jammy AS mariadb + # # Final build image # -FROM mariadb:10.9-jammy +FROM ubuntu:jammy ENV TZ="UTC" +COPY --from=mariadb /usr/local/bin/healthcheck.sh /usr/local/bin/db_healthcheck.sh +COPY --from=mariadb /usr/local/bin/docker-entrypoint.sh /usr/local/bin/db_entrypoint.sh + # Add Dockerize COPY --from=go-dependencies /go/bin/dockerize /usr/local/bin COPY --from=go-dependencies /go/bin/supercronic /usr/local/bin/supercronic diff --git a/util/docker/mariadb/setup/mariadb.sh b/util/docker/mariadb/setup/mariadb.sh index f036ba746..7e08e1511 100644 --- a/util/docker/mariadb/setup/mariadb.sh +++ b/util/docker/mariadb/setup/mariadb.sh @@ -2,10 +2,28 @@ set -e set -x -# MariaDB setup is handled by the "parent" image. +apt-get install apt-transport-https curl +curl -o /etc/apt/trusted.gpg.d/mariadb_release_signing_key.asc 'https://mariadb.org/mariadb_release_signing_key.asc' +echo 'deb https://mirrors.gigenet.com/mariadb/repo/10.9/ubuntu jammy main' >> /etc/apt/sources.list -mv /usr/local/bin/healthcheck.sh /usr/local/bin/db_healthcheck.sh -mv /usr/local/bin/docker-entrypoint.sh /usr/local/bin/db_entrypoint.sh +apt-get update + +{ \ + echo "mariadb-server" mysql-server/root_password password 'unused'; \ + echo "mariadb-server" mysql-server/root_password_again password 'unused'; \ +} | debconf-set-selections + +apt-get install -q -y --no-install-recommends mariadb-server mariadb-backup + +# comment out a few problematic configuration values +find /etc/mysql/ -name '*.cnf' -print0 \ + | xargs -0 grep -lZE '^(bind-address|log|user\s)' \ + | xargs -rt -0 sed -Ei 's/^(bind-address|log|user\s)/#&/'; + +# don't reverse lookup hostnames, they are usually another container +printf "[mariadb]\nhost-cache-size=0\nskip-name-resolve\n" > /etc/mysql/mariadb.conf.d/05-skipcache.cnf; + +mkdir /docker-entrypoint-initdb.d cp /bd_build/mariadb/mariadb/db.sql /docker-entrypoint-initdb.d/00-azuracast.sql cp /bd_build/mariadb/mariadb/db.cnf.tmpl /etc/mysql/db.cnf.tmpl