Looking to create a basic docker compose setup and integrate it into an existing file. The yaml parser found here seems promising, but I'm struggling with the question mark that appears in its output.
This is the content of my current docker compose template:
version: "3.9"
name: "org"
services:
memory:
image: redis/redis-stack:7.2.0-v7
# ...
networks:
default:
name: org
external: true
I am attempting to introduce a new service into this template:
import { readFile, writeFile } from 'node:fs/promises'
import { parseDocument } from 'yaml'
const doc = parseDocument(await readFile('./docker-compose.yml', 'utf8'))
doc.addIn(['services'], {
'my-service': {
'image': '${CONTAINER_CONN_STR}:${APP_VERSION:-latest}',
'ports': ['${GDEVOPS_APP_PORT}:${APP_PORT}']
}
})
await writeFile('./sample.yml', String(doc))
The resulting sample.yaml file looks like this:
version: "3.9"
name: "org"
services:
memory:
image: redis/redis-stack:7.2.0-v7
# ...
? my-service:
image: ${CONTAINER_CONN_STR}:${APP_VERSION:-latest}
ports:
- ${GDEVOPS_APP_PORT}:${APP_PORT}
networks:
default:
name: org
external: true
How can I remove the question mark prefix from my service?