Skip to content

Commit

Permalink
Miscellaneous improvements
Browse files Browse the repository at this point in the history
* Dockerfile.almalinux
  Dockerfile.ubuntu
  - Use main branch of action-runners - for now

* build-files/build-image.sh
  - Remove /home/ubuntu/.nuget to free >2GB as it was only there for action runners build

* build-files/install-packages.sh
  - Remove docker and use podman
  - Make less verbose

* build-files/supported_packages.txt
  - Use php8.3

* setup-build-env.sh
  - Compress image again - priming will untar/unzip so it has no performance impact
  • Loading branch information
nealef committed Nov 5, 2024
1 parent 8dcbf85 commit f91ac83
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 82 deletions.
9 changes: 4 additions & 5 deletions Dockerfile.almalinux
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@ COPY ${RUNNERPATCH} /tmp/runner.patch
RUN cd /tmp && \
git clone -q ${RUNNERREPO} && \
cd runner && \
git checkout $(git describe --tags $(git rev-list --tags --max-count=1)) -b build && \
git apply /tmp/runner.patch && \
sed -i'' -e 's/"version": "8[^"]*"/"version": "'${SDK_VERSION}'"/' src/global.json && \
sed -i'' -e 's/"version": "8[^"]*"/"version": "'${SDK_VERSION}'"/' .devcontainer/devcontainer.json && \
sed -i'' -e 's/DOTNETSDK_VERSION="8[^"]*"/DOTNETSDK_VERSION="'${SDK_VERSION}'"/' src/dev.sh
git checkout main -b build && \
# git checkout $(git describe --tags $(git rev-list --tags --max-count=1)) -b build && \
sed -i'' -e /version/s/8......\"$/${SDK}.0.100\"/ src/global.json && \
git apply /tmp/runner.patch

RUN cd /tmp/runner/src && \
./dev.sh layout && \
Expand Down
8 changes: 3 additions & 5 deletions Dockerfile.ubuntu
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
FROM ubuntu:22.04
FROM ubuntu:24.10

ARG RUNNERREPO="https://github.com/actions/runner" RUNNERPATCH SDK_VERSION ARCH

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get -qq update -y && \
apt-get -qq -y install wget git sudo alien curl && \
apt-get -qq -y install wget git sudo curl dotnet-sdk-8.0 && \
apt autoclean

RUN apt-get -qq -y install dotnet-sdk-8.0 && \
SDK_VERSION=`dotnet --version` && \
echo "Using SDK - ${SDK_VERSION}"
RUN echo "Using SDK - `dotnet --version`"

ADD ${RUNNERPATCH} /tmp/runner.patch

