twoliter icon indicating copy to clipboard operation
twoliter copied to clipboard

Investigate if a variant build can be built inside a container

Open jmt-lab opened this issue 1 year ago • 1 comments

A customer attempted to build bottlerocket variants inside of a docker container with the docker daemon socket shared between the host and the container. The build failed when buildsys orchestrated docker build to mount the sources into the build context because of the directory going from container volume -> host -> build-context. (https://github.com/bottlerocket-os/bottlerocket/issues/4100)

We should investigate whether it would be possible for this flow to work. Roughly we could allow the user to specify a host path that is shared via a mounted volume in both the build container and then in the build context.

jmt-lab avatar Jul 23 '24 23:07 jmt-lab

Current workaround used for this:

#!/usr/bin/env bash
git clone https://github.com/bottlerocket-os/bottlerocket.git
cd bottlerocket
BOTTLEROCKET_PATH="$(pwd)"

cat <<EOF >> build.sh
#!/usr/bin/env bash
apt update
apt install -y --no-install-recommends docker.io docker-buildx
docker image ls
apt install -y build-essential openssl libssl-dev pkg-config liblz4-tool
apt install -y rustup git curl
rustup install stable || true
cargo install cargo-make
cd "${BOTTLEROCKET_PATH}"
cargo make
EOF


docker run --rm -it -v "/tmp:/tmp" -v "/var/run/docker.sock:/var/run/docker.sock" -v "${BOTTLEROCKET_PATH}:${BOTTLEROCKET_PATH}" ubuntu sh -c "cd ${BOTTLEROCKET_PATH} && chmod +x ./build.sh && ./build.sh"

We should see if we can fix pipesys and temp sharing for sbkeys to make this better

jmt-lab avatar Jul 25 '24 22:07 jmt-lab