ThePorgs / Exegol

Fully featured and community-driven hacking environment
https://exegol.readthedocs.io/
GNU General Public License v3.0
1.95k stars 191 forks source link

Custom dockerfiles path for local builds #190

Closed ShutdownRepo closed 1 year ago

ShutdownRepo commented 1 year ago

Adding the --build-path that a user can set for the exegol install command for local builds to point to custom dockerfiles. This will be especially useful for external contributors that want to build a local image before creating a pull request on the images repo, without having to mess around with their official exegol install.

Before this option, contributors would have to do something like

# 1. backup official exegol images submodule
mv "/path/to/Exegol/exegol-docker-build" "/path/to/Exegol/exegol-docker-build.bak"
# 2. overwrite submodule content with custom content
cp -r "/path/to/custom_exegol-docker-build" "/path/to/Exegol/exegol-docker-build"
# 3. build command
exegol install "myimage" "myprofile"

This would also allow contributors to have their own forks as well as their official exegol install without changes that they would be able to keep up to date (which wouldn't be possible if they were to change things locally without staging commits)

ShutdownRepo commented 1 year ago

First issue, the autocomplete will not be able to dynamically list the profiles from a custom path as it won't be possible to obtain the --build-path value live while writing the command. Second, and this is a question, I'm wondering if it's better to either

Dramelac commented 1 year ago

as it won't be possible to obtain the --build-path value live while writing the command

Yes you can. In a custom completer, from the kargs argument you can get the current parameters and their value.

Imo, this option is very advance so no interactive option, only using CLI args.

Dramelac commented 1 year ago

If can update the completer for you, dont worry

Skileau commented 1 year ago

The error displayed when trying to pass the dockerfile directly in the command line : image But is ok interactively : image

Dramelac commented 1 year ago

We can add the 'how to use' this feature in the doc on the contributor section

ShutdownRepo commented 1 year ago

We can add the 'how to use' this feature in the doc on the contributor section

agreed, but before we add it in the doc, we should finalize the feature. As of now, the code is coded in the best way I knew how in a few minutes, but there's probably a better way to do it, and more logical/better workflow, that would affect the documentation

Dramelac commented 1 year ago

@Skileau You have the file custom.dockerfile inside your dir Exegol-images ?

Skileau commented 1 year ago

@Skileau You have the file custom.dockerfile inside your dir Exegol-images ?

Yes it is in my dir Exegol-images and it is not present in the default exegol-docker-build.

Dramelac commented 1 year ago

@ShutdownRepo i can continue from here. Do we agree on removing the interactive section for the custom build path ? @Skileau i recreate your setup but i cannot reproduce your error..

ShutdownRepo commented 1 year ago

@Skileau You have the file custom.dockerfile inside your dir Exegol-images ?

The custom dockerfile is in his custom exegol images directory. The error is because the wrapper wants the profile arg to be in a list that's built from the regular images directory, instead of his custom one.

Dramelac commented 1 year ago

Yes nevermind if reproduced, fix incomming

Dramelac commented 1 year ago

@ShutdownRepo je viens de push les update, good pour moi, je te laisse regarder et tester @Skileau pareil, tu peux test à nouveau, dis moi si tu trouves des bugs