Expand Down
3 changes: 2 additions & 1 deletion build-files/build-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ install_runner() {

cleanup() {
rm -rf /home/ubuntu/build-image.sh /home/ubuntu/runner-sdk-8.patch \
/tmp/runner /tmp/preseed-yaml
/tmp/runner /tmp/preseed-yaml /home/ubuntu/.nuget \
/home/ubuntu/.local/share
}

run() {
Expand Down
37 changes: 15 additions & 22 deletions build-files/install-packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,34 +27,27 @@ fi
header "Installing additional packages"
# Update the package list
msg "Updating package list..."
sudo DEBIAN_FRONTEND=noninteractive apt-get -qq update -y

# installing docker
for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do sudo apt-get remove $pkg; done

# Add Docker's official GPG key:
sudo DEBIAN_FRONTEND=noninteractive apt-get update -y
sudo DEBIAN_FRONTEND=noninteractive apt-get install ca-certificates curl -y
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc

# Add the repository to Apt sources:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo DEBIAN_FRONTEND=noninteractive apt-get update -y

sudo DEBIAN_FRONTEND=noninteractive apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y
sudo DEBIAN_FRONTEND=noninteractive apt-get update -y >/dev/null

# Read the file line by line and install each package
OK=`true`
while IFS= read -r package || [ -n "$package" ]; do
if [[ ! -z "$package" && "$package" != \#* ]]; then
echo "Installing $package..."
sudo DEBIAN_FRONTEND=noninteractive apt-get -qq install -y "$package"
sudo DEBIAN_FRONTEND=noninteractive apt-get -qq install -y "$package" >/dev/null
if [ $? -ne 0 ]; then
OK=`false`
fi
sudo dpkg --configure -a
fi
done < "$PACKAGE_LIST_FILE"

msg "All packages from $PACKAGE_LIST_FILE have been installed."
if [ ${OK} ]; then
msg "All packages from $PACKAGE_LIST_FILE have been installed."
else
msg "NOT all packages from $PACKAGE_LIST_FILE have been installed - check log."
fi

# Removing the packaging cache
sudo rm -rf /var/cache/apt/archives /var/lib/apt/lists/*
sudo apt-get clean
98 changes: 51 additions & 47 deletions build-files/supported_packages.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,56 +24,60 @@ packages-microsoft-prod
parallel
patchelf
php-pear
php8.1
php8.1-amqp
php8.1-apcu
php8.1-bcmath
php8.1-bz2
php8.1-cgi
php8.1-cli
php8.1-common
php8.1-curl
php8.1-dba
php8.1-dev
php8.1-enchant
php8.1-fpm
php8.1-gd
php8.1-gmp
php8.1-igbinary
php8.1-imagick
php8.1-imap
php8.1-interbase
php8.1-intl
php8.1-ldap
php8.1-mbstring
php8.1-memcache
php8.1-memcached
php8.1-mongodb
php8.1-msgpack
php8.1-mysql
php8.1-odbc
php8.1-opcache
php8.1-pcov
php8.1-pgsql
php8.1-phpdbg
php8.1-pspell
php8.1-readline
php8.1-redis
php8.1-snmp
php8.1-soap
php8.1-sqlite3
php8.1-sybase
php8.1-tidy
php8.1-xdebug
php8.1-xml
php8.1-xsl
php8.1-yaml
php8.1-zip
php8.1-zmq
php8.3
php8.3-amqp
php8.3-apcu
php8.3-bcmath
php8.3-bz2
php8.3-cgi
php8.3-cli
php8.3-common
php8.3-curl
php8.3-dba
php8.3-dev
php8.3-enchant
php8.3-fpm
php8.3-gd
php8.3-gmp
php8.3-igbinary
php8.3-imagick
php8.3-imap
php8.3-interbase
php8.3-intl
php8.3-ldap
php8.3-mbstring
php8.3-memcache
php8.3-memcached
php8.3-mongodb
php8.3-msgpack
php8.3-mysql
php8.3-odbc
php8.3-opcache
php8.3-pcov
php8.3-pgsql
php8.3-phpdbg
php8.3-pspell
php8.3-readline
php8.3-redis
php8.3-snmp
php8.3-soap
php8.3-sqlite3
php8.3-sybase
php8.3-tidy
php8.3-xdebug
php8.3-xml
php8.3-xsl
php8.3-yaml
php8.3-zip
php8.3-zmq
pigz
pipx
pkg-config
podman
podman-compose
podman-docker
podman-remote
podman-toolbox
pollinate
postgresql-16
powershell-lts
Expand Down Expand Up @@ -127,4 +131,4 @@ xz-utils
yarn
zip
zlib1g-dev
zsync
zsync
7 changes: 5 additions & 2 deletions setup-build-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ build_image_in_container() {
msg "Copy the build-image script into gha-builder"
lxc file push --mode 0755 "${BUILD_PREREQS_PATH}/install-packages.sh" "${BUILD_CONTAINER}${BUILD_HOME}/install-packages.sh"

msg "Copy the build-image script into gha-builder"
msg "Copy the supported packages list into the gha-builder"
lxc file push --mode 0755 "${BUILD_PREREQS_PATH}/supported_packages.txt" "${BUILD_CONTAINER}${BUILD_HOME}/supported_packages.txt"

msg "Copy the patch file into gha-builder"
Expand All @@ -85,6 +85,10 @@ build_image_in_container() {
msg "Copy the gha-service unit file into gha-builder"
lxc file push ${BUILD_PREREQS_PATH}/gha-runner.service "${BUILD_CONTAINER}/etc/systemd/system/gha-runner.service"

msg "Copy the apt and dpkg overrides into gha-builder - these prevent doc files from being installed"
lxc file push --mode 0644 "${BUILD_PREREQS_PATH}/99synaptics" "${BUILD_CONTAINER}/etc/apt/apt.conf.d/99synaptics"
lxc file push --mode 0644 "${BUILD_PREREQS_PATH}/01_nodoc" "${BUILD_CONTAINER}/etc/dpk/dpkg.cfg.d/01_nodoc"

msg "Setting user ubuntu with sudo privileges"
lxc exec "${BUILD_CONTAINER}" --user 0 --group 0 -- sh -c "echo 'ubuntu ALL=(ALL) NOPASSWD:ALL' | sudo EDITOR='tee -a' visudo"

Expand All @@ -103,7 +107,6 @@ build_image_in_container() {
msg "Runner build complete. Creating image snapshot."
lxc snapshot "${BUILD_CONTAINER}" "build-snapshot"
lxc publish "${BUILD_CONTAINER}/build-snapshot" -f --alias "${IMAGE_ALIAS}" \
--compression none \
description="GitHub Actions ${OS_NAME} ${OS_VERSION} Runner for ${ARCH}"

msg "Export the image to ${EXPORT} for use elsewhere"
Expand Down

0 comments on commit f91ac83

Please sign in to comment.