-
Notifications
You must be signed in to change notification settings - Fork 4
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
Decide whether to base the devcontainer on mcr.microsoft.com/devcontainers/python
#208
Comments
Don't think the tie in would be too strong, but generally prefer composition (features) instead of a monolithic base container. Then again, features can be rather slow |
I agree with @garryod on tie in. The slowness of features has definitely reduces adoption in DAQ so it is something we're looking to do something about. An alternative might be to build our own base image out of precisely the features we want and use that? |
I think the microsoft one is precisely that, base python image with |
Benchmarking the existing container with just dev dependencies (python-copier-template-example):
If we remove `common-utils":
If we switch to mcr.microsoft.com/devcontainers/python:
|
Also, most of the warm cache time is taken with 25s of |
I think common utils is giving more than just zsh. Maybe.
We used to have manual workarounds for the above but I prefer the native MS approach if possible. |
Above is not true as I tried it here https://github.com/gilesknap/docker-outside-docker/tree/no-common-utils. If you do not use MS base image and remove common-utils feature you need only add an install of git and all of the above still work. So zsh is all you miss out on as far as I can tell. But I do like zsh these days. |
One thing that helps massively is going back to how it was originally, removing the feature, and installing it manually in the Dockerfile: RUN git clone https://github.com/devcontainers/features --depth=1 && USERNAME=none bash features/src/common-utils/install.sh This means that it gets cached rather than being run each time.
If we switch to uv too then then we can shave another 20s off this |
Not sure of the exact format of their OCI artifacts, but I expect oras pull is likely what you're after |
@coretl would it be even faster if we did that and prebuilt it remotely and pulled from Github? |
I would rather avoid maintaining a container build for every version of python we want to support that triggers a rebuild each time there are security updates... If we only pay the 1min cost on first run of the dev container that doesn't seem too bad to me... If we want to go down the container build root then we should use the devcontainers cli to make these in the copier template CI, but we need to work out when to trigger them... |
Ok, here is the version with # Add common utils features
COPY --from=ghcr.io/oras-project/oras:v1.2.0 /bin/oras /bin/oras
RUN mkdir /tmp/common-utils \
&& cd /tmp/common-utils \
&& /bin/oras pull ghcr.io/devcontainers/features/common-utils:2 \
&& tar xvf devcontainer-feature-common-utils.tgz \
&& USERNAME=none ./install.sh I'm now pretty certain this is not the right path to take. What we are after is a good out of the box experience that can be customized by the user (prompt, dotfiles, etc.). VSCode has 2 ways to do this, features and dotfile support. Some possible routes:
I've got a mild preference for 3, then shipping the result as a python-copier-template devcontainer feature, but then the question will be which prompt to use. I'm also not sure how zsh completion works, and whether bash completion can be made to be as good as it with a bit of configuration... @garryod @callumforrester @gilesknap @GDYendell thoughts? |
Hmm, sorry about this @gilesknap but I think we should drop ZSH. The rest of this template is very opinionated and goes the route of "there is one supported way to do this". Given that supporting ZSH and bash is already causing complexity I think we should only support one and it should be the one that more people are going to use. |
@callumforrester I totally agree. This discussion has made it clear that the only thing we are really getting from common-utils is zsh. |
People who want zsh can always add common-utils via "dev.containers.defaultFeatures" in user settings anyway... |
Will adding common-utils in user settings make the start up as slow as it is currently? I have until very recently favoured the simplicity of bash in devcontainers, but now I am pretty set on zsh having adopted some modern terminal features that are too painful to make work in bash, so I expect I will do that. Or do it manually in my devcontainers dotfile install script, which has no caching. |
Yes, unless you choose a container image that already has zsh and oh-my-zsh in it... You may be better off doing the one-liner installer in your dotfile as that is a little bit faster, but it will still be done on every container launch
Interesting, which features are those? |
I've made a PR to integrate the new bash-config lightweight feature which tries to reproduce the best aspects of having zsh without requiring the expense of See #216 |
The pip install in onCreateCommand is now leading the bottleneck charts maybe 'uv' is our next step? |
I think uv deserves its own issue, also unless we can somehow alias it to pip I think it's a breaking change (so copier template 3.0) |
Use Richard Cunningham's lightweight bash-config feature instead of common utils. The rebuild container overhead for this is approx 10 secs as opposed to 40-60 secs according to #208 (comment) See below for details on what this feature does https://github.com/DiamondLightSource/devcontainer-features/blob/main/.devcontainer/features/bash-config/README.md
See https://github.com/devcontainers/images/tree/main/src/python
Pros:
zsh
so should be a lot quicker to start a new devcontainer (withcommon-utils
feature) - needs testingpipx
Cons:
@callumforrester @garryod thoughts?
The text was updated successfully, but these errors were encountered: