Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker build support #413

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

docker build support #413

wants to merge 7 commits into from

Conversation

lrvick
Copy link

@lrvick lrvick commented Jan 16, 2024

Support building live-bootstrap as a deterministic docker image.

./rootfs.py --docker

An image can be exported after build with:

docker save local/live-bootstrap -o live-bootstrap.tar

Expected hash as of this PR is:

c3b92d943f5ea55188049fb2c0187c2e10e258ee28216313cf43c2cb5801985c

rootfs.py Outdated Show resolved Hide resolved
@@ -29,14 +29,15 @@ def create_configuration_file(args):
config_path = os.path.join('steps', 'bootstrap.cfg')
with open(config_path, "w", encoding="utf_8") as config:
config.write(f"FORCE_TIMESTAMPS={args.force_timestamps}\n")
config.write(f"CHROOT={args.chroot or args.bwrap}\n")
config.write(f"CHROOT={args.chroot or args.bwrap or args.docker}\n")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not something that needs changing in this PR, but in the future, we might want to rename this variable to something more descriptive, like USERSPACE_ONLY (especially if/when I go through with adding the WSL bootstrap mode I'm planning).

@lrvick lrvick requested a review from stikonas January 25, 2024 00:03
@lrvick lrvick requested a review from Googulator January 30, 2024 13:05
Comment on lines +161 to +163
if args.docker:
args.external_sources = True

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this?

generator.prepare(target, using_kernel=False)
arch = stage0_arch_map.get(args.arch, args.arch)
init = os.path.join(os.sep, 'bootstrap-seeds', 'POSIX', arch, 'kaem-optional-seed')
print(generator.target_dir, init)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

leftover debug print

# Add /etc/resolv.conf
echo 'nameserver 1.1.1.1' > /etc/resolv.conf
echo 'nameserver 1.1.1.1' > /etc/resolv.conf.head
if [ "${EXTERNAL_SOURCES}" = "False" ]; then
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, is this the only way to do this? Wouldn't it work to have a ${DOCKER} to disable writing resolv.conf, and still retain the ability to run without predownloading everything on the host?


FROM scratch as build
ADD target/ /
RUN ["/bootstrap-seeds/POSIX/x86/kaem-optional-seed"]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pass "arch" from bootstrap() here, if possible, rather than hardcoding "x86".


FROM build as install
ENV PATH=/bin:/usr/sbin:/usr/bin
RUN set -eux; \
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the inclusion of the "x" flag intentional here, or just leftover from debugging?

# SPDX-License-Identifier: GPL-3.0-or-later

FROM scratch as build
ADD target/ /
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pass target directory from bootstrap() here, if possible, rather than hardcoding "target".

echo 'nameserver 1.1.1.1' > /etc/resolv.conf
fi
if [ ! -e "/etc/resolv.conf/head" ]; then
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: resolv.conf.head


# /etc/passwd -- taken from LFS
if [ ! -e "/etc/passwd" ]; then
cat > /etc/passwd << "EOF"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't this conflict with later steps?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants