jammy-amd64-tf-a-build-next: add Dockerfile

The 'Dockerfile' was copied from the tf-a-main-build job.
However, might actually need to play with some of the
PKG_DEPS.

Signed-off-by: J-Alves <joao.alves@arm.com>
Change-Id: Ibb00d7971d4dddc30f7d8464cf788474b272b0e4
diff --git a/jammy-amd64-tf-a-build-next/Dockerfile b/jammy-amd64-tf-a-build-next/Dockerfile
new file mode 100644
index 0000000..660c681
--- /dev/null
+++ b/jammy-amd64-tf-a-build-next/Dockerfile
@@ -0,0 +1,129 @@
+FROM ubuntu:jammy
+
+# Environment variables used by CI scripts
+ENV DEBIAN_FRONTEND=noninteractive
+ENV TOOLS_DIR=/home/buildslave/tools
+ENV RUSTUP_HOME=/usr/local/rustup
+ENV CARGO_HOME=/usr/local/cargo
+ENV PATH=${RUSTUP_HOME}/bin:${CARGO_HOME}/bin:${TOOLS_DIR}/bin:${PATH}
+ENV PLANTUML_JAR_PATH=/usr/share/plantuml/plantuml.jar
+ENV PKG_DEPS="\
+    bc \
+    bison \
+    build-essential \
+    clang \
+    llvm \
+    clang-tools \
+    cpio \
+    curl \
+    default-jre \
+    device-tree-compiler \
+    doxygen \
+    expect \
+    exuberant-ctags \
+    file \
+    flex \
+    g++-multilib \
+    gcc-multilib \
+    gdisk \
+    git \
+    gnuplot \
+    golang-go \
+    graphviz \
+    jq \
+    ninja-build \
+    gn \
+    device-tree-compiler \
+    lcov \
+    libffi-dev \
+    libyaml-dev \
+    libxml-libxml-perl \
+    lld \
+    locales \
+    openjdk-11-jre-headless \
+    openssh-server \
+    perl \
+    python3 \
+    python3-pycryptodome \
+    python3-dev \
+    python3-git \
+    python3-psutil \
+    python3-pyasn1 \
+    python3-venv \
+    python2.7 \
+    srecord \
+    sudo \
+    tree \
+    unzip \
+    util-linux \
+    uuid-runtime \
+    virtualenv \
+    wget \
+    zip \
+    libncurses5 \
+"
+
+# Can be overriden at build time
+ARG BUILDSLAVE_PASSWORD=buildslave
+
+COPY requirements_*.txt /opt/
+COPY tf-*.install /tmp/
+COPY setup-sshd /usr/sbin/setup-sshd
+
+# Copy armclang toolchains
+COPY ARMCompiler*.tar.gz /tmp/
+
+RUN set -ex ;\
+    echo 'locales locales/locales_to_be_generated multiselect C.UTF-8 UTF-8, en_US.UTF-8 UTF-8 ' | debconf-set-selections ;\
+    echo 'locales locales/default_environment_locale select en_US.UTF-8' | debconf-set-selections ;\
+    # Set Python 3 as default
+    ln -s -f /usr/bin/python3 /usr/bin/python ;\
+    # Set symlink for python2 if not present
+    [ -L /usr/bin/python2 ] || ln -s /usr/bin/python2.7 /usr/bin/python2;\
+    apt update -q=2 ;\
+    apt dist-upgrade -q=2 --yes ;\
+    apt install -q=2 --yes --no-install-recommends ${PKG_DEPS} ;\
+    curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash ;\
+    apt update -q=2 ;\
+    apt install -q=2 --yes --no-install-recommends git-lfs ;\
+    # Install Python requirements
+    curl -s https://bootstrap.pypa.io/pip/3.5/get-pip.py -o /tmp/get-pip.py ;\
+    python2 /tmp/get-pip.py ;\
+    pip2 install --no-cache-dir -r /opt/requirements_python2.txt ;\
+    python3 /tmp/get-pip.py ;\
+    pip3 install --no-cache-dir -r /opt/requirements_python3.txt ;\
+    # Setup buildslave user for Jenkins
+    useradd -m -s /bin/bash buildslave ;\
+    echo "buildslave:$BUILDSLAVE_PASSWORD" | chpasswd ;\
+    echo 'buildslave ALL = NOPASSWD: ALL' > /etc/sudoers.d/jenkins ;\
+    chmod 0440 /etc/sudoers.d/jenkins ;\
+    # FIXME: add /arm as a temporary workaround until ARM CI moves to Open CI paths
+    mkdir -p /var/run/sshd ${TOOLS_DIR} /arm ;\
+    # Run shell script(s) to install files, toolchains, etc...
+    bash -ex /tmp/tf-dependencies.install ;\
+    bash -ex /tmp/tf-environment.install ;\
+    # Fix permissions
+    chown -R buildslave:buildslave ${TOOLS_DIR} /usr/share/plantuml /nfs/downloads/linaro /arm ;\
+    # Cleanup
+    apt clean ;\
+    rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
+
+RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \
+        sh -s -- --default-toolchain stable -y
+RUN cargo install 'tokei@12.1.*'
+
+ENV NVM_DIR="/home/buildslave/.nvm"
+ENV BASH_ENV="${NVM_DIR}/nvm.sh"
+
+RUN echo "BASH_ENV=${BASH_ENV}" >> /etc/environment
+RUN echo "NVM_DIR=${NVM_DIR}" >> /etc/environment
+
+USER buildslave
+
+RUN curl -s "https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh" | bash
+RUN bash -c "nvm install 14"
+
+USER root
+
+EXPOSE 22
+ENTRYPOINT ["/usr/sbin/setup-sshd"]