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

Improve documentation of dev container image prebuild and update templates #261

Closed
craiglpeters opened this issue Jun 20, 2023 · 2 comments · Fixed by devcontainers/devcontainers.github.io#277
Assignees

Comments

@craiglpeters
Copy link
Member

Many developers want to understand how to enable the reuse of an existing container image each time a session is started, as opposed to rebuilding the container from scratch so that:

  • Create a codified build event for deterministic environment definition
  • Speed environment creation
  • In the Codespaces Prebuilds case, work around the limitation that Codespaces do not follow a fork by

We documentation prebuilding dev container images, but none of our templates illustrate good practices for this, and the documentation is a but buried.

I propose that we create a guide that describes how to decide if you need to prebuild, walk through the mechanics on GitHub with Actions and GHCR, and provides a few good examples.
It would also help if we update the templates where a prebuilt image would help to illustrate the pattern.

@Clockwork-Muse
Copy link

.... prebuilding should probably call out whether the intent is to pre-build the current devcontainer, or a base image for children devcontainers. This is important because often what people want to do (for non-codespaces environments) is pre-build the "current" devcontainer, but there currently isn't a completely supported way to do that, in that;

  • You can build and push an image.
  • You can reference this in a cacheFrom line.
  • You can't reference this in the image tag (although there was a proposal allowing this when also containing a build section, although I can't find it at the moment), although that's probably what people want/anticipate (and attempting to do so requires features to be idempotent, which isn't a guarantee in the wider ecosystem).
  • This ends up meaning you're at the mercy of the caching system, which can break/bust at unexpected moments, especially around feature ordering.
  • Or you need a separate build-vs-use devcontainer.json, which is undersirable.

@meastp
Copy link

meastp commented Aug 17, 2023

I'm kind of struggling with this right now devcontainers/template-starter#26 and pre-building and uploading the (base-)template is the solution, it seems.

More elaborate documentation would be welcome (using devcontainer-ci?), but also ideally an extra github action in the template-starter repo to build and (all) upload the template(s) in the repo...

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 a pull request may close this issue.

4 participants