-
Notifications
You must be signed in to change notification settings - Fork 47
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
created build-dev dagger function for enhance developer workflow #169
Conversation
Signed-off-by: ALTHAF <[email protected]>
main.go
Outdated
// Return a container that build the Harbor binary for development purposes. | ||
func (m *HarborCli) BuildDev(ctx context.Context, directoryArg *dagger.Directory) *dagger.Container { | ||
fmt.Println("🛠️ Building Harbor binary with Dagger...") | ||
|
||
// Define the path for the binary output | ||
binaryOutputPath := "/src/bin/harbor" | ||
return dag.Container(). | ||
From("golang:latest"). | ||
WithMountedDirectory("/src", directoryArg). | ||
WithWorkdir("/src/cmd/harbor"). | ||
WithExec([]string{"go", "build", "-o", binaryOutputPath, "main.go"}). | ||
WithWorkdir("/src") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Althaf66 Additionally, build-dev should actually be able to build harbor based on their system. So devs on windows and Linux can use it. |
Signed-off-by: ALTHAF <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Run your code with go fmt ./...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update the README with the command to build the binary using harbor.
cmd: dagger call build-dev --source=. --goos=$(go env GOOS) --goarch=$(go env GOARCH) export --path=bin
Dagger call does not support Host access & Host environment.
Signed-off-by: ALTHAF <[email protected]>
Signed-off-by: ALTHAF <[email protected]>
closing if favor #219 |
This fixes #163
Added build-dev dagger function to build the Harbor binary for development purposes.
Updated existing Dagger functions with descriptions.