Skip to content

Commit cde6bd5

Browse files
Update deploy.sh
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
1 parent 2c18794 commit cde6bd5

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

deploy.sh

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,16 +143,34 @@ fi
143143
ensure_packages() {
144144
echo
145145
echo "==> Installing Docker & prerequisites..."
146+
147+
# Detect OS type
148+
if [[ -f /etc/os-release ]]; then
149+
. /etc/os-release
150+
OS_ID="$ID"
151+
OS_LIKE="${ID_LIKE:-}"
152+
else
153+
echo "ERROR: Cannot detect OS type." >&2
154+
exit 1
155+
fi
156+
157+
# Determine Docker distribution
158+
if [[ "$OS_ID" == "debian" || "$OS_LIKE" == *"debian"* ]]; then
159+
DOCKER_DIST="debian"
160+
else
161+
DOCKER_DIST="ubuntu"
162+
fi
163+
146164
apt-get update -y
147165
apt-get install -y ca-certificates curl git gnupg
148166

149167
install -m 0755 -d /etc/apt/keyrings
150168
if [[ ! -f /etc/apt/keyrings/docker.gpg ]]; then
151-
curl -fsSL https://download.docker.com/linux/ubuntu/gpg \
169+
curl -fsSL "https://download.docker.com/linux/${DOCKER_DIST}/gpg" \
152170
| gpg --dearmor -o /etc/apt/keyrings/docker.gpg
153171
chmod a+r /etc/apt/keyrings/docker.gpg
154172
echo \
155-
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
173+
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/${DOCKER_DIST} \
156174
$(. /etc/os-release && echo "${VERSION_CODENAME}") stable" \
157175
> /etc/apt/sources.list.d/docker.list
158176
apt-get update -y

0 commit comments

Comments
 (0)