[F20] Initial dockerfiles for Tauto RTD
These will not build right now (as /supporting is missing), but they are
a starting point (more to come)
BUG=b:186635049
TEST=local testing
Change-Id: I280fa8f3241bcbfc7597acc43d29e28fd4a4f87f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/dev-util/+/2885995
Tested-by: Derek Beckett <dbeckett@chromium.org>
Commit-Queue: Derek Beckett <dbeckett@chromium.org>
Reviewed-by: Keith Haddow <haddowk@chromium.org>
Reviewed-by: Katherine Threlkeld <kathrelkeld@chromium.org>
diff --git a/test/Dockerfiles/Dockerfile b/test/Dockerfiles/Dockerfile
new file mode 100644
index 0000000..e0dcbaf
--- /dev/null
+++ b/test/Dockerfiles/Dockerfile
@@ -0,0 +1,71 @@
+FROM python:3.8-slim-buster AS build
+
+RUN apt-get update \
+ && apt-get install -y \
+ ca-certificates \
+ curl \
+ lsb-release \
+ iproute2 \
+ iputils-ping \
+ python2.7 \
+ python-pip \
+ rsync \
+ ssh \
+ sudo \
+ wget
+
+# grab gsutil
+RUN echo \
+ "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] \
+ http://packages.cloud.google.com/apt cloud-sdk main" | \
+ tee -a /etc/apt/sources.list.d/google-cloud-sdk.list && \
+ curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | \
+ apt-key --keyring /usr/share/keyrings/cloud.google.gpg \
+ add - && apt-get update -y && apt-get install google-cloud-sdk -y
+RUN rm -rf /usr/lib/google-cloud-sdk/bin/anthoscli \
+ /usr/lib/google-cloud-sdk/bin/kuberun
+
+# Config the user
+RUN useradd -m chromeos-test
+# Add passwordless sudo for chromeos-test.
+# TODO, Try to remove SUDO from containers
+RUN echo 'chromeos-test ALL=NOPASSWD:ALL' > /etc/sudoers.d/chromeos-test
+
+# Install all packages
+COPY requirements.txt .
+RUN pip2 install --upgrade pip
+RUN pip2 install -r requirements.txt
+RUN pip3 install -r requirements.txt
+
+# deploy autotest_server packages
+COPY autotest_server_package.tar.bz2 /tmp/autotest_server_package.tar.bz2
+RUN tar -xvf /tmp/autotest_server_package.tar.bz2 -C /usr/local
+
+# Configure the ssh for testing
+RUN mkdir ~/.ssh
+RUN echo '\n\
+Host * \n\
+ StrictHostKeyChecking=no \n\
+ IdentityFile %d/.ssh/testing_rsa \n\
+ UserKnownHostsFile=/dev/null \n\
+'> ~/.ssh/config
+
+RUN cp /usr/local/autotest/utils/frozen_chromite/ssh_keys/testing_rsa ~/.ssh/
+RUN chmod 400 ~/.ssh/testing_rsa
+
+WORKDIR /usr/local/autotest
+COPY shadow_config.ini .
+
+# LXC gives chown/chgrp to root...
+RUN chown chromeos-test:chromeos-test /usr/local/tast
+RUN chown chromeos-test:chromeos-test /usr/local/autotest
+
+# The upstream autotest code that run in the container uses this to determine
+# it is running in a container. Even though we are running docker not lxc
+# the check is for the string lxc.
+# See https://source.corp.google.com/chromeos_public/src/third_party/autotest/files/server/server_job.py;l=940
+ENV container=lxc
+
+# Throw in a test_service mock for POC
+RUN mkdir -p /usr/bin/test_service
+COPY test_service/ /usr/bin/test_service/
diff --git a/test/Dockerfiles/Dockerfile_cts b/test/Dockerfiles/Dockerfile_cts
new file mode 100644
index 0000000..a67b01d
--- /dev/null
+++ b/test/Dockerfiles/Dockerfile_cts
@@ -0,0 +1,30 @@
+# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# TODO change to dynamically use FROM the build versioned container
+FROM autotest_base7 as build
+
+RUN apt-get update \
+ && apt-get install -y \
+ ca-certificates
+
+WORKDIR /
+
+# Java - required for CTS/GTS
+RUN wget https://download.java.net/java/GA/jdk9/9.0.4/binaries/openjdk-9.0.4_linux-x64_bin.tar.gz
+RUN tar xvf openjdk-9.0.4_linux-x64_bin.tar.gz
+RUN update-alternatives --install /usr/bin/java java \
+ /jdk-9.0.4/bin/java 200000
+RUN update-alternatives --config java
+# Java 9 has a issue where the ca certificates are not correct,
+# get them from v 13
+RUN wget https://download.java.net/java/GA/jdk13.0.1/cec27d702aa74d5a8630c65ae61e4305/9/GPL/openjdk-13.0.1_linux-x64_bin.tar.gz
+RUN tar xvf openjdk-13.0.1_linux-x64_bin.tar.gz
+RUN cp jdk-13.0.1/lib/security/cacerts jdk-9.0.4/lib/security/
+RUN rm -rf jdk-13.0.1
+RUN rm -f openjdk*.gz
+
+# Set chromeos-test permissions
+RUN mkdir -p /tmp/autotest-tradefed-cache
+RUN chown chromeos-test:chromeos-test /tmp/autotest-tradefed-cache
\ No newline at end of file
diff --git a/test/Dockerfiles/requirements.txt b/test/Dockerfiles/requirements.txt
new file mode 100644
index 0000000..346e1b7
--- /dev/null
+++ b/test/Dockerfiles/requirements.txt
@@ -0,0 +1,7 @@
+# Extra requirements for RTD TLS integration
+grpcio==1.31.0
+mock
+numpy==1.16.6
+pyparsing
+protobuf
+six==1.15.0
\ No newline at end of file