{"id":19039938,"url":"https://github.com/eunomie/dague","last_synced_at":"2025-04-23T21:05:50.717Z","repository":{"id":62867519,"uuid":"562138995","full_name":"eunomie/dague","owner":"eunomie","description":"Opinionated Go toolchain as Docker CLI plugin","archived":false,"fork":false,"pushed_at":"2023-01-09T08:48:53.000Z","size":183,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-23T21:05:44.223Z","etag":null,"topics":["dagger","docker","golang"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eunomie.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-11-05T12:36:29.000Z","updated_at":"2024-04-24T19:46:04.000Z","dependencies_parsed_at":"2023-02-08T09:31:46.720Z","dependency_job_id":null,"html_url":"https://github.com/eunomie/dague","commit_stats":null,"previous_names":[],"tags_count":26,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eunomie%2Fdague","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eunomie%2Fdague/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eunomie%2Fdague/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eunomie%2Fdague/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eunomie","download_url":"https://codeload.github.com/eunomie/dague/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250514781,"owners_count":21443208,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dagger","docker","golang"],"created_at":"2024-11-08T22:19:42.493Z","updated_at":"2025-04-23T21:05:50.682Z","avatar_url":"https://github.com/eunomie.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Dague\n\nBuild Go projects, better. Based on [`dagger`](https://dagger.io).\n\n## Why?\n\n`dague` is a `docker` cli plugin. It acts as a opinionated Go toolchain only relying on Docker as dependency.\n\nYou don't need to have the right version of Go or any other dependencies, if you have Docker you have everything.\n\n## Installation\n\n1. Download the binary corresponding to your platform from the [`latest` release](https://github.com/eunomie/dague/releases/latest).\n\n    binaries are available for linux, mac and windows, for amd64 and arm64\n\n2. Rename the binary to `docker-dague` and make it executable\n\n    ```\n    chmod +x docker-dague\n    ```\n\n3. On Mac, authorize the binary (as not signed):\n\n    ```\n    xattr -d com.apple.quarantine docker-dague\n    ```\n\n4. Copy it to the docker directory for CLI plugins:\n\n    ```\n    mkdir -p ~/.docker/cli-plugins\n    install docker-dague ~/.docker/cli-plugins/ \n    ```\n\n## Usage\n\nConfiguration is made using a `.dague.yml` file. This file is mandatory.\n\n### Build Targets\n\nIf you want to build a binary from `main/path` to `.dist/` this is the minimal file you need:\n\n```yaml\ngo:\n  build:\n    targets:\n      local-build:\n        path: ./main/path\n```\n\nWith that, you can run `docker dague go:build local-build` and it will build your binary and put it under `./dist/`.\n\nThe build is performed inside containers, so you don't have to worry about the needed dependencies, tools, versions, etc.\n\nIf you want to configure the output directory, set the `out` key.\n\n### Default tools\n\nBy default `dague` comes with handy go tools already configured like:\n\n- `go:fmt`: runs `goimports` and a formatter (`gofmt` by default, but configurable) to re-format the code\n- `go:lint`: runs `golangci-lint` and `govulncheck`\n- `go:doc`: generate Go documentation in markdown inside README.me files\n- `go:test`: run go unit tests with handy defaults (`-race -cover -shuffle=on`)\n- `go:mod`: run `go mod tidy` and update `go.mod` and `go.sum` files\n\nSome subcommands exist, you can see them using the `--help` flag.\n\n### Arbitrary Task Inside Container\n\nIt's also possible to define any script that will be run from the inside of the build container.\nThe exec task can also define files to export to the host.\n\n```yaml\ngo:\n  exec:\n    info:\n      cmds: |\n        uname -a \u003e info.txt\n        go version \u003e\u003e info.txt\n      export:\n        pattern: info.txt\n        path: .\n```\n\nThen you can run:\n\n```text\n❯ docker dague go:exec info\n# ...\n\n❯ cat info.txt\nLinux buildkitsandbox 5.15.49-linuxkit #1 SMP PREEMPT Tue Sep 13 07:51:32 UTC 2022 aarch64 Linux\ngo version go1.19.4 linux/arm64\n```\n\nIn comparison, this is the output of `go version` directly on my host:\n\n```text\n❯ go version\ngo version go1.19.4 darwin/arm64\n```\n\n### Arbitrary Tasks on Host\n\nYou can also define any arbitrary task to be run on the host:\n\n```yaml\ntasks:\n  install:\n    deps:\n      - go:build local\n    cmds: |\n      mkdir -p ~/.docker/cli-plugins\n      install dist/docker-dague ~/.docker/cli-plugins/docker-dague\n```\n\nThe command `docker dague task install` will first run `go:build local` then run the shell script to install the binary.\nThe shell script is run using a Go shell implementation so is portable across platforms.\n\n### Base Image Configuration\n\nThe base image for go tools can be configured:\n- the image to use\n- apt or apk packages to install\n- go packages to install\n- mount directories\n- environment variables\n- caches\n\nFor instance, if you want to use `gofumpt` instead of `gofmt`, follow this configuration:\n\n```yaml\ngo:\n  image:\n    goPackages:\n      - mvdan.cc/gofumpt@latest\n\n  fmt:\n    formatter: gofumpt\n```\n\nWith that, `docker dague go:fmt` (or more specifically `docker dague go:fmt:write`) will now use the specified `gofumpt` formatter instead of the default `gofmt`.\n\n```yaml\ngo:\n  image:\n     caches:\n        - target: /cache/go\n     env:\n        GOCACHE: /cache/go\n        GOLANGCI_LINT_CACHE: /cache/go\n```\n\nWith that, a cache will be mounted and two environment variables are set to reflect it.\n\n### Reference\n\nTo know more about the possibilities and available configuration, please refer to [the configuration reference file](./.dague.reference.yml).\n\n\u003c!-- gomarkdoc:embed:start --\u003e\n\n\u003c!-- Code generated by gomarkdoc. DO NOT EDIT --\u003e\n\n# dague\n\n```go\nimport \"github.com/eunomie/dague\"\n```\n\n## Index\n\n- [func ApkInstall(packages ...string) []string](\u003c#func-apkinstall\u003e)\n- [func AptInstall(cont *dagger.Container, packages ...string) *dagger.Container](\u003c#func-aptinstall\u003e)\n- [func Exec(ctx context.Context, src *dagger.Container, args []string) error](\u003c#func-exec\u003e)\n- [func ExportFilePattern(ctx context.Context, cont *dagger.Container, pattern, path string) error](\u003c#func-exportfilepattern\u003e)\n- [func GoInstall(packages ...string) []string](\u003c#func-goinstall\u003e)\n- [func RunInDagger(ctx context.Context, do func(*dagger.Client) error) error](\u003c#func-runindagger\u003e)\n\n\n## func ApkInstall\n\n```go\nfunc ApkInstall(packages ...string) []string\n```\n\nApkInstall runs the apk add command with the specified packaged, to install packages on alpine based systems. Example:\n\n```\nc.Container().From(\"alpine\").WithExec(ApkInstall(\"build-base\"))\n```\n\n## func AptInstall\n\n```go\nfunc AptInstall(cont *dagger.Container, packages ...string) *dagger.Container\n```\n\nAptInstall runs apt\\-get to install the specified packages. It updates first, install, then clean and remove apt\\-get lists. Example:\n\n```\ndague.AptInstall(c.Container().From(\"debian\"), \"gcc\", \"git\")\n```\n\n## func Exec\n\n```go\nfunc Exec(ctx context.Context, src *dagger.Container, args []string) error\n```\n\nExec runs the specified command and check the error and exit code. Example:\n\n```\nerr := dague.Exec(ctx, c.Container().From(\"golang\"), []string{\"go\", \"build\"})\n```\n\n## func ExportFilePattern\n\n```go\nfunc ExportFilePattern(ctx context.Context, cont *dagger.Container, pattern, path string) error\n```\n\n## func GoInstall\n\n```go\nfunc GoInstall(packages ...string) []string\n```\n\nGoInstall installs the specified go packages. Example:\n\n```\nc.Container().From(\"golang\").WithExec(GoInstall(\"golang.org/x/vuln/cmd/govulncheck@latest\"))\n```\n\n## func RunInDagger\n\n```go\nfunc RunInDagger(ctx context.Context, do func(*dagger.Client) error) error\n```\n\nRunInDagger initialize the dagger client and close it. In between it runs the specified function. Example:\n\n```\ndague.RunInDagger(ctx, func(c *dagger.Client) error {\n    c.Container().From(\"alpine\")\n})\n```\n\n\n\nGenerated by [gomarkdoc](\u003chttps://github.com/princjef/gomarkdoc\u003e)\n\n\n\u003c!-- gomarkdoc:embed:end --\u003e","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feunomie%2Fdague","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feunomie%2Fdague","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feunomie%2Fdague/lists"}