Skip to content

Commit 4b8723a

Browse files
committed
install rust/cargo for runner user
1 parent 984ef84 commit 4b8723a

3 files changed

Lines changed: 15 additions & 10 deletions

File tree

Dockerfile

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,20 @@ FROM docker.io/myoung34/github-runner:latest
22

33
USER root
44

5-
# Install dependencies and Rust in one layer
5+
# Install system dependencies
66
RUN apt-get update && apt-get install -y \
77
curl \
88
build-essential \
99
pkg-config \
1010
libssl-dev \
11-
&& curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable \
12-
&& /root/.cargo/bin/rustup component add clippy rustfmt \
13-
&& /root/.cargo/bin/rustup target add x86_64-unknown-linux-musl \
1411
&& apt-get clean \
1512
&& rm -rf /var/lib/apt/lists/*
1613

17-
# Add Rust to PATH for all users
18-
ENV PATH="/root/.cargo/bin:${PATH}"
14+
# Switch to runner user and install Rust
15+
USER runner
16+
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable \
17+
&& /home/runner/.cargo/bin/rustup component add clippy rustfmt \
18+
&& /home/runner/.cargo/bin/rustup target add x86_64-unknown-linux-musl
1919

20+
# Add Rust to PATH for runner user
21+
ENV PATH="/home/runner/.cargo/bin:${PATH}"

build.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
3+
podman build -t github-runner .
4+

docker-compose.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: '3'
1+
version: "3"
22
services:
33
worker:
44
image: ghcr.io/onmcu/dockerized-gha-runner:latest
@@ -9,11 +9,10 @@ services:
99
RUNNER_TOKEN: {{ GITHUB_RUNNER_TOKEN }}
1010
RUNNER_WORKDIR: /tmp/runner/work
1111
CONFIGURED_ACTIONS_RUNNER_FILES_DIR: /runner/data
12-
RUNNER_SCOPE: 'repo'
1312
LABELS: linux,x64,gpu,rust
1413
DISABLE_AUTOMATIC_DEREGISTRATION: true
1514
volumes:
16-
- './data:/runner/data:Z'
17-
- './tmp:/tmp/runner:Z'
15+
- "./data:/runner/data:Z"
16+
- "./tmp:/tmp/runner:Z"
1817
security_opt:
1918
- label=disable

0 commit comments

Comments
 (0)