Add git clone, gcloud sdk and builder Dockerfile This adds the Builderfile, Gcloudfile and Gitfile. They are called GIT_CLONE, GCLOUD and BUILDER toolchain images on the yaml configuration file. Signed-off-by: Simon-Lii <thesimonli@google.com> Change-Id: I2d9e7e85a823601342b86c3bf1a4b23d9aabd0ca
diff --git a/dockerfiles/Builderfile b/dockerfiles/Builderfile new file mode 100644 index 0000000..1c714b3 --- /dev/null +++ b/dockerfiles/Builderfile
@@ -0,0 +1,38 @@ +FROM ubuntu:18.04 + +RUN apt-get update && DEBIAN_FRONTEND=noninteractive \ + apt-get -y install gawk wget git-core \ + diffstat unzip texinfo gcc-multilib build-essential \ + file chrpath socat cpio python python3-dev python3-pip python3-setuptools \ + python3-pexpect xz-utils debianutils iputils-ping curl \ + libsdl1.2-dev xterm tar sudo locales liblz4-tool zstd \ + --no-install-recommends && rm -rf /var/lib/apt/lists/* + +# Create a non-root user that will perform the actual build +RUN id build 2>/dev/null || useradd --uid 30000 --create-home build +RUN echo "build ALL=(ALL) NOPASSWD: ALL" | tee -a /etc/sudoers + +# Fix error "Please use a locale setting which supports utf-8." +# See https://wiki.yoctoproject.org/wiki/TipsAndTricks/ResolvingLocaleIssues +RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \ + echo 'LANG="en_US.UTF-8"'>/etc/default/locale && \ + dpkg-reconfigure --frontend=noninteractive locales && \ + update-locale LANG=en_US.UTF-8 +ENV LC_ALL en_US.UTF-8 +ENV LANG en_US.UTF-8 +ENV LANGUAGE en_US.UTF-8 + +# Fast gsutil rsync +RUN pip3 install --no-cache-dir -U crcmod + +# Python dependencies through pip3 +RUN pip3 install --no-cache-dir -U sh + +# go/kokoro-cloud-build#docker-container-setup +RUN mkdir -p /tmpfs && mkdir -p /workspace && ln -s /workspace /tmpfs/src + +RUN mkdir -p /workspace/gcb/bmc +RUN chmod -R 777 /workspace/gcb/bmc +RUN chown build:build -R /workspace/gcb/bmc + +USER build
diff --git a/dockerfiles/Gcloudfile b/dockerfiles/Gcloudfile new file mode 100644 index 0000000..493c22b --- /dev/null +++ b/dockerfiles/Gcloudfile
@@ -0,0 +1,36 @@ +FROM gcr.io/google.com/cloudsdktool/cloud-sdk + +RUN apt-get update && DEBIAN_FRONTEND=noninteractive \ + apt-get -y install gawk wget git-core \ + diffstat unzip texinfo gcc-multilib build-essential \ + file chrpath socat cpio python3 python3-dev python3-pip python3-setuptools \ + python3-pexpect python3-sh xz-utils debianutils iputils-ping curl \ + libsdl1.2-dev xterm tar sudo locales liblz4-tool zstd \ + --no-install-recommends && rm -rf /var/lib/apt/lists/* + +# Fix error "Please use a locale setting which supports utf-8." +# See https://wiki.yoctoproject.org/wiki/TipsAndTricks/ResolvingLocaleIssues +RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \ + echo 'LANG="en_US.UTF-8"'>/etc/default/locale && \ + dpkg-reconfigure --frontend=noninteractive locales && \ + update-locale LANG=en_US.UTF-8 +ENV LC_ALL en_US.UTF-8 +ENV LANG en_US.UTF-8 +ENV LANGUAGE en_US.UTF-8 + +# Fast gsutil rsync +RUN pip3 install --no-cache-dir -U crcmod --quiet + +# Create a non-root user that will perform the actual build +RUN id build 2>/dev/null || useradd --uid 30000 --create-home build +RUN echo "build ALL=(ALL) NOPASSWD: ALL" | tee -a /etc/sudoers + +# enum module for python +RUN pip3 install enum34 --user + +# Google Cloudbuild volume setup +RUN mkdir -p /workspace/gcb/bmc +RUN chmod -R 777 /workspace/gcb/bmc +RUN chown build:build -R /workspace/gcb/bmc + +USER root
diff --git a/dockerfiles/Gitfile b/dockerfiles/Gitfile new file mode 100644 index 0000000..86521a1 --- /dev/null +++ b/dockerfiles/Gitfile
@@ -0,0 +1,33 @@ +FROM gcr.io/cloud-builders/git + +RUN apt-get update && DEBIAN_FRONTEND=noninteractive \ + apt-get -y install gawk wget git-core \ + diffstat unzip texinfo gcc-multilib build-essential \ + file chrpath socat cpio python python3-dev python3-pip python3-setuptools \ + python3-pexpect xz-utils debianutils iputils-ping curl \ + libsdl1.2-dev xterm tar sudo locales liblz4-tool zstd python3.8 \ + --no-install-recommends && rm -rf /var/lib/apt/lists/* + +# Fix error "Please use a locale setting which supports utf-8." +# See https://wiki.yoctoproject.org/wiki/TipsAndTricks/ResolvingLocaleIssues +RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \ + echo 'LANG="en_US.UTF-8"'>/etc/default/locale && \ + dpkg-reconfigure --frontend=noninteractive locales && \ + update-locale LANG=en_US.UTF-8 +ENV LC_ALL en_US.UTF-8 +ENV LANG en_US.UTF-8 +ENV LANGUAGE en_US.UTF-8 + +# sh module for python +RUN pip3 install --no-cache-dir -U sh --quiet + +# Create a non-root user that will perform the actual build +RUN id build 2>/dev/null || useradd --uid 30000 --create-home build +RUN echo "build ALL=(ALL) NOPASSWD: ALL" | tee -a /etc/sudoers + +# gcb container setup +RUN mkdir -p /workspace/gcb/bmc +RUN chmod -R 777 /workspace/gcb/bmc +RUN chown build:build -R /workspace/gcb/bmc + +USER build