@iobroker/create-adapter
Version:
Command line utility to create customized ioBroker adapters
75 lines • 2.36 kB
JavaScript
;
const templateFunction = answers => {
const devcontainer = answers.tools && answers.tools.includes("devcontainer");
if (!devcontainer) {
return;
}
const adapterNameLowerCase = answers.adapterName.toLowerCase();
const needsParcel = answers.adminUi === "react" || answers.tabReact === "yes";
const template = `
services:
iobroker:
build: ./iobroker
container_name: iobroker-${adapterNameLowerCase}
hostname: iobroker-${adapterNameLowerCase}
# This port is only internal, so we can work on this while another instance of ioBroker is running on the host
expose:
- 8081
volumes:
- ..:/workspace:cached
environment:
# using non-default ports to not interfere with integration tests
- IOB_OBJECTSDB_TYPE=jsonl
- IOB_OBJECTSDB_HOST=127.0.0.1
- IOB_OBJECTSDB_PORT=29001
- IOB_STATESDB_TYPE=jsonl
- IOB_STATESDB_HOST=127.0.0.1
- IOB_STATESDB_PORT=29000
- LANG=en_US.UTF-8
- LANGUAGE=en_US:en
- LC_ALL=en_US.UTF-8
- TZ=Europe/Berlin
- SETGID=1000
${needsParcel
? `
parcel:
container_name: parcel-${adapterNameLowerCase}
build: ./parcel
expose:
- 1234
ports:
- '1235:1235'
volumes:
- ..:/workspace:cached
environment:
- CHOKIDAR_USEPOLLING=1
`
: ""}
# Reverse proxy to load up-to-date admin sources from the repo
nginx:
image: nginx:latest
depends_on:
- iobroker
${needsParcel
? ` - parcel
`
: ""} links:
- iobroker
${needsParcel
? ` - parcel
`
: ""} container_name: nginx-${adapterNameLowerCase}
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf
- ..:/workspace:cached
ports:
# Port will be forwarded in the devcontainer
- 80
`;
return template.trim();
};
templateFunction.customPath = ".devcontainer/docker-compose.yml";
// Reformatting this would create mixed tabs and spaces
templateFunction.noReformat = true;
module.exports = templateFunction;
//# sourceMappingURL=docker-compose.yml.js.map