ublue-os / toolboxes

Centralized repository of containers designed for Toolbox/Distrobox
Apache License 2.0
42 stars 10 forks source link

feat: create powershell toolbox #91

Closed lambdaclan closed 1 month ago

lambdaclan commented 1 month ago

Add PowerShell toolbox

Resolves #11

Description

Add a new toolbox for Microsoft related tooling.

Proposed Changes

References

Remarks

I am aware the COPY command is wrong for the final release, but I am still testing things locally so I will adjust it after the PR review.

lambdaclan commented 1 month ago

I was originally using the Microsoft provided scripts to install dotnet and Python to install Azure CLI etc but seems like that Wolfi has native packages. I have updated the Containerfile accordingly. If anyone knows of a way to search for Wolfi packages something akin to https://pkgs.alpinelinux.org/packages?branch=edge please let me know. After some research I located https://packages.wolfi.dev/ but not sure if that is the correct list, it does not seem to include all available packages.

lambdaclan commented 1 month ago

I tried experimenting a bit with custom PowerShell profiles (pwsh bashrc) to add some niceties like a theme, fzf integration, autocomplete for PowerShell, dotnet CLI and Azure CLI but unfortunately many of these things are currently not possible due to missing PowerShell modules on Alpine based distros. Please see https://github.com/PowerShell/PowerShell/issues/20143 for more information.

It is a bit of a shame because this really limits how much we can extend the PowerShell toolbox. At this point we can either wait for the issue to be resolved (seems like some work is being done) or switch the base of the container to a different distro or just ignore everything and use whatever PowerShell is available in vanilla form.

m2Giles commented 1 month ago

While it is alpine like, this is a glibc based container/install.

lambdaclan commented 1 month ago

Hello @castrojo thank you very much for reviewing and merging my first PR 🎉 I was a bit surprised since I was expecting some requests for changes haha. Anyway, I will be happy to keep on iterating on this to make the experience better. On the original issue you mentioned that

Since no one's really claimed it, then feel free to provide whatever UX you feel people would like!

Does this mean I am free to use a different base for this container? Maybe Fedora or Ubuntu for example. Now that I know that Wolfi is using glibc and not musl as kindly pointed out by @m2Giles there might be alternative ways of accessing the missing modules I mention above. I am not too optimistic though since it seems the Wolfi package is still using the Alpine package as a base, so the modules are still missing.

I could try installing the PowerShell binary provided we can get all the necessary dependencies on Wolfi but not sure if it will work, I will look into it. Furthermore, I guess we also need to update the README to include the new toolbox.

If you feel the current toolbox is OK as is, I will be happy to work on something else. I do not really use Discord, so I cannot ask directly what you guys need help with so feel free to point me to the right direction when you get a chance ;)

castrojo commented 1 month ago

If there's things you need in wolfi then let us know, @EyeCantCU can take a look, we'd prefer to share base images on wolfi where possible for efficiency reasons. And if things are missing we'll just work with the wolfi community to get them added. Thanks!

lambdaclan commented 1 month ago

Got it, I will do some more experiments and will be in touch once I have some updates. Thanks for the prompt response!

lambdaclan commented 1 month ago

If there's things you need in wolfi then let us know, @EyeCantCU can take a look,

I made some progress. For now, I found a workaround, so I will be opening a new PR shortly that will improve the overall shell experience. Regarding the issue itself I have posted my findings here https://github.com/wolfi-dev/os/pull/16744 for the Wolfi team to see. Maybe @EyeCantCU can offer some further feedback. We can always update container file at a later stage once and if the native packages issues are resolved.

EyeCantCU commented 1 month ago

Hi @lambdaclan,

I'm happy to help with this. The best way to report issues with packages in Wolfi is to file an issue on our issue tracker here: https://github.com/wolfi-dev/os/issues

I can certainly look into this later today and figure out what the best approach here would be

EyeCantCU commented 1 month ago

@lambdaclan,

Took a moment to dig into this, and unfortunately, this isn't something we'd be able to provide upstream in Wolfi

Please see the notes left here: https://github.com/PowerShell/PowerShell/issues/20143#issuecomment-1686696671

However, you could work around this by adding this to the Dockerfile:

RUN apk add dotnet-8-sdk && \
    dotnet tool install --tool-path /usr/bin PowerShell
lambdaclan commented 1 month ago

Hello @EyeCantCU.

Thank you very much for taking some time to look into this issue, really appreciated.

Took a moment to dig into this, and unfortunately, this isn't something we'd be able to provide upstream in Wolfi Please see the notes left here: https://github.com/PowerShell/PowerShell/issues/20143#issuecomment-1686696671

Indeed, I am aware of the issue, although there is some work being done lately I am not sure when and if the issue will be resolved.

However, you could work around this by adding this to the Dockerfile: RUN apk add dotnet-8-sdk && \ dotnet tool install --tool-path /usr/bin PowerShell

Yeap, this is exactly what I ended up doing, works well enough for now, and we can always update to a native package when available :+1: