docker-compose icon indicating copy to clipboard operation
docker-compose copied to clipboard

TypeScript bindings to docker-compose schema

Open tpluscode opened this issue 1 year ago • 1 comments

Do you know of any TS interface for docker compose YAML?

Also, maybe it would be an interesting feature to run a compose from it service description in a JS object?

import { up, DockerCompose } from 'docker-compose'

const compose: DockerCompose = {
  name: 'my-stack',
  services: {
    service1: { /* .. */ },
    service2: { /* .. */ }
  }
}

upAll({ 
  cwd: path.join(__dirname),
  compose,
})

Passing compose would write its contents as YAML to ${cwd}/docker-compose.yaml and proceed as usual.

tpluscode avatar Mar 12 '25 13:03 tpluscode

I started this almost 10 years ago but I've barely used, let maintained it: https://github.com/PDMLab/composefile

AlexZeitler avatar Mar 12 '25 15:03 AlexZeitler