Lavels to compose services
This commit is contained in:
parent
bfb89690d6
commit
f24395f074
|
@ -1,5 +0,0 @@
|
|||
FROM vn-loopback:latest
|
||||
|
||||
COPY . /app
|
||||
WORKDIR /app
|
||||
CMD ["pm2-docker", "./server/server.js"]
|
|
@ -1,12 +1,10 @@
|
|||
version: '2'
|
||||
services:
|
||||
nginx:
|
||||
container_name: "${BRANCH_NAME}-nginx"
|
||||
image: "nginx:${BUILD_NUMBER}"
|
||||
privileged: true
|
||||
build:
|
||||
context: ./services/nginx
|
||||
ports:
|
||||
- "80:80"
|
||||
mem_limit: 200m
|
||||
mem_limit: 200m,
|
||||
links: []
|
||||
|
|
33
gulpfile.js
33
gulpfile.js
|
@ -163,35 +163,44 @@ gulp.task('docker-compose', async () => {
|
|||
|
||||
for (let service of services) {
|
||||
let dockerFile = `Dockerfile`;
|
||||
let containerName = `${namePrefix}${service.name}`;
|
||||
|
||||
let localDockerFile = `${__dirname}/services/${service.name}/Dockerfile`;
|
||||
|
||||
if (await fs.exists(localDockerFile))
|
||||
dockerFile = localDockerFile;
|
||||
|
||||
composeYml.services[service.name] = {
|
||||
container_name: containerName,
|
||||
image: `${service.name}:${imageTag}`,
|
||||
volumes: ['/config:/config'],
|
||||
build: {
|
||||
context: `./services`,
|
||||
dockerfile: dockerFile
|
||||
},
|
||||
ports: [`${service.port}:${defaultPort}`],
|
||||
environment: [
|
||||
'NODE_ENV=${NODE_ENV}',
|
||||
'salixHost=${salixHost}',
|
||||
'salixPort=${salixPort}',
|
||||
'salixUser=${salixUser}',
|
||||
'salixPassword=${salixPassword}'
|
||||
]
|
||||
environment: {
|
||||
NODE_ENV: '${NODE_ENV}',
|
||||
salixHost: '${salixHost}',
|
||||
salixPort: '${salixPort}',
|
||||
salixUser: '${salixUser}',
|
||||
salixPassword: '${salixPassword}'
|
||||
}
|
||||
};
|
||||
|
||||
composeYml.services.nginx.links.push(
|
||||
`${service.name}:${containerName}`
|
||||
`${service.name}:${namePrefix}${service.name}`
|
||||
);
|
||||
}
|
||||
|
||||
for (let serviceName in composeYml.services) {
|
||||
let service = composeYml.services[serviceName];
|
||||
let data = {
|
||||
container_name: `${namePrefix}${serviceName}`,
|
||||
image: `${serviceName}:${imageTag}`,
|
||||
labels: {
|
||||
'salix.tag': imageTag
|
||||
}
|
||||
};
|
||||
Object.assign(service, data);
|
||||
}
|
||||
|
||||
let ymlString = yaml.safeDump(composeYml);
|
||||
await fs.writeFile('./docker-compose.yml', ymlString);
|
||||
});
|
||||
|
|
|
@ -1,3 +1,2 @@
|
|||
datasources.test.json
|
||||
datasources.development.json
|
||||
datasources.*.json
|
||||
db.json
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
"generator-loopback": {}
|
||||
}
|
Loading…
Reference in New Issue