diff --git a/dockerfiles/archlinux/Dockerfile b/dockerfiles/archlinux/Dockerfile index 050f10e..33ff43d 100644 --- a/dockerfiles/archlinux/Dockerfile +++ b/dockerfiles/archlinux/Dockerfile @@ -16,9 +16,10 @@ RUN rm -rf /home/${USER}/dotfiles \ RUN chown -R "${USER}":"${USER}" /home/"${USER}" USER ${USER} +COPY --chown=${USER} . /home/${USER}/dotfiles RUN export USER="${USER}" \ - && git clone https://github.com/DefectingCat/dotfiles \ && chmod +x /home/${USER}/dotfiles/scripts/* \ + && /home/${USER}/dotfiles/scripts/install-yay.sh \ && /home/${USER}/dotfiles/scripts/install-archlinux.sh WORKDIR /home/${USER}/dotfiles diff --git a/dockerfiles/empty/Dockerfile b/dockerfiles/empty/Dockerfile index b992e7f..a8b4cf6 100644 --- a/dockerfiles/empty/Dockerfile +++ b/dockerfiles/empty/Dockerfile @@ -2,3 +2,7 @@ FROM archlinux ARG USER=xfy RUN echo "${USER}" + +WORKDIR /home/${USER} +COPY . . +RUN ls diff --git a/dockerfiles/github-action/Dockerfile b/dockerfiles/github-action/Dockerfile index 1c30e7c..1c3bb72 100644 --- a/dockerfiles/github-action/Dockerfile +++ b/dockerfiles/github-action/Dockerfile @@ -1,4 +1,27 @@ FROM archlinux ARG USER=xfy -WORKDIR /app +ARG RUNNER_VERSION=2.311.0 + +RUN useradd --groups wheel --no-create-home --shell /bin/zsh ${USER} \ + && echo "${USER} ALL=(ALL) NOPASSWD:ALL" >/etc/sudoers.d/${USER} \ + && chmod 0440 /etc/sudoers.d/${USER} \ + && usermod -s "$(which zsh)" ${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 + diff --git a/scripts/install-archlinux.sh b/scripts/install-archlinux.sh index b5bf634..d7d151a 100644 --- a/scripts/install-archlinux.sh +++ b/scripts/install-archlinux.sh @@ -1,10 +1,5 @@ #!/bin/bash -source ./install-yay.sh - -# install yay -install_yay - cd /home/"$USER"/ || exit # ohmyzsh diff --git a/scripts/install-yay.sh b/scripts/install-yay.sh index 55d804e..f6bc3e1 100644 --- a/scripts/install-yay.sh +++ b/scripts/install-yay.sh @@ -1,11 +1,9 @@ #!/bin/bash -install_yay() { - cd /home/"$USER"/ || exit - git clone https://aur.archlinux.org/yay.git - cd /home/"$USER"/yay || exit - makepkg -si --noconfirm - cd /home/"$USER"/ || exit - rm -rf yay - echo "install yay success" -} +cd /home/"$USER"/ || exit +git clone https://aur.archlinux.org/yay.git +cd /home/"$USER"/yay || exit +makepkg -si --noconfirm +cd /home/"$USER"/ || exit +rm -rf yay +echo "install yay success"