Skip to content

Run alpine through a generated Dang entrypoint - #8

Merged
sipsma merged 3 commits into
mainfrom
sipsma/collections-line
Nov 10, 2026
Merged

sipsma merged 3 commits into
mainfrom
sipsma/collections-line

Conversation

@sipsma

@sipsma sipsma commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Loading alpine no longer builds Go. The workspace now generates the module with go-sdk's Dang entrypoint, so the engine reads alpine's types from the generated internal/dagger/entrypoint/main.dang instead of compiling the module and running it. The Go code is built only when a function is called.

Effect: this is part of the work in dagger/dagger#15080, which takes a fresh dagger -W github.com/dagger/dagger@main check -l from 24.9 s to 6.5 s.

Packages unpack only when needed. The second commit makes Container stop downloading and unpacking every package before it returns: packages are stacked lazily and unpack only when the image's files are needed. The resulting root filesystem has the same digest as before for a Wolfi image with Go, clang and protobuf and for an Alpine image with git, and reading only a Wolfi image's configuration takes about 20 s instead of about 25 s. One difference: for Wolfi packages other than wolfi-baselayout, the lib64 move now runs on every package, so /lib's directory metadata comes from the move even when a package has no lib64; file contents and modes are unchanged in the images compared, and only /lib's timestamp can differ.

Needs Dagger v1.0.0-beta.18 or later to load or call the module. The module is now served at the engine's own version instead of engineVersion v0.21.9. Its functions, arguments, defaults and enum values are unchanged. Running this repository's own dagger check needs v1.0.0-beta.22 or later, because dagger/go v0.4.0 does.

  • The module's code uses dagger.io/dagger/core instead of the global client.
  • go.mod moves to go 1.27, the version dagger/dagger's own modules use.
  • dagger/go moves from v0.1.0 to v0.4.0, which runs the Go version go.mod names; v0.1.0 always ran Go 1.26 and refuses a go 1.27 module.
  • The workspace's go-sdk scope sets name explicitly, because the generator otherwise takes the module's name from the checkout's directory.

go-sdk pin: dagger.toml pins go-sdk at d43dbee on main, the merge of dagger/go-sdk#100, which lets go-sdk generate a module on Go 1.27. The module targets v1.0.0-beta.25 by default, which only names the Go library and the entrypoint's Dagger import; the entrypoint still needs v1.0.0-beta.18 or later.

dagger/wolfi's matching PR calls alpine through this branch's commit; it moves to alpine's merged commit once this merges.

The workspace installs go-sdk and generates the module with
dangEntrypoint and unifiedClients. The engine then reads alpine's types
from internal/dagger/entrypoint/main.dang instead of compiling the
module and running it, so loading alpine no longer builds Go. The Go
code is built only when a function is called.

The module code takes core types from dagger.io/dagger/core instead of
the global client. The scope names the module, so the manifest keeps
the name alpine.

go.mod moves to go 1.27, the version dagger/dagger's own modules use.
dagger/go moves to v0.4.0, which runs the Go version go.mod names;
v0.1.0 always ran Go 1.26 and refuses a go 1.27 module. Running this
workspace's own checks with dagger/go v0.4.0 needs Dagger
v1.0.0-beta.22 or later.

go-sdk is pinned to 916c9a9 on its sipsma/collections-line branch.

Loading and calling the module needs Dagger v1.0.0-beta.18 or later,
for the generated entrypoint. Without an engineVersion, the module is
served at the engine's own version instead of v0.21.9.

Signed-off-by: Erik Sipsma <[email protected]>
Container read every unpacked package's entries to check for lib64, and
layered each package onto a container with nothing left to run, which
copies at once. So every call downloaded and unpacked every package
before it returned, even when the caller only read the image's
configuration or never used it.

The lib64 move now applies to every Wolfi package except
wolfi-baselayout, with the same directory operations as before: a step
after the unpack makes sure lib64 exists, unless it is a link, so the
unpack stays the result every image shares. A package without its own
lib64 now gets /lib's directory metadata from the move (mode 0755, owner
root, a new timestamp), and one with neither lib nor lib64 carries an
empty lib; the image's /lib takes that metadata when the package is
layered. File contents and modes are unchanged in the images below, so
only /lib's timestamp can differ. The packages up to busybox are stacked
as a directory and become the root filesystem in one lazy step, and
later packages layer onto the busybox exec, which is still to run. The
image is the same: the root filesystem's digest matches for a Wolfi
image with Go, clang and protobuf, and for an Alpine image. Packages are
still downloaded when Container runs.

Signed-off-by: Erik Sipsma <[email protected]>
sipsma added a commit to dagger/wolfi that referenced this pull request Nov 7, 2026
alpine's client moves to 7103ac9, the head of dagger/alpine#8, where
Container stacks its packages lazily and unpacks them only when the
image's files are needed. alpine's API is unchanged, so only the
generated client's source links change.

Signed-off-by: Erik Sipsma <[email protected]>
go-sdk moves from 916c9a9 on its sipsma/collections-line branch to
d43dbee on main, the merge of dagger/go-sdk#100, which lets go-sdk
generate a module on Go 1.27. Regenerating picks up what go-sdk main
gained since: the module targets v1.0.0-beta.25 by default, so the Go
library and the entrypoint's Dagger import name it; the manifest lists
the files the build reads outside the module (none); and the entrypoint
names its runtime image in a function of its own. The entrypoint still
needs Dagger v1.0.0-beta.18 or later.

Signed-off-by: Erik Sipsma <[email protected]>
@sipsma
sipsma merged commit e746b97 into main Nov 10, 2026
3 of 5 checks passed
sipsma added a commit to dagger/wolfi that referenced this pull request Nov 10, 2026
alpine's dependency moves from 7103ac9, the head of dagger/alpine#8, to
e746b97, its merge into main. alpine's code is the same; only its go-sdk
pin and generated files moved between the two.

Signed-off-by: Erik Sipsma <[email protected]>
sipsma added a commit to dagger/dagger that referenced this pull request Nov 10, 2026
wolfi moves to dagger/wolfi#7's merge and alpine to dagger/alpine#8's,
in the workspace, dagger-dev and the two modules that still pin wolfi
directly. wolfi is now written in Dang, with alpine as an ordinary
dependency, and alpine unpacks packages only when an image's files are
needed. The generated Go clients are regenerated: their APIs are the
same, only their source links and the commits they name change.

Signed-off-by: Erik Sipsma <[email protected]>
@sipsma
sipsma deleted the sipsma/collections-line branch November 10, 2026 20:13
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 this pull request may close these issues.

2 participants