Devsy
Developing in a Workspace

Prebuild a Workspace

A prebuild is an image built ahead of time from devcontainer.json, its features, and any Dockerfile. When a matching prebuild exists, Devsy uses it instead of building.

How it works

Devsy computes a prebuild hash from these inputs:

  • The target architecture.
  • The build-relevant parts of devcontainer.json: name, features, image, Dockerfile, and build settings.
  • The Dockerfile contents.
  • The build context, excluding files matched by .dockerignore.

The image tag is devsy- followed by 32 hex characters. Devsy looks for that tag in each prebuild repository and uses the image it finds.

To build and push a prebuild, run:

devsy workspace build github.com/my-org/my-repo --repository ghcr.io/my-org/my-repo

If the repository already has the matching tag, Devsy skips the build and pushes nothing. Otherwise Devsy builds and pushes the image. Pushing needs write access to the repository. If the push permission check fails, the build fails with cannot push to repository.

Use a prebuild

Pass the repository when you create a workspace:

devsy workspace up github.com/my-org/my-repo --prebuild-repo ghcr.io/my-org/my-repo

You can also set it in devcontainer.json. The value can be a string or an array. Devsy checks every entry for a prebuild and pushes to the first one:

{
  "name": "my-project",
  "customizations": {
    "devsy": {
      "prebuildRepository": "ghcr.io/my-org/my-repo"
    }
  }
}

If a repository lookup fails, including on missing credentials, Devsy tries the next repository. If no repository has a matching image, Devsy builds the image. If Devsy finds an image but cannot inspect it, the build fails.

On this page