Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create UBI minimal base image #587

Merged
merged 50 commits into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
354d0b5
UBI work in progress
grooverdan Dec 20, 2022
87d6a93
update.sh to handle version.json correctly
grooverdan May 16, 2024
daff177
Ubi repo to archive
grooverdan May 16, 2024
5b74407
Centos stream almost eol - use Almalinux for extra package
grooverdan May 16, 2024
fa2f096
Adjust test to allow healthcheck@localhost to trigger the test.
grooverdan May 17, 2024
1d45845
Test: ubi - allow RHEL path for jemalloc
grooverdan May 17, 2024
47895a5
ubi: compatibility
grooverdan May 17, 2024
9f6e83f
ubi: best practices
grooverdan May 17, 2024
ad33ae6
update ubi - use mariaVersion
grooverdan May 17, 2024
cf5f74c
versions.json with ubi
grooverdan May 17, 2024
7a882af
ubi: fix uid/gid to 999
grooverdan May 17, 2024
60c6431
ubi: package
grooverdan May 17, 2024
4ab3d2a
no MARIADB_VERSION required now
grooverdan May 20, 2024
e35a672
update based on ubi less version
grooverdan May 20, 2024
9981dc2
ubi: join steps + licenses
grooverdan May 20, 2024
b76a621
add 10.6-ubi, 10.11-ubi
grooverdan May 20, 2024
48ba15e
ubiminimal
grooverdan May 20, 2024
0f02f49
ubi: docker.conf first. tzdata -reinstall
grooverdan May 23, 2024
393a812
Add /etc/mysql/mariadb.conf.d to docker.cnf to be compatible with Ubu…
mmontes11 May 21, 2024
417b35e
boost-program-options-1.75.0-8 from UBI
grooverdan May 24, 2024
8ea78e9
ubi: docs update
grooverdan May 24, 2024
bb44a43
ubi: mariadb install directories
grooverdan May 24, 2024
0962cb2
handle ./update - bind ubi to a value
grooverdan May 24, 2024
432bd10
ubi: update.sh compat
grooverdan May 24, 2024
f44c019
ubi: update comments
grooverdan May 24, 2024
134cebc
ubi: get gpg for fedora EPEL rpm
grooverdan May 24, 2024
a38f997
ubi: socket path /run/mariadb
grooverdan May 24, 2024
a3c2bec
update all
grooverdan May 24, 2024
dafb385
update 10.11
grooverdan May 24, 2024
a002966
ubi: add pv - doc for jemalloc
grooverdan May 24, 2024
fac0e7f
ubi: handle debian induced ppc64le dislexia
grooverdan May 24, 2024
028f031
ubi update
grooverdan May 24, 2024
93144db
Compatibility with UBI 8
mmontes11 May 28, 2024
d867dfd
ubi: align galera comments, sticky bit for /run/mariadb
grooverdan May 28, 2024
65f8933
ubi: COPY path fix
grooverdan May 29, 2024
22ddbce
ubi: arch detection without ARG TARGETARCH
tianon May 29, 2024
35df451
ubi: set -eux, rpm -K to validate epel package
grooverdan May 29, 2024
e3390c5
ubi: validate EPEL key and MariaDB key
grooverdan May 29, 2024
226741f
update ubi
grooverdan May 29, 2024
28eb537
ubi: expand licenses to link to packages licenses
grooverdan May 29, 2024
63f1afc
ubi: Red Hat OpenShift Certification - add HasRequiredLabel
grooverdan May 29, 2024
fec266e
update
grooverdan May 29, 2024
5c3fc2d
11.4-ubi add
grooverdan May 29, 2024
699b21b
ubi: include metadata for generate-stackbrew-library.sh
grooverdan May 30, 2024
132b45b
generate_architecture: find portable
grooverdan May 30, 2024
8eaa306
generate architectures: ubi architectures cannot retreived with bashbrew
grooverdan May 30, 2024
46a0ddb
generate stackbrew
grooverdan May 30, 2024
c35b877
generate-stackbrew for ubi
grooverdan May 30, 2024
26b7425
Merge branch 'next' into ubiminimal
grooverdan May 30, 2024
2ddebc0
no more 11.0
grooverdan May 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions .test/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,8 @@ killoff
--silent \
-e "show create user")
# shellcheck disable=SC2016,SC2076
[[ "${createuser//\'/\`}" =~ 'CREATE USER `healthcheck`@`::1` IDENTIFIED' ]] || \
[[ "${createuser//\'/\`}" =~ 'CREATE USER `healthcheck`@`localhost` IDENTIFIED' ]] || \
[[ "${createuser//\'/\`}" =~ 'CREATE USER `healthcheck`@`::1` IDENTIFIED' ]] || \
[[ "${createuser//\'/\`}" =~ 'CREATE USER `healthcheck`@`127.0.0.1` IDENTIFIED' ]] || die "healthcheck wasn't created how I was expected"

grants="$(docker exec --user mysql -i \
Expand All @@ -326,7 +327,8 @@ killoff
--silent \
-e show\ grants)"

