Merge branch 'test' into dev

This commit is contained in:
Juan 2018-06-12 17:01:56 +02:00
commit cd94460168
8 changed files with 39 additions and 34 deletions

View File

@ -1,5 +0,0 @@
FROM vn-loopback:latest
COPY . /app
WORKDIR /app
CMD ["pm2-docker", "./server/server.js"]

3
Jenkinsfile vendored
View File

@ -1,6 +1,5 @@
#!/usr/bin/env groovy
// TODO: We are using latest tag until image rotation it's implemented
env.COMPOSER_HTTP_TIMEOUT = 300;
switch (env.BRANCH_NAME) {
@ -34,6 +33,6 @@ node {
stage ('Generating new dockers') {
sh "docker build -t vn-loopback:latest ./services/loopback/"
sh "docker-compose up -d --build"
sh "docker image prune --all"
sh "docker image prune -f"
}
}

View File

@ -1,12 +1,10 @@
version: '2'
version: '3.5'
services:
nginx:
container_name: "${BRANCH_NAME}-nginx"
image: "nginx:${BUILD_NUMBER}"
privileged: true
build:
context: ./services/nginx
ports:
- "80:80"
mem_limit: 200m
- 80:80
- 443:443
links: []

View File

@ -163,35 +163,43 @@ 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];
Object.assign(service, {
container_name: `${namePrefix}${serviceName}`,
image: `${serviceName}:${imageTag}`,
volumes: ['/config:/config']
});
service.build.labels = {
'salix.tag': imageTag
};
}
let ymlString = yaml.safeDump(composeYml);
await fs.writeFile('./docker-compose.yml', ymlString);
});

3
services/.gitignore vendored
View File

@ -1,3 +1,2 @@
datasources.test.json
datasources.development.json
datasources.*.json
db.json

View File

@ -1,3 +0,0 @@
{
"generator-loopback": {}
}

View File

@ -1,4 +1,4 @@
FROM node:8.9.4
FROM node:8-slim
COPY . /loopback
RUN npm -g install pm2

View File

@ -13,9 +13,18 @@ http {
include /etc/nginx/mime.types;
server {
listen {{port}};
server_name {{host}};
autoindex off;
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
ssl_certificate /config/nginx/cert.pem;
ssl_certificate_key /config/nginx/key.pem;
server_name {{host}};
autoindex off;
root /usr/share/nginx/html;