#!/bin/bash -xe # # Build the required docker image to run rootfs_size.py # # Script Variables: # DOCKER_IMG_NAME: # default is openbmc/ubuntu-rootfs-size # DISTRO: # UBUNTU_MIRROR: [optional] The URL of a mirror of Ubuntu to override the # default ones in /etc/apt/sources.list # default is empty, and no mirror is used. # DOCKER_REG: /etc/apt/sources.list && \ echo \"deb ${UBUNTU_MIRROR} \$(. /etc/os-release && echo \$VERSION_CODENAME)-updates main restricted universe multiverse\" >> /etc/apt/sources.list && \ echo \"deb ${UBUNTU_MIRROR} \$(. /etc/os-release && echo \$VERSION_CODENAME)-security main restricted universe multiverse\" >> /etc/apt/sources.list && \ echo \"deb ${UBUNTU_MIRROR} \$(. /etc/os-release && echo \$VERSION_CODENAME)-proposed main restricted universe multiverse\" >> /etc/apt/sources.list && \ echo \"deb ${UBUNTU_MIRROR} \$(. /etc/os-release && echo \$VERSION_CODENAME)-backports main restricted universe multiverse\" >> /etc/apt/sources.list" fi ################################# docker img # ################################# if [[ "${DISTRO}" == "ubuntu"* ]]; then if [[ -n "${http_proxy}" ]]; then PROXY="RUN echo \"Acquire::http::Proxy \\"\"${http_proxy}/\\"\";\" > /etc/apt/apt.conf.d/000apt-cacher-ng-proxy" fi Dockerfile=$(cat << EOF FROM ${docker_reg}/${DISTRO} ${PROXY} ${MIRROR} ENV DEBIAN_FRONTEND noninteractive RUN apt-get update && apt-get install -yy \ python3 \ python3-dev\ python3-yaml \ python3-mako \ python3-pip \ python3-setuptools \ curl \ git \ wget \ sudo \ squashfs-tools # Final configuration for the workspace RUN grep -q ${GROUPS[0]} /etc/group || groupadd -g ${GROUPS[0]} ${USER} RUN mkdir -p $(dirname "${HOME}") RUN grep -q ${UID} /etc/passwd || useradd -d ${HOME} -m -u ${UID} -g ${GROUPS[0]} ${USER} RUN sed -i '1iDefaults umask=000' /etc/sudoers RUN echo "${USER} ALL=(ALL) NOPASSWD: ALL" >>/etc/sudoers RUN /bin/bash EOF ) fi ################################# docker img # ################################# # Build above image docker build --network=host -t "${DOCKER_IMG_NAME}" - <<< "${Dockerfile}"