root/build-tools/build-docker-images
Don Penney b864e153dd Support source patches for building images
The build-stx-images.sh allows for building images using a git repo as
the source, which is cloned into the workspace as part of the build
procedure. In some cases, there may be source changes required for
fixes or enhancements that have not yet merged into the referenced
repo. This update adds support in build-stx-images to allow the
designer to specify patches in the image directives file, which will
be applied after cloning.

Designer workflow:
* clone git repo (may need to apply any existing git patches from
previous fixes)
* make changes
* commit, with a beautiful and admirable commit message
* git format-patch
* copy source patch to stx repo, somewhere alongside the docker_image
directives file (ie. a docker_patches dir)
* update docker_image directives file to add DOCKER_REPO_PATCHES or
SOURCE_PATCHES, as appropriate, with DOCKER_REF or SOURCE_REF set to
the current upstream SHA used as the base for the patch

Story: 2006711
Task: 38499
Change-Id: Icac2b4dc2ebeb32946de6e5adcbf59a10c56a30c
Signed-off-by: Don Penney <don.penney@windriver.com>
2020-01-28 10:51:07 -05:00
..
stx-centos Update stx-centos dev repo config to stein 2019-05-01 18:25:41 -04:00
build-stx-base.sh Retries for certain wheel and image build commands 2019-04-09 16:23:02 -04:00
build-stx-images.sh Support source patches for building images 2020-01-28 10:51:07 -05:00
internal-update-stx-image.sh Tool for incremental image updates 2019-06-03 20:36:16 +00:00
README Update wheels and build tool 2019-03-24 21:03:21 -04:00
update-stx-image.sh Update image build tools to handle non-shell entrypoint 2019-12-23 10:03:29 -05:00

## Example commands for building StarlingX images

PRIVATE_REGISTRY_USERID=myuser
PRIVATE_REGISTRY=xxx.xxx.xxx.xxx:9001
VERSION=2018.11.13
OS=centos
OS_VERSION=7.5.1804
BUILD_STREAM=stable
HOST_PORT=8088

## Step 1: Build stx-centos
time $MY_REPO/build-tools/build-docker-images/build-stx-base.sh \
    --os ${OS} \
    --os-version ${OS_VERSION} \
    --version ${VERSION} \
    --user ${PRIVATE_REGISTRY_USERID} \
    --registry ${PRIVATE_REGISTRY} \
    --push \
    --repo stx-local-build,http://${HOSTNAME}:${HOST_PORT}/${MY_WORKSPACE}/std/rpmbuild/RPMS \
    --repo stx-mirror-distro,http://${HOSTNAME}:${HOST_PORT}/${MY_REPO}/cgcs-root/cgcs-${OS}-repo/Binary \
    --clean


## Step 2: Build wheels (output as tarball)
time $MY_REPO/build-tools/build-wheels/build-wheel-tarball.sh \
    --os ${OS} \
    --os-version ${OS_VERSION} \
    --stream ${BUILD_STREAM}

## Step 3: Build images
time $MY_REPO/build-tools/build-docker-images/build-stx-images.sh \
    --os ${OS} \
    --version ${VERSION} \
    --stream ${BUILD_STREAM} \
    --base ${PRIVATE_REGISTRY}/${PRIVATE_REGISTRY_USERID}/stx-${OS}:${VERSION} \
    --wheels http://${HOSTNAME}:${HOST_PORT}/${MY_WORKSPACE}/std/build-wheels-${OS}-${BUILD_STREAM}/stx-${OS}-${BUILD_STREAM}-wheels.tar \
    --user ${PRIVATE_REGISTRY_USERID} \
    --registry ${PRIVATE_REGISTRY} \
    --push --latest \
    --clean


## Note: Verify that lighttpd is not bound to "localhost"
vi /etc/lighttpd/lighttpd.conf
# server.bind = "localhost"
systemctl restart lighttpd

## Note: You may need to add an iptables rule to allow the docker
## containers to access the http server on your host. For example:
iptables -I INPUT 6 -i docker0 -p tcp --dport ${HOST_PORT} -m state --state NEW,ESTABLISHED -j ACCEPT