1
0
mirror of https://github.com/yldio/copilot.git synced 2024-11-14 23:30:05 +02:00

build: stop and remove container before up-ing

This commit is contained in:
Sérgio Ramos 2017-05-31 23:55:41 +01:00
parent 3ffc3b9d1d
commit 5a3294b32c

View File

@ -12,6 +12,7 @@ const flatten = require('lodash.flatten');
const readPkg = require('read-pkg'); const readPkg = require('read-pkg');
const figures = require('figures'); const figures = require('figures');
const COMPOSE_PROJECT_NAME = `${name}-${process.env.CIRCLE_BRANCH}`;
const NAMESPACE = 'quay.io/yldio'; const NAMESPACE = 'quay.io/yldio';
const ROOT = path.join(__dirname, '..'); const ROOT = path.join(__dirname, '..');
const LOG = console.log; const LOG = console.log;
@ -128,10 +129,25 @@ const deploy = async () => {
const env = await getEnv(); const env = await getEnv();
LOG(`${figures.arrowRight} deploy`); LOG(`${figures.arrowRight} deploy`);
await execa('docker-compose', ['kill'], {
stdio: 'inherit',
env: Object.assign({}, env, {
COMPOSE_PROJECT_NAME
})
});
await execa('docker-compose', ['rm'], {
stdio: 'inherit',
env: Object.assign({}, env, {
COMPOSE_PROJECT_NAME
})
});
return execa('docker-compose', ['up', '-d', '--build', '--force-recreate'], { return execa('docker-compose', ['up', '-d', '--build', '--force-recreate'], {
stdio: 'inherit', stdio: 'inherit',
env: Object.assign({}, env, { env: Object.assign({}, env, {
COMPOSE_PROJECT_NAME: `${name}-${env.CIRCLE_BRANCH}` COMPOSE_PROJECT_NAME
}) })
}); });
}; };