I have created a private dagger module which has all the code related to build, test, etc.
In our UI repo, I added some dagger code to use that the above module.
My code:
export class Dagger {
protected gzp: Gzp // Gzp is the name of exported module/Class
protected source: Directory
protected registry: string
constructor(
registryUser: string,
registryToken: Secret,
githubRunId: string,
@argument({
ignore: [
"**/node_modules",
".dagger",
"**/.next",
"**/dist",
"**/*.log",
"**/.turbo",
"**/*.md",
".github",
".git",
".vscode",
"version.json",
],
})
source: Directory,
) {
this.source = source
this.registry = "hub.docker.com"
this.gzp = dag.gzp(this.source, "ui", registryToken, "yarn", registryUser, {
registry: this.registry,
githubRunId: githubRunId,
})
}
@func()
build(): Promise<string> {
return this.gzp.yarnBuild(".", {
buildCommand: ["yarn", "build:next", "&&", "yarn", "build:server"],
nodeImage: "node:18-alpine"
}).export("build")
}
}
When I run build. It throws the error: Object Gzp not found in the module