@@ -147,24 +147,19 @@ def format(self, record: logging.LogRecord) -> str:
147147runner_image = (
148148 modal .Image .from_registry ("ubuntu:22.04" )
149149 .env ({"DEBIAN_FRONTEND" : "noninteractive" })
150+ # Layer 1: System deps + Docker setup (stable, rarely changes)
150151 .apt_install (
151152 "wget" ,
152153 "ca-certificates" ,
153154 "curl" ,
154- "net-tools" ,
155155 "iproute2" ,
156156 "git" ,
157- "sudo" ,
158- "jq" ,
159157 )
160158 .run_commands (
161159 "install -m 0755 -d /etc/apt/keyrings" ,
162160 "curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc" ,
163161 "chmod a+r /etc/apt/keyrings/docker.asc" ,
164- 'echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] '
165- "https://download.docker.com/linux/ubuntu "
166- '$(. /etc/os-release && echo \\ "${UBUNTU_CODENAME:-$VERSION_CODENAME}\\ ") stable" '
167- "| tee /etc/apt/sources.list.d/docker.list > /dev/null" ,
162+ 'echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo \\ "${UBUNTU_CODENAME:-$VERSION_CODENAME}\\ ") stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null' , # noqa: E501
168163 )
169164 .apt_install (
170165 "docker-ce=5:27.5.0-1~ubuntu.22.04~jammy" ,
@@ -181,15 +176,16 @@ def format(self, record: logging.LogRecord) -> str:
181176 "update-alternatives --set iptables /usr/sbin/iptables-legacy" ,
182177 "update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy" ,
183178 )
179+ # Layer 2: Python deps (semi-stable)
184180 .apt_install ("python3" , "python3-pip" , "python-is-python3" )
185181 .pip_install ("fastapi==0.115.0" , "httpx==0.27.0" )
182+ # Layer 3: Runner binary (changes with RUNNER_VERSION)
186183 .run_commands (
187184 "mkdir -p /actions-runner" ,
188- f"curl -L https://github.com/actions/runner/releases/download/"
189- f"v{ RUNNER_VERSION } /actions-runner-linux-x64-{ RUNNER_VERSION } .tar.gz"
190- " | tar -xz -C /actions-runner" ,
185+ f"curl -L https://github.com/actions/runner/releases/download/v{ RUNNER_VERSION } /actions-runner-linux-x64-{ RUNNER_VERSION } .tar.gz | tar -xz -C /actions-runner" , # noqa: E501
191186 "/actions-runner/bin/installdependencies.sh" ,
192187 )
188+ # Layer 4: Local files (most volatile)
193189 .add_local_file (_TEMP_DOCKERD_PATH , "/start-dockerd.sh" , copy = True )
194190 .run_commands ("chmod +x /start-dockerd.sh" )
195191)
0 commit comments