[[ "${grants//\'/\`}" =~ GRANT\ USAGE\ ON\ *.*\ TO\ \`healthcheck\`@\`::1\` ]] || \
[[ "${grants//\'/\`}" =~ GRANT\ USAGE\ ON\ *.*\ TO\ \`healthcheck\`@\`localhost\` ]] || \
[[ "${grants//\'/\`}" =~ GRANT\ USAGE\ ON\ *.*\ TO\ \`healthcheck\`@\`::1\` ]] || \
[[ "${grants//\'/\`}" =~ GRANT\ USAGE\ ON\ *.*\ TO\ \`healthcheck\`@\`127.0.0.1\` ]] || die "healthcheck wasn't granted what I was expected"
killoff

Expand Down Expand Up @@ -622,7 +624,7 @@ esac
if [ -n "$debarch" ]
then
echo -e "Test: jemalloc preload\n"
runandwait -e LD_PRELOAD="/usr/lib/$debarch-linux-gnu/libjemalloc.so.1 /usr/lib/$debarch-linux-gnu/libjemalloc.so.2" -e MARIADB_ALLOW_EMPTY_ROOT_PASSWORD=1 "${image}"
runandwait -e LD_PRELOAD="/usr/lib/$debarch-linux-gnu/libjemalloc.so.1 /usr/lib/$debarch-linux-gnu/libjemalloc.so.2 /usr/lib64/libjemalloc.so.2" -e MARIADB_ALLOW_EMPTY_ROOT_PASSWORD=1 "${image}"
docker exec -i "$cid" gosu mysql /bin/grep 'jemalloc' /proc/1/maps || die "expected to preload jemalloc"


Expand Down
60 changes: 60 additions & 0 deletions 10.11-ubi/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
FROM redhat/ubi9-minimal

# user 999/ group 999, that we want to use for compatibility with the ubuntu image.
RUN groupadd --gid 999 -r mysql && \
useradd -r -g mysql mysql --home-dir /var/lib/mysql --uid 999

ARG TARGETARCH
ENV GOSU_VERSION 1.17
RUN ARCH=$TARGETARCH && if [ $TARGETARCH = ppc64le ]; then ARCH=ppc64el ; fi ; \
grooverdan marked this conversation as resolved.
Show resolved Hide resolved
curl --location --output /usr/local/bin/gosu https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-${ARCH} && \
curl --location --output /usr/local/bin/gosu.asc https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-${ARCH}.asc; \
GNUPGHOME="$(mktemp -d)"; \
export GNUPGHOME; \
gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \
chmod a+x /usr/local/bin/gosu; \
gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \
gpgconf --kill all; \
rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc; \
gosu --version; \
gosu nobody true
grooverdan marked this conversation as resolved.
Show resolved Hide resolved

COPY docker.cnf /etc/my.cnf.d/

COPY MariaDB.repo /etc/yum.repos.d/

# missing pwgen(epel), jemalloc(epel) (as entrypoint/user extensions)
# procps, pv(epel) - missing dependencies of galera sst script
# tzdata re-installed as only a fake version is part of the ubi-minimal base image.
# FF8AD1344597106ECE813B918A3872BF3228467C is the fedora RPM key
RUN curl https://pagure.io/fedora-web/websites/raw/master/f/sites/getfedora.org/static/keys/FF8AD1344597106ECE813B918A3872BF3228467C.txt --output /tmp/epelkey.txt && \
rpmkeys --import /tmp/epelkey.txt && \
grooverdan marked this conversation as resolved.
Show resolved Hide resolved
rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm && \
grooverdan marked this conversation as resolved.
Show resolved Hide resolved
rm /tmp/epelkey.txt && \
rpmkeys --import https://supplychain.mariadb.com/MariaDB-Server-GPG-KEY && \
grooverdan marked this conversation as resolved.
Show resolved Hide resolved
microdnf update -y && \
microdnf reinstall -y tzdata && \
grooverdan marked this conversation as resolved.
Show resolved Hide resolved
microdnf install -y procps-ng zstd xz jemalloc pwgen pv && \
mkdir -p /etc/mysql/conf.d /etc/mysql/mariadb.conf.d/ /var/lib/mysql/mysql /run/mariadb /usr/lib64/galera && \
chmod ugo+rwx,o+t /run/mariadb && \
microdnf install -y MariaDB-backup-10.11.8 MariaDB-server-10.11.8 && \
# compatibility with DEB Galera packaging
ln -s /usr/lib64/galera-4/libgalera_smm.so /usr/lib/libgalera_smm.so && \
# compatibility with RPM Galera packaging
ln -s /usr/lib64/galera-4/libgalera_smm.so /usr/lib64/galera/libgalera_smm.so && \
microdnf clean all && \
rmdir /var/lib/mysql/mysql && \
chown -R mysql:mysql /var/lib/mysql /run/mariadb && \
mkdir /licenses && ln -s /usr/share/doc/MariaDB-server-10.11.8/COPYING /licenses/GPL-2
grooverdan marked this conversation as resolved.
Show resolved Hide resolved

VOLUME /var/lib/mysql

RUN mkdir /docker-entrypoint-initdb.d

COPY healthcheck.sh /usr/local/bin/healthcheck.sh
COPY /docker-entrypoint.sh /usr/local/bin/
grooverdan marked this conversation as resolved.
Show resolved Hide resolved

ENTRYPOINT ["docker-entrypoint.sh"]

EXPOSE 3306
CMD ["mariadbd"]
7 changes: 7 additions & 0 deletions 10.11-ubi/MariaDB.repo
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[mariadb]
name = MariaDB
#baseurl = https://rpm.mariadb.org/10.11/rhel/$releasever/$basearch
baseurl = https://archive.mariadb.org/mariadb-10.11/yum/rhel/$releasever/$basearch
#microdnf cannot read to the second key here.
#gpgkey=https://archive.mariadb.org/PublicKey
gpgcheck=1
Loading
Loading