Each check runs in its own pipeline stage (readiness, compose, image pull) so Jenkins shows clear pass/fail per section. Co-authored-by: Cursor <cursoragent@cursor.com>
43 lines
1.2 KiB
Bash
Executable file
43 lines
1.2 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
# Install docker + docker-compose CLI and verify socket access (Jenkins on Coolify).
|
|
set -euo pipefail
|
|
|
|
mkdir -p .ci-bin dist
|
|
|
|
if [ ! -x .ci-bin/docker ]; then
|
|
echo "Downloading docker CLI..."
|
|
curl -fsSL "https://download.docker.com/linux/static/stable/x86_64/docker-27.4.1.tgz" \
|
|
| tar xz --strip-components=1 -C .ci-bin docker/docker
|
|
chmod +x .ci-bin/docker
|
|
fi
|
|
|
|
if [ ! -x .ci-bin/docker-compose ]; then
|
|
echo "Downloading docker-compose..."
|
|
curl -fsSL "https://github.com/docker/compose/releases/download/v2.32.4/docker-compose-linux-x86_64" \
|
|
-o .ci-bin/docker-compose
|
|
chmod +x .ci-bin/docker-compose
|
|
fi
|
|
|
|
DOCKER=./.ci-bin/docker
|
|
COMPOSE=./.ci-bin/docker-compose
|
|
|
|
if ! $DOCKER version >/dev/null 2>&1; then
|
|
if command -v sudo >/dev/null 2>&1 && sudo -n $DOCKER version >/dev/null 2>&1; then
|
|
DOCKER="sudo $DOCKER"
|
|
COMPOSE="sudo $COMPOSE"
|
|
else
|
|
echo "ERROR: cannot access /var/run/docker.sock"
|
|
echo "Set DOCKER_GID on the Jenkins Coolify service to: $(stat -c '%g' /var/run/docker.sock 2>/dev/null || echo unknown)"
|
|
ls -la /var/run/docker.sock 2>/dev/null || true
|
|
id
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
cat > .ci-bin/ci-env.sh <<EOF
|
|
export DOCKER='$DOCKER'
|
|
export COMPOSE='$COMPOSE'
|
|
EOF
|
|
|
|
$DOCKER version
|
|
$COMPOSE version
|