This repository was archived by the owner on Apr 12, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·95 lines (86 loc) · 3.31 KB
/
setup.sh
File metadata and controls
executable file
·95 lines (86 loc) · 3.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#!/usr/bin/env bash
set -euo pipefail
echo "=== GitHub Actions Runner Manager — Setup ==="
echo ""
# Detect OS
OS="unknown"
if [[ -f /etc/os-release ]]; then
. /etc/os-release
case "$ID" in
ubuntu|debian) OS="debian" ;;
fedora) OS="fedora" ;;
centos|rhel|amzn) OS="rhel" ;;
alpine) OS="alpine" ;;
esac
elif [[ "$(uname)" == "Darwin" ]]; then
OS="macos"
fi
# Detect architecture
ARCH="$(uname -m)"
case "$ARCH" in
x86_64|amd64) ARCH="x86_64" ;;
aarch64|arm64) ARCH="arm64" ;;
esac
echo "Detected: OS=$OS ARCH=$ARCH"
echo ""
# ── Docker ──────────────────────────────────────────────
if command -v docker &>/dev/null; then
echo "[skip] Docker already installed: $(docker --version)"
else
echo "[install] Docker..."
if [[ "$OS" == "macos" ]]; then
echo "Install Docker Desktop from https://docker.com/products/docker-desktop"
echo "Then re-run this script."
exit 1
elif [[ "$OS" == "alpine" ]]; then
apk add --no-cache docker docker-compose
rc-update add docker boot
service docker start
else
curl -fsSL https://get.docker.com | sh
fi
echo "[ok] Docker installed"
fi
# ── Docker Compose (plugin) ────────────────────────────
if docker compose version &>/dev/null; then
echo "[skip] Docker Compose already installed: $(docker compose version --short)"
else
echo "[install] Docker Compose plugin..."
case "$OS" in
debian) apt-get install -y docker-compose-plugin ;;
fedora) dnf install -y docker-compose-plugin ;;
rhel) yum install -y docker-compose-plugin ;;
alpine) apk add --no-cache docker-compose ;;
macos) echo "Docker Compose is included with Docker Desktop" ;;
*) echo "Could not install docker-compose-plugin automatically"; exit 1 ;;
esac
echo "[ok] Docker Compose installed"
fi
# ── just ────────────────────────────────────────────────
if command -v just &>/dev/null; then
echo "[skip] just already installed: $(just --version)"
else
echo "[install] just..."
if [[ "$OS" == "macos" ]]; then
brew install just
else
curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to /usr/local/bin
fi
echo "[ok] just installed"
fi
# ── Docker group (non-root) ────────────────────────────
if [[ "$(id -u)" -ne 0 ]]; then
if ! groups | grep -q docker; then
echo "[setup] Adding $USER to docker group..."
sudo usermod -aG docker "$USER"
echo "[ok] Added — log out and back in for it to take effect"
fi
fi
# ── Verify ──────────────────────────────────────────────
echo ""
echo "=== Verification ==="
echo "Docker: $(docker --version)"
echo "Docker Compose: $(docker compose version)"
echo "just: $(just --version)"
echo ""
echo "All dependencies installed. Run 'just new' to configure a runner."