blob: e0dcbaf93e47e32ab928566b6e4f525072f4d717 [file] [log] [blame]
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 \
# grab gsutil
RUN echo \
"deb [signed-by=/usr/share/keyrings/] \ cloud-sdk main" | \
tee -a /etc/apt/sources.list.d/google-cloud-sdk.list && \
curl | \
apt-key --keyring /usr/share/keyrings/ \
add - && apt-get update -y && apt-get install google-cloud-sdk -y
RUN rm -rf /usr/lib/google-cloud-sdk/bin/anthoscli \
# 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;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/