containers / toolbox

Tool for interactive command line environments on Linux
https://containertoolbx.org/
Apache License 2.0
2.39k stars 208 forks source link

Add support for creating toolboxes from Containerfile #1401

Closed wbrawner closed 5 months ago

wbrawner commented 8 months ago

This adds a new flag to toolbox create, -f, --file, which allows the user to create a toolbox from the given Containerfile. If --image is provided, then that is the name that is used to tag the container. If --container is provided, then that is used as the name of the newly created container. If either of those parameters are absent, then the name of the current directory is used in its place. I used the following Containerfile to test this, which installs the dependencies needed to build toolbox:

Containerfile

FROM registry.fedoraproject.org/fedora-toolbox:39

ENV NAME=toolbox-dev VERSION=39
LABEL com.github.containers.toolbox=true \\
      com.redhat.component="$NAME" \\
      name="$NAME" \\
      version="$VERSION" \\
      usage="This is a toolbox development container" \\
      summary="Container used for development of the toolbox tool itself" \\
      maintainer="William Brawner "

RUN dnf install -y golang \\
        clang \\
        meson \\
        ninja-build \\
        go-md2man \\
        shadow-utils-subid-devel

Of note with this is I found that using registry.fedoraproject.org/fedora instead of registry.fedoraproject.org/fedora-toolbox led to errors in toolbox initialization. Should we attempt to detect this and print a warning to the user to ensure they have the necessary packages installed in order for toolbox to work?

This closes #1397.

softwarefactory-project-zuul[bot] commented 8 months ago

Build failed. https://softwarefactory-project.io/zuul/t/local/buildset/c8315bde6f2742bcaf9f20717bbfd9ad

:x: unit-test FAILURE in 8m 55s :x: unit-test-migration-path-for-coreos-toolbox RETRY_LIMIT in 2m 46s :x: unit-test-restricted FAILURE in 8m 03s :heavy_check_mark: system-test-fedora-rawhide SUCCESS in 30m 36s :heavy_check_mark: system-test-fedora-39 SUCCESS in 32m 00s :heavy_check_mark: system-test-fedora-38 SUCCESS in 29m 20s :heavy_check_mark: system-test-fedora-37 SUCCESS in 37m 02s

wbrawner commented 5 months ago

I'm afraid I don't really have the time or inclination to work on this anymore, so I'll close this PR. Thank you!