Skip to content

Commit 59679a2

Browse files
Add redis-cli installation to cli-base image
- Added install-redis-cli.sh script with support for multiple package managers - Updated Dockerfile to include redis-cli installation step - Supports dnf, microdnf, yum, apt-get, and apk package managers - Includes verification step to ensure successful installation
1 parent e7a26a3 commit 59679a2

2 files changed

Lines changed: 59 additions & 1 deletion

File tree

image/cli-base/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ RUN umask 0002 && \
3434
bash -x /tmp/install/install-argocd.sh --target-platform $ARCHITECTURE && \
3535
bash -x /tmp/install/install-rclone.sh --target-platform $ARCHITECTURE && \
3636
bash -x /tmp/install/install-aws.sh --target-platform $ARCHITECTURE && \
37-
bash -x /tmp/install/install-rosa.sh --target-platform $ARCHITECTURE
37+
bash -x /tmp/install/install-rosa.sh --target-platform $ARCHITECTURE && \
38+
bash -x /tmp/install/install-redis-cli.sh
3839

3940
RUN rm -rf /tmp/install && \
4041
rm -f /opt/app-root/src/.wget-hsts /opt/app-root/src/README.md /opt/app-root/src/LICENSE
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#!/bin/bash
2+
set -e
3+
4+
echo "Installing redis-cli..."
5+
6+
# Detect the package manager and install redis-cli accordingly
7+
if command -v microdnf &> /dev/null; then
8+
# UBI minimal images use microdnf
9+
echo "Detected microdnf (UBI minimal)"
10+
# Enable EPEL for redis package
11+
microdnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm || true
12+
# Enable redis module stream for RHEL 9
13+
microdnf module enable -y redis:7 2>/dev/null || true
14+
microdnf install -y redis && microdnf clean all
15+
elif command -v dnf &> /dev/null; then
16+
# RHEL 8+/Fedora use dnf
17+
echo "Detected dnf (RHEL/Fedora)"
18+
# Try to enable EPEL repository for RHEL/UBI
19+
dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm 2>/dev/null || \
20+
dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm 2>/dev/null || \
21+
echo "EPEL already installed or not needed"
22+
23+
# Enable redis module stream for RHEL 9 (required for modular filtering)
24+
dnf module enable -y redis:7 2>/dev/null || \
25+
dnf module enable -y redis 2>/dev/null || \
26+
echo "Redis module not available or already enabled"
27+
28+
# Install redis
29+
dnf install -y redis && dnf clean all
30+
elif command -v yum &> /dev/null; then
31+
# RHEL 7 and older use yum
32+
echo "Detected yum (RHEL 7)"
33+
yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm || true
34+
yum install -y redis && yum clean all
35+
elif command -v apt-get &> /dev/null; then
36+
# Debian/Ubuntu use apt-get
37+
echo "Detected apt-get (Debian/Ubuntu)"
38+
apt-get update && apt-get install -y redis-tools && rm -rf /var/lib/apt/lists/*
39+
elif command -v apk &> /dev/null; then
40+
# Alpine uses apk
41+
echo "Detected apk (Alpine)"
42+
apk add --no-cache redis
43+
else
44+
echo "ERROR: No supported package manager found (microdnf, dnf, yum, apt-get, or apk)"
45+
exit 1
46+
fi
47+
48+
# Verify installation
49+
if command -v redis-cli &> /dev/null; then
50+
echo "redis-cli installed successfully"
51+
redis-cli --version
52+
else
53+
echo "ERROR: redis-cli installation failed"
54+
exit 1
55+
fi
56+
57+
# Made with Bob

0 commit comments

Comments
 (0)