Skip to content

Commit

Permalink
fix - adjust docker permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
chaddyc committed Jan 1, 2025
1 parent f206f54 commit 07fc143
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 4 deletions.
11 changes: 7 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,13 @@ RUN LATEST_RUNNER_VERSION=$(curl -s https://api.github.com/repos/actions/runner/
RUN ./bin/installdependencies.sh

# Set up a runner user
RUN groupadd -r runner && \
useradd -m -s /bin/bash -r -g runner runner && \
usermod -aG sudo runner && \
usermod -aG docker runner
# RUN groupadd -r runner && \
# useradd -m -s /bin/bash -r -g runner runner && \
# usermod -aG sudo runner && \
# usermod -aG docker runner

COPY --chmod=700 build/ /tmp/build/
RUN /tmp/build/base-install.sh

# Ensure the runner user owns the runner directory
RUN chown -R runner:runner /runner
Expand Down
62 changes: 62 additions & 0 deletions build/base-install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#!/usr/bin/env bash
set -euo pipefail

# # Required by the build or runner operation
# function install_essentials() {
# apt-get install -y --no-install-recommends \
# ca-certificates \
# curl \
# jq \
# gnupg \
# tar \
# unzip \
# zip \
# apt-transport-https \
# sudo \
# dirmngr \
# locales \
# gosu \
# gpg-agent \
# dumb-init
# }

# function install_tools_apt() {
# apt_packages | xargs apt-get install -y --no-install-recommends
# }

function remove_caches() {
rm -rf /var/lib/apt/lists/*
rm -rf /tmp/*
}

function setup_sudoers() {
sed -e 's/Defaults.*env_reset/Defaults env_keep = "HTTP_PROXY HTTPS_PROXY NO_PROXY FTP_PROXY http_proxy https_proxy no_proxy ftp_proxy"/' -i /etc/sudoers
echo '%sudo ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
}

# echo en_US.UTF-8 UTF-8 >> /etc/locale.gen

# scripts_dir=$(dirname "$0")
# # shellcheck source=/dev/null
# source "$scripts_dir/sources.sh"
# # shellcheck source=/dev/null
# source "$scripts_dir/tools.sh"
# # shellcheck source=/dev/null
# source "$scripts_dir/config.sh"

# apt-get update
# install_essentials
# configure_sources

# apt-get update
# install_tools_apt
# install_tools

setup_sudoers
groupadd -g "$(group_id)" runner
useradd -mr -d /home/runner -u "$(user_id)" -g "$(group_id)" runner
usermod -aG sudo runner
usermod -aG docker runner

remove_sources
remove_caches

0 comments on commit 07fc143

Please sign in to comment.