{"id":24549398,"url":"https://github.com/compose-spec/compose-go","last_synced_at":"2025-05-13T17:14:30.552Z","repository":{"id":36973342,"uuid":"227346582","full_name":"compose-spec/compose-go","owner":"compose-spec","description":"Reference library for parsing and loading Compose YAML files","archived":false,"fork":false,"pushed_at":"2025-05-12T08:02:01.000Z","size":3842,"stargazers_count":381,"open_issues_count":18,"forks_count":124,"subscribers_count":12,"default_branch":"main","last_synced_at":"2025-05-12T09:31:28.006Z","etag":null,"topics":["compose","compose-spec","containers","docker","docker-compose"],"latest_commit_sha":null,"homepage":"https://compose-spec.io","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/compose-spec.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-12-11T11:10:30.000Z","updated_at":"2025-05-12T08:02:05.000Z","dependencies_parsed_at":"2023-10-02T07:45:03.657Z","dependency_job_id":"44f61963-0119-4b3f-b7b4-fd6490d97d71","html_url":"https://github.com/compose-spec/compose-go","commit_stats":null,"previous_names":[],"tags_count":92,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/compose-spec%2Fcompose-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/compose-spec%2Fcompose-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/compose-spec%2Fcompose-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/compose-spec%2Fcompose-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/compose-spec","download_url":"https://codeload.github.com/compose-spec/compose-go/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253990500,"owners_count":21995776,"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":["compose","compose-spec","containers","docker","docker-compose"],"created_at":"2025-01-23T00:15:29.240Z","updated_at":"2025-05-13T17:14:25.538Z","avatar_url":"https://github.com/compose-spec.png","language":"Go","readme":"# compose-go\n[![Continuous integration](https://github.com/compose-spec/compose-go/actions/workflows/ci.yml/badge.svg)](https://github.com/compose-spec/compose-go/actions/workflows/ci.yml)\n[![Go Reference](https://pkg.go.dev/badge/github.com/compose-spec/compose-go.svg)](https://pkg.go.dev/github.com/compose-spec/compose-go)\n\nGo reference library for parsing and loading Compose files as specified by the\n[Compose specification](https://github.com/compose-spec/compose-spec).\n\n## Usage\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"log\"\n\n\t\"github.com/compose-spec/compose-go/v2/cli\"\n)\n\nfunc main() {\n\tcomposeFilePath := \"docker-compose.yml\"\n\tprojectName := \"my_project\"\n\tctx := context.Background()\n\n\toptions, err := cli.NewProjectOptions(\n\t\t[]string{composeFilePath},\n\t\tcli.WithOsEnv,\n\t\tcli.WithDotEnv,\n\t\tcli.WithName(projectName),\n\t)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tproject, err := options.LoadProject(ctx)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t// Use the MarshalYAML method to get YAML representation\n\tprojectYAML, err := project.MarshalYAML()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tfmt.Println(string(projectYAML))\n}\n```\n\n## Build the library\n\nTo build the library, you could either use the makefile\n```bash\nmake build\n```\nor use the go build command\n```bash\ngo build ./...\n```\n\n## Run the tests\nYou can run the tests with the makefile\n```bash\nmake test\n```\nor with the go test command\n```bash\ngotestsum ./...\n```\n\n## Other helpful make commands\nRun the linter\n```bash\nmake lint\n```\n\nCheck the license headers\n```bash\nmake check_license\n```\n\nCheck the `compose-spec.json` file is sync with the `compose-spec` repository\n```bash\nmake check_compose_spec\n```\n\n## Used by\n\n* [compose](https://github.com/docker/compose)\n* [containerd/nerdctl](https://github.com/containerd/nerdctl)\n* [compose-cli](https://github.com/docker/compose-cli)\n* [tilt.dev](https://github.com/tilt-dev/tilt)\n* [kompose](https://github.com/kubernetes/kompose)\n* [kurtosis](https://github.com/kurtosis-tech/kurtosis/)\n* [testcontainers-go's Compose module](https://github.com/testcontainers/testcontainers-go/tree/main/modules/compose)\n* [compose2nix](https://github.com/aksiksi/compose2nix)\n* [Defang](https://github.com/DefangLabs/defang)\n* [score-compose](https://github.com/score-spec/score-compose)\n* [CasaOS](https://github.com/IceWhaleTech/CasaOS)\n","funding_links":[],"categories":["Go"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcompose-spec%2Fcompose-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcompose-spec%2Fcompose-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcompose-spec%2Fcompose-go/lists"}