From a84c9f5bb2cfc941526e09c60f7a79d74c5eef9d Mon Sep 17 00:00:00 2001 From: hbai Date: Fri, 2 Jul 2021 01:09:04 -0700 Subject: [PATCH] stx tool: Create initial Debian based STX build container Dockerfile Create the initial Dockerfile of STX build container which is based on Debian bullseye Story: 2008846 Task: 42358 Signed-off-by: hbai Change-Id: I638490c1b9099fc6be2857bf60d8c6dcfe3ea0a4 --- stx/dockerfiles/stx-builder.Dockerfile | 66 ++++++++++++++++++++++++++ stx/toCOPY/builder/buildrc | 35 ++++++++++++++ 2 files changed, 101 insertions(+) create mode 100644 stx/dockerfiles/stx-builder.Dockerfile create mode 100644 stx/toCOPY/builder/buildrc diff --git a/stx/dockerfiles/stx-builder.Dockerfile b/stx/dockerfiles/stx-builder.Dockerfile new file mode 100644 index 00000000..76579389 --- /dev/null +++ b/stx/dockerfiles/stx-builder.Dockerfile @@ -0,0 +1,66 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Copyright (C) 2021 Wind River Systems,Inc. +# +FROM debian:bullseye + +ENV container=docker \ + MYUNAME=builder \ + PROJECT=stx \ + PATH=/opt/LAT/lat:$PATH +ARG MYUID=1000 + +RUN echo "deb-src http://deb.debian.org/debian bullseye main" >> /etc/apt/sources.list +RUN echo "deb-src http://deb.debian.org/debian buster main" >> /etc/apt/sources.list + +# Download required dependencies by mirror/build processes. +RUN apt-get update && apt-get install --no-install-recommends -y \ + sudo \ + ssh \ + git \ + wget \ + curl \ + vim \ + python3 \ + python3-yaml \ + python3-pip \ + xz-utils \ + file \ + bzip2 \ + dnsutils \ + locales-all \ + python3-apt \ + dpkg-dev \ + git-buildpackage \ + fakeroot \ + proxychains && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* && \ + pip3 install \ + git \ + requests \ + python-debian \ + pulpcore_client \ + pulp_deb_client \ + pulp_file_client \ + progressbar \ + git+git://github.com/masselstine/aptly-api-client.git && \ + groupadd -g 751 cgts && \ + useradd -r -u $MYUID -g cgts -m $MYUNAME && \ + sed -i '/^proxy_dns*/d' /etc/proxychains.conf && \ + sed -i 's/^socks4.*/socks5 127.0.0.1 8080/g' /etc/proxychains.conf && \ + chown $MYUNAME /home/$MYUNAME && \ + echo "$MYUNAME ALL=(ALL:ALL) NOPASSWD:ALL" >> /etc/sudoers + +COPY stx/toCOPY/builder/buildrc /home/$MYUNAME/ +USER $MYUNAME diff --git a/stx/toCOPY/builder/buildrc b/stx/toCOPY/builder/buildrc new file mode 100644 index 00000000..a8b2bca1 --- /dev/null +++ b/stx/toCOPY/builder/buildrc @@ -0,0 +1,35 @@ +# Common configuration for StarlingX builder + +# Find the other rc files +BUILDRC_DIR=$(cd $(dirname "${BASH_SOURCE:-$0}") && pwd) + +# Allow local overrides of env variables +if [[ -f $BUILDRC_DIR/localrc ]]; then + source $BUILDRC_DIR/localrc +fi + +# In the docker run command this will be correct for the host side of the mapping +LOCALDISK="/localdisk" + +# Release Variable +export MY_RELEASE=${MY_RELEASE:-6.0} + +# avoid calling your project 'build' it will break some SDEBs +export PROJECT=${PROJECT:-stx} + +# These are used in the Dockerfile, not sure where else +export MYUNAME=${MYUNAME:-builder} + +# All of the below are dependent on variables defined earlier, right now +# we are not going to support directly setting them in localrc +export MY_BUILD_PKG_DIR=${LOCALDISK}/loadbuild/$MYUNAME/$PROJECT/ +export MY_WORKSPACE=${LOCALDISK}/loadbuild/$MYUNAME/$PROJECT/ +export MY_LOCAL_DISK=${LOCALDISK}/designer/$MYUNAME +export MY_REPO_ROOT_DIR=$MY_LOCAL_DISK/$PROJECT +export MY_REPO=$MY_REPO_ROOT_DIR/cgcs-root +export MY_BUILD_TOOLS_DIR=$MY_REPO/build-tools +export LAYER=$LAYER +export STX_CONFIG_DIR=$MY_REPO/stx-tools +export STX_GIT_SRC_DIR=$MY_REPO/stx/git +export PATH=$PATH:$MY_BUILD_TOOLS_DIR/stx +export PYTHONPATH=$PYTHONPATH:$MY_BUILD_TOOLS_DIR/stx