blob: 3970c465de4239e9f55305534be5ea7c70cd493c [file] [log] [blame]
FROM ubuntu:jammy
ENV DEBIAN_FRONTEND noninteractive
ARG ARCH_PACKAGES
ENV ARCH_PACKAGES ${ARCH_PACKAGES:-}
ARG KVM_PACKAGES
ENV KVM_PACKAGES ${KVM_PACKAGES:-}
RUN /usr/bin/apt-get update
RUN /usr/bin/apt-get -y dist-upgrade
RUN /usr/bin/apt-get -y install curl file jq lsb-release lsof openssh-client psmisc python3 sudo
RUN /usr/bin/apt-get -y install $ARCH_PACKAGES
RUN /usr/bin/apt-get -y install $KVM_PACKAGES
# Install these packages here rather than as part of install-build-deps.sh since
# the DEBIAN_FRONTEND=noninteractive env var doesn't appear to apply to
# install-build-deps.sh and the package ends up waiting on user input.
RUN /usr/bin/apt-get -y install keyboard-configuration tzdata
# Dependencies required for testing and development.
RUN /bin/mkdir /tmp/setup-deps
RUN curl -L \
"https://chromium.googlesource.com/chromium/src/+/HEAD/build/install-build-deps.py?format=TEXT" \
| base64 -d \
> /tmp/setup-deps/install-build-deps.py
RUN /bin/chmod a+x /tmp/setup-deps/install-build-deps.py
RUN /tmp/setup-deps/install-build-deps.py --no-prompt
# Cleanup to shrink image sizes.
RUN /usr/bin/find /var/lib/apt/lists /tmp /var/tmp /usr/share/info \
/usr/share/lintian /usr/share/man -maxdepth 1 -mindepth 1 -exec rm -rf {} \;
RUN /usr/bin/find /usr/share/doc -depth -type f ! -name copyright -exec rm -rf {} \;
RUN /usr/bin/find /usr/share/doc -depth -empty -exec rm -rf {} \;
RUN /bin/mkdir /opt/swarming_bootstrap
ADD start_swarm_bot.sh /opt/swarming_bootstrap/start_swarm_bot.sh
# /sbin/shutdown is a symlink to /bin/systemctl prior to bionic, and ADDing a
# file at a symlink replaces the target of the symlink. So remove the symlink
# first before adding shutdown.sh so we don't end up replacing /bin/systemctl.
RUN /bin/rm -f /sbin/shutdown
ADD shutdown.sh /sbin/shutdown
RUN /bin/chmod 0755 /sbin/shutdown
RUN echo "%chrome-bot ALL = NOPASSWD: /sbin/shutdown" > /etc/sudoers.d/chrome-bot
CMD ["/bin/bash", "/opt/swarming_bootstrap/start_swarm_bot.sh"]