Error trying to filebeat package

Hello everyone! I'm trying to generate Filebeat packages for version 7.10.2. To do this, I created a workflow that allows you to choose the architecture and rename packages. The problem is that this works with the Ubuntu 20.04 Runner, which is about to be deprecated. I need to continue using Ubuntu 20.04, but with a different Runner. For this I use a docker image with Ubuntu 20.04 inside the Ubuntu 22.04 runner:

jobs: 
build-and-upload: 
runs-on: ubuntu-22.04 
timeout-minutes: 60 

env: 
FILEBEAT_VERSION: 7.10.2 

steps: 
- name: Cancel previous runs 
uses: fkirc/skip-duplicate-actions@master 
with: 
cancel_others: 'true' 
github_token: ${{ secrets.GITHUB_TOKEN }} 
skip_after_successful_duplicate: 'false' 

- name: Checkout code 
uses: actions/checkout@v4 
with: 
repository: "elastic/beats" 
ref: "v${{ env.FILEBEAT_VERSION }}" 

- name: Set up AWS CLI 
use: aws-actions/configure-aws-credentials@v1 
with: 
aws-access-key-id: ${{ secrets.CI_INTERNAL_DEVELOPMENT_BUCKET_USER_ACCESS_KEY }} 
aws-secret-access-key: ${{ secrets.CI_INTERNAL_DEVELOPMENT_BUCKET_USER_SECRET_KEY }} 
aws-region: ${{ secrets.CI_AWS_REGION }} 

- name: Apply patch for Ubuntu build 
run: | 
sed -i 's/apt-get install -y --no-install-recommends/DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends/' filebeat/Dockerfile 
sed -i "s/from: 'centos:7'/from: 'ubuntu:20.04'/g" dev-tools/packaging/packages.yml 
sed -i "s/buildFrom: 'centos:7'/buildFrom: 'ubuntu:20.04'/g" dev-tools/packaging/packages.yml 
sed -i "s/microdnf install -y shadow-utils/microdnf install -y findutils shadow-utils/g" dev-tools/packaging/templates/docker/Dockerfile.elastic-agent.tmpl 
sed -i '/RUN yum -y --setopt=tsflags=nodocs update && \\/, /yum clean all/c\ 
RUN apt-get update -y && \\\n DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends --yes ca-certificates curl libcap2-bin xz-utils && \\\n apt-get clean && \\\n exit_code=$? && \\\n [ $exit_code -eq 0 ] || exit $exit_code' dev-tools/packaging/templates/docker/Dockerfile.elastic-agent.tmpl 
sed -i 's/microdnf install shadow-utils/microdnf install findutils shadow-utils/' dev-tools/packaging/templates/docker/Dockerfile.tmpl 
sed -i '/RUN yum -y --setopt=tsflags=nodocs update && yum clean all/c\ 
RUN apt-get update -y && \\\n DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends --yes ca-certificates curl libcap2-bin xz-utils && \\\n apt-get clean && \\\n exit_code=$? && \\\n [ $exit_code -eq 0 ] || exit $exit_code' dev-tools/packaging/templates/docker/Dockerfile.tmpl 
sed -i '/func TestDocker(t \*testing\.T) {/,/^}$/d' dev-tools/packaging/package_test.go 

- name: Package Filebeat 
run: | 
docker run --rm --privileged -v /var/run/docker.sock:/var/run/docker.sock \ 
-v ${{ github.workspace }}:/workspace -w /workspace ubuntu:20.04 bash -c " 
ls -la filebeat && 
export DEBIAN_FRONTEND=noninteractive && 
apt update -y && 
apt install -y gcc make golang-go python3-pip python3-venv \ 
apt-transport-https ca-certificates curl software-properties-common && 
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg && 
echo 'deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu focal stable' | tee /etc/apt/sources.list.d/docker.list > /dev/null && 
apt update -y && 
apt install -y docker-ce && 
export PATH=\$PATH:/usr/local/go/bin && 
go get -u github.com/magefile/mage && 
export PATH=\$PATH:\$(go env GOPATH)/bin && 

# Buildpackage 
cd filebeat && 
if [[ \"${{ inputs.architecture }}\" == \"x86_64\" || \"${{ inputs.architecture }}\" == \"amd64\" ]]; then
arch=\"amd64\"
elif [[ \"${{ inputs.architecture }}\" == \"aarch64\" || \"${{ inputs.architecture }}\" == \"arm64\" ]]; then
arch=\"arm64\"
fi &&
PLATFORMS=linux/amd64 mage package
ls -la build
"

But when I do this, I get the following error, which is strange since the ls command shows me that build/mage-linux-amd64 exists.

Status: Downloaded newer image for docker.elastic.co/beats-dev/golang-crossbuild:1.14.12-main-debian7
Status: Image is up to date for docker.elastic.co/beats-dev/golang-crossbuild:1.14.12-main-debian7
>> Building using: cmd='build/mage-linux-amd64 golangCrossBuild', env=[CC=gcc, CXX=g++, GOARCH=amd64, GOARM=, GOOS=linux, PLATFORM_ID=linux-amd64]
sh: 1: build/mage-linux-amd64: not found
Error: failed building for linux/amd64: exit status 127
failed building for linux/amd64: exit status 127
>> Building using: cmd='build/mage-linux-amd64 buildGoDaemon', env=[CC=gcc, CXX=g++, GOARCH=amd64, GOARM=, GOOS=linux, PLATFORM_ID=linux-amd64]
sh: 1: build/mage-linux-amd64: not found
Error: failed building for linux/amd64: exit status 127
failed building for linux/amd64: exit status 127
Error: running "docker run --env EXEC_UID=0 --env EXEC_GID=0 -v /root/go/pkg/mod:/go/pkg/mod:ro --rm --env GOFLAGS=-mod=readonly --env MAGEFILE_VERBOSE= --env MAGEFILE_TIMEOUT= --env SNAPSHOT=false --env DEV=false -v /workspace:/go/src/github.com/elastic/beats -w /go/src/github.com/elastic/beats/filebeat docker.elastic.co/beats-dev/golang-crossbuild:1.14.12-main-debian7 --build-cmd build/mage-linux-amd64 golangCrossBuild -p linux/amd64" failed with exit code 1
running "docker run --env EXEC_UID=0 --env EXEC_GID=0 -v /root/go/pkg/mod:/go/pkg/mod:ro --rm --env GOFLAGS=-mod=readonly --env MAGEFILE_VERBOSE= --env MAGEFILE_TIMEOUT= --env SNAPSHOT=false --env DEV=false -v /workspace:/go/src/github.com/elastic/beats -w /go/src/github.com/elastic/beats/filebeat docker.elastic.co/beats-dev/golang-crossbuild:1.14.12-main-debian7 --build-cmd build/mage-linux-amd64 buildGoDaemon -p linux/amd64" failed with exit code 1
package ran for 1m13.028850674s
total 21444
drwxr-xr-x  5 root root     4096 Mar 31 20:54 .
drwxr-xr-x 22 1001  128     4096 Mar 31 20:54 ..
-rw-r--r--  1 root root    10376 Mar 31 20:53 config.modules.yml.tmpl
drwxr-xr-x  2 root root     4096 Mar 31 20:53 fields
drwxr-xr-x  3 root root     4096 Mar 31 20:53 kibana
-rwxr-xr-x  1 root root 21922893 Mar 31 20:54 mage-linux-amd64
drwxr-xr-x  4 root root     4096 Mar 31 20:53 package