Add mongo-healthcheck in mongo image

This commit is contained in:
Daniel Berteaud 2024-02-19 12:11:13 +01:00
parent 4eb9a0557e
commit 599369aa09
5 changed files with 35 additions and 16 deletions

View File

@ -1,6 +1,7 @@
job "base_images" {
datacenters = ["dc1"]
region = "global"
# Note : This is not a job to run
@ -69,7 +70,7 @@ job "base_images" {
task "mongo50" {
driver = "docker"
config {
image = "danielberteaud/mongo:5.0.24.2-1"
image = "danielberteaud/mongo:5.0.24.2-2"
}
}
task "pgbouncer" {

View File

@ -1,17 +1,26 @@
FROM danielberteaud/alma:8.24.2-1
MAINTAINER Daniel Berteaud <dbd@ehtrace.com>
ARG MONGO_MAJOR=3.6
ARG MONGO_MAJOR=3.6 \
MONGO_HEALTHCHECK_VERSION=1.0.0
COPY root/ /
RUN set -eux &&\
sed -i -e "s/__MONGO_MAJOR__/${MONGO_MAJOR}/g" /etc/yum.repos.d/mongodb.repo &&\
microdnf -y --best --nodocs --noplugins --setopt=install_weak_deps=0 update &&\
curl -sSL https://github.com/instant-solutions/mongo-healthcheck/releases/download/${MONGO_HEALTHCHECK_VERSION}/mongo-healthcheck-${MONGO_HEALTHCHECK_VERSION}-linux-amd64.tar.gz | \
tar xvz -C /usr/local/bin &&\
chown root:root /usr/local/bin/mongo-healthcheck &&\
chmod 755 /usr/local/bin/mongo-healthcheck &&\
# Create mongod user with same UID as mongodb in the official image \
addgroup -g 999 mongod &&\
adduser --system --ingroup mongod --disabled-password --uid 999 --home /var/lib/mongo --shell /sbin/nologin mongod &&\
microdnf -y --nodocs --setopt=install_weak_deps=0 install tini mongodb-org-server mongodb-org-shell mongodb-mongosh mongodb-org-tools &&\
microdnf clean all &&\
dnf install tini \
mongodb-org-server \
mongodb-org-shell \
mongodb-mongosh \
mongodb-org-tools \
&&\
dnf clean all &&\
rm -rf /var/cache/yum/* /var/log/yum/* /var/lib/dnf/history*
USER mongod

View File

@ -98,15 +98,15 @@ if ! docker manifest inspect danielberteaud/mariadb-client:24.2-1 > /dev/null 2>
else
echo "Image danielberteaud/mariadb-client:24.2-1 already available"
fi
if ! docker manifest inspect danielberteaud/mongo:5.0.24.2-1 > /dev/null 2>&1; then
echo "Building mongo:5.0.24.2-1"
if ! docker manifest inspect danielberteaud/mongo:5.0.24.2-2 > /dev/null 2>&1; then
echo "Building mongo:5.0.24.2-2"
export BUILDKIT_PROGRESS=plain
docker build -t danielberteaud/mongo:5.0.24.2-1 -t danielberteaud/mongo:5.0 --build-arg=MONGO_MAJOR=5.0 output/images/mongo &&\
docker push danielberteaud/mongo:5.0.24.2-1 &&\
docker build -t danielberteaud/mongo:5.0.24.2-2 -t danielberteaud/mongo:5.0 --build-arg=MONGO_MAJOR=5.0 output/images/mongo &&\
docker push danielberteaud/mongo:5.0.24.2-2 &&\
docker push danielberteaud/mongo:5.0 &&\
echo "danielberteaud/mongo:5.0.24.2-1 pushed to remote repo"
echo "danielberteaud/mongo:5.0.24.2-2 pushed to remote repo"
else
echo "Image danielberteaud/mongo:5.0.24.2-1 already available"
echo "Image danielberteaud/mongo:5.0.24.2-2 already available"
fi
if ! docker manifest inspect danielberteaud/pgbouncer:24.2-1 > /dev/null 2>&1; then
echo "Building pgbouncer:24.2-1"

View File

@ -1,17 +1,26 @@
FROM [[ .docker.repo ]][[ .docker.base_images.alma8.image ]]
MAINTAINER [[ .docker.maintainer ]]
ARG MONGO_MAJOR=3.6
ARG MONGO_MAJOR=3.6 \
MONGO_HEALTHCHECK_VERSION=1.0.0
COPY root/ /
RUN set -eux &&\
sed -i -e "s/__MONGO_MAJOR__/${MONGO_MAJOR}/g" /etc/yum.repos.d/mongodb.repo &&\
microdnf -y --best --nodocs --noplugins --setopt=install_weak_deps=0 update &&\
curl -sSL https://github.com/instant-solutions/mongo-healthcheck/releases/download/${MONGO_HEALTHCHECK_VERSION}/mongo-healthcheck-${MONGO_HEALTHCHECK_VERSION}-linux-amd64.tar.gz | \
tar xvz -C /usr/local/bin &&\
chown root:root /usr/local/bin/mongo-healthcheck &&\
chmod 755 /usr/local/bin/mongo-healthcheck &&\
# Create mongod user with same UID as mongodb in the official image \
addgroup -g 999 mongod &&\
adduser --system --ingroup mongod --disabled-password --uid 999 --home /var/lib/mongo --shell /sbin/nologin mongod &&\
microdnf -y --nodocs --setopt=install_weak_deps=0 install tini mongodb-org-server mongodb-org-shell mongodb-mongosh mongodb-org-tools &&\
microdnf clean all &&\
dnf install tini \
mongodb-org-server \
mongodb-org-shell \
mongodb-mongosh \
mongodb-org-tools \
&&\
dnf clean all &&\
rm -rf /var/cache/yum/* /var/log/yum/* /var/lib/dnf/history*
USER mongod

View File

@ -293,7 +293,7 @@ docker:
# MongoDB
mongo50:
image: mongo:5.0.24.2-1
image: mongo:5.0.24.2-2
build_args:
MONGO_MAJOR: "5.0"
tags: