Howdy, I'm fairly new to dagger, thanks in advance for your attention!
As the title indicates the startup time for my codebase is taking way too long; there are a number of large directories being synced (see below for backup). I've been poring over the docs and github issues to understand how I can speed this up, and I've seen posts indicating that .dockerignore should be effective at preventing large folders from being considered in a sync operation. I've also seen that dagger.json keys for include and exclude should be effective. As I'll show below I've added references to those large folders (the usual suspects, .git, .venv, node_modules) in dockerignore and exclude; however, the filesync logs still prominently show those folders:
dagger.json
{
"name": "core-platform",
"engineVersion": "v0.20.3",
"sdk": {
"source": "python"
},
"source": "dagger",
"include": [
"backend",
"frontend",
"<redacted>",
"<also_redacted>",
],
"exclude": [
".DS_Store",
".claude",
".git",
".venv",
"bin",
"**/.venv",
"**/.git",
"**/node_modules"
]
}
.dockerignore
.venv/
.git
...
console output from dagger function
▼ ✔ parsing command line arguments 2m56s
├╴● $ address(value: "."): Address! 0.0s CACHED
╰╴▼ ✔ .directory: Directory! 2m56s
╰╴▼ ✔ Host.directory(path: "."): Directory! 2m56s
╰╴▼ ✔ filesync 2m56s
├╴● ✔ .DS_Store 0.0s ◆ Written Bytes: 6.1 kB
├╴● ✔ .claude 0.0s ◆ Written Bytes: 14 kB <-- present in `exclude`
├╴● ✔ .dockerignore 0.0s ◆ Written Bytes: 754 B
├╴● ✔ .env.raw 0.0s ◆ Written Bytes: 2.1 kB
├╴● ✔ .git 8.6s ◆ Written Bytes: 680 MB <-- present in `exclude`
├╴● ✔ .gitignore 0.2s ◆ Written Bytes: 1.1 kB
├╴● ✔ .netrc 0.2s ◆ Written Bytes: 107 B <-- present in `.dockerignore`
├╴● ✔ .venv 5.2s ◆ Written Bytes: 5 B <-- present in `exclude`
├╴● ✔ .vscode 0.0s ◆ Written Bytes: 1.8 kB
├╴● ✔ <redacted> 5.8s ◆ Written Bytes: 20 kB
├╴● ✔ backend 40.5s ◆ Written Bytes: 3.4 MB
├╴● ✔ bin 36.3s ◆ Written Bytes: 62 MB <-- present in `exclude`
├╴● ✔ compose.override.yaml 35.3s ◆ Written Bytes: 110 B
├╴● ✔ dagger 38.7s ◆ Written Bytes: 29 kB
├╴● ✔ dagger-develop.log 38.6s ◆ Written Bytes: 5.1 MB
├╴● ✔ docker-compose.yml 38.4s ◆ Written Bytes: 159 B
├╴● ✔ dagger-develop.log.orig 38.8s ◆ Written Bytes: 15 MB
├╴● ✔ docs 55.4s ◆ Written Bytes: 220 kB
├╴● ✔ frontend 2m5s ◆ Written Bytes: 551 kB
├╴● ✔ justfile 1m58s ◆ Written Bytes: 20 kB
├╴● ✔ mise.toml 1m58s ◆ Written Bytes: 279 B
├╴● ✔ pyproject.toml 1m58s ◆ Written Bytes: 351 B
├╴● ✔ scripts 1m58s ◆ Written Bytes: 13 kB
├╴● ✔ <also_redacted> 1m58s ◆ Written Bytes: 37 B
├╴● ✔ uv.lock 1m58s ◆ Written Bytes: 173 kB
╰╴● ✔ copy 32.6s
I'm running on a fairly recent mac M3 with plenty of headroom on processor, memory, and disk.
Questions:
- Is
dagger.jsonexclude(or `.dockerignore) still the right way to do this? - Do I need to do something for
dagger.jsonto be read into dagger? - What am I missing here?
- Assuming there is no actual, effective way to exclude these files from the context, why does copying less than 1G of data take nearly 3 minutes (accepting that I'm not copying to a USB 2.0 flash drive)?
- Are these files not cached somewhere? (I've re-run the command many times without altering them (aside from maybe adding something to
dagger.json) and it consistently takes longer than 2m30s)