-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
127 lines (109 loc) · 4.54 KB
/
Dockerfile
File metadata and controls
127 lines (109 loc) · 4.54 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# Base image: Official GitHub Actions Runner
FROM ghcr.io/actions/actions-runner:latest
# Switch to root to install global dependencies
USER root
# 1. Install 'build essentials' and other global dependencies
RUN apt-get update && apt-get full-upgrade -y && apt-get install -y --no-install-recommends \
ca-certificates \
curl \
git \
jq \
unzip \
zip \
build-essential \
software-properties-common \
xz-utils \
&& rm -rf /var/lib/apt/lists/*
# 2. Install 'Rust'
ENV RUSTUP_HOME=/usr/local/rustup
ENV CARGO_HOME=/usr/local/cargo
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --no-modify-path --default-toolchain stable \
&& chmod -R a+rwX $RUSTUP_HOME $CARGO_HOME \
&& ln -s /usr/local/cargo/bin/* /usr/local/bin/
# 3. Install 'Zig'
RUN ZIG_ARCH=$(uname -m) \
&& ZIG_VERSION=$(curl -sSL https://ziglang.org/download/index.json | jq -r 'keys | map(select(. != "master")) | sort_by(split(".") | map(tonumber)) | last') \
&& ZIG_TARBALL_URL=$(curl -sSL https://ziglang.org/download/index.json | jq -r ".\"$ZIG_VERSION\".\"${ZIG_ARCH}-linux\".tarball") \
&& echo "Downloading Zig $ZIG_VERSION for ${ZIG_ARCH}-linux..." \
&& curl -fsSL "$ZIG_TARBALL_URL" | tar -xJ -C /usr/local \
&& mv /usr/local/zig-* /usr/local/zig \
&& ln -s /usr/local/zig/zig /usr/local/bin/zig
# 4. Install 'Go'
RUN ARCH=$(uname -m) \
&& if [ "$ARCH" = "x86_64" ]; then GOARCH="amd64"; elif [ "$ARCH" = "aarch64" ]; then GOARCH="arm64"; else echo "Unsupported arch: $ARCH" && exit 1; fi \
&& LATEST_GO=$(curl -sSL https://go.dev/VERSION?m=text | head -n 1) \
&& echo "Downloading $LATEST_GO for linux-$GOARCH..." \
&& curl -L "https://go.dev/dl/${LATEST_GO}.linux-${GOARCH}.tar.gz" -o go.tar.gz \
&& tar -C /usr/local -xzf go.tar.gz \
&& rm go.tar.gz \
&& ln -s /usr/local/go/bin/go /usr/local/bin/go \
&& ln -s /usr/local/go/bin/gofmt /usr/local/bin/gofmt
# 5. Install 'uv'
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /usr/local/bin/
# 6. Install 'bun'
ENV BUN_INSTALL="/usr/local"
RUN curl -fsSL https://bun.com/install | bash
# 7. Install 'nvm' and default Node.js
ENV NVM_DIR="/usr/local/nvm"
ENV NODE_VERSION="lts/*"
RUN mkdir -p $NVM_DIR \
&& curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash \
&& bash -c "source $NVM_DIR/nvm.sh \
&& nvm install $NODE_VERSION \
&& nvm alias default $NODE_VERSION \
&& nvm use default \
&& ln -s \$(nvm which default) /usr/local/bin/node \
&& ln -s \$(dirname \$(nvm which default))/npm /usr/local/bin/npm \
&& ln -s \$(dirname \$(nvm which default))/npx /usr/local/bin/npx" \
&& chmod -R a+rwX $NVM_DIR
# 8. Install 'deno'
ENV DENO_INSTALL="/usr/local"
ENV DENO_INSTALL_ROOT="/usr/local"
ENV DENO_DIR="/deno-dir"
ENV DENO_NO_UPDATE_CHECK=1
ENV DENO_NO_PROMPT=1
RUN curl -fsSL https://deno.land/install.sh | sh \
&& mkdir -p $DENO_DIR \
&& chmod -R a+rwX $DENO_DIR \
&& chmod a+rwX /usr/local/bin
# Switch back to the runner user for security
USER runner
# Ensure the new tools are in the runner's path
ENV PATH="/usr/local/bin:$PATH"
# Create a startup script that logs versions, configures the runner, and starts it
RUN cat <<'EOF' > start.sh
#!/bin/bash
echo " _________________ ____ _____
/ ___/ _/_ __/ // / / / / _ )
/ (_ // / / / / _ / /_/ / _ |
\___/___/_/_/_/_//_/\____/____/ ______
/ _ |/ ___/_ __/ _/ __ \/ |/ / __/
/ __ / /__ / / _/ // /_/ / /\ \
/_/_|_\___/ /_/ /___/\____/_/|_/___/
/ _ \/ / / / |/ / |/ / __/ _ \
/ , _/ /_/ / / / _// , _/
/_/|_|\____/_/|_/_/|_/___/_/|_|"
echo " "
# OS & System
echo "Ubuntu Version: $(cat /etc/os-release | grep PRETTY_NAME | cut -d= -f2 | tr -d '\"' | cut -d' ' -f2-)"
echo "Kernel Version: $(uname -r)"
echo "System Arch : $(uname -m)"
echo " "
echo "Rust Version : $(rustc --version | cut -d ' ' -f 2)"
echo "Zig Version : $(zig version)"
echo "Go Version : $(go version | awk '{print $3}' | sed 's/go//')"
echo "UV Version : $(uv --version | head -n 1 | cut -d ' ' -f 2)"
echo "Bun Version : $(bun --version)"
echo "Deno Version : $(deno --version | head -n 1 | cut -d ' ' -f 2)"
echo "Node Version : $(node --version | sed 's/^v//')"
echo "NPM Version : $(npm --version)"
echo "--------------------------------------"
# Configure the runner
if [ ! -f .runner ]; then
./config.sh --unattended --url $REPO_URL --token $RUNNER_TOKEN --name $RUNNER_NAME --labels $RUNNER_LABELS --replace
fi
# Execute the main runner script
exec ./run.sh
EOF
RUN chmod +x start.sh
CMD ["./start.sh"]