update github runner docker

This commit is contained in:
xfy
2024-04-01 11:53:56 +08:00
parent 23bceafbfe
commit 335350f305
6 changed files with 14 additions and 46 deletions

View File

@ -1,28 +1,13 @@
FROM archlinux
FROM ubuntu
ARG USER=xfy
ARG RUNNER_VERSION=2.311.0
WORKDIR /runner
RUN apt-get update \
&& apt-get install curl libdigest-sha-perl dotnet-sdk-7.0 \
aspnetcore-runtime-6.0 tmux build-essential -y \
&& useradd --create-home xfy \
&& mkdir actions-runner \
&& chown -R xfy actions-runner
RUN pacman -Syu --noconfirm \
&& pacman -S --needed git vim base-devel \
--noconfirm
RUN useradd --groups wheel --no-create-home --shell /bin/bash ${USER}
WORKDIR /home/${USER}
RUN rm -rf /home/${USER}/dotfiles \
&& rm -rf /home/${USER}/yay
RUN chown -R "${USER}":"${USER}" /home/"${USER}"
USER ${USER}
COPY --chown=${USER} . /home/${USER}/dotfiles
RUN export USER="${USER}" \
&& chmod +x /home/${USER}/dotfiles/scripts/* \
&& /home/${USER}/dotfiles/scripts/install-yay.sh
WORKDIR /home/${USER}/actions-runner
RUN yay --noconfirm \
yay -S curl \
curl -o actions-runner-linux-x64-${RUNNER_VERSION}.tar.gz \
-L https://github.com/actions/runner/releases/download/v${RUNNER_VERSION}/actions-runner-linux-x64-${RUNNER_VERSION}.tar.gz \
tar xzf ./actions-runner-linux-x64-${RUNNER_VERSION}.tar.gz
USER xfy
ENTRYPOINT ["/usr/bin/bash"]

View File

@ -1,21 +0,0 @@
FROM ubuntu
ARG USER=xfy
ARG RUNNER_VERSION=2.311.0
RUN apt-get update -y \
&& apt-get upgrade -y \
&& apt-get install curl sudo dotnet-sdk-6.0 -y
RUN useradd --no-create-home --shell /bin/bash ${USER} \
&& echo "${USER} ALL=(ALL) NOPASSWD:ALL" >/etc/sudoers.d/${USER} \
&& chmod 0440 /etc/sudoers.d/${USER}
USER ${USER}
WORKDIR /runner
RUN curl -o actions-runner-linux-x64-${RUNNER_VERSION}.tar.gz \
-L https://github.com/actions/runner/releases/download/v${RUNNER_VERSION}/actions-runner-linux-x64-${RUNNER_VERSION}.tar.gz \
&& tar xzf ./actions-runner-linux-x64-${RUNNER_VERSION}.tar.gz \
&& rm -rf ./actions-runner-linux-x64-${RUNNER_VERSION}.tar.gz
ENTRYPOINT [ "/bin/bash" ]

View File

@ -0,0 +1 @@
docker run -d --name gymo-runner --restart unless-stopped -v ./runner/:/runner/ -it --entrypoint /runner/run.sh github-runner

View File

@ -0,0 +1 @@
docker run --name gymo-runner --restart unless-stopped -v ./runner/:/runner/ -it --entrypoint /bin/bash github-runner