From 5a3294b32c4b98c0a1a3bf11679ef2236c179280 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Se=CC=81rgio=20Ramos?= Date: Wed, 31 May 2017 23:55:41 +0100 Subject: [PATCH] build: stop and remove container before up-ing --- scripts/deploy | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/scripts/deploy b/scripts/deploy index 9ba73c6a..37ea9bf1 100755 --- a/scripts/deploy +++ b/scripts/deploy @@ -12,6 +12,7 @@ const flatten = require('lodash.flatten'); const readPkg = require('read-pkg'); const figures = require('figures'); +const COMPOSE_PROJECT_NAME = `${name}-${process.env.CIRCLE_BRANCH}`; const NAMESPACE = 'quay.io/yldio'; const ROOT = path.join(__dirname, '..'); const LOG = console.log; @@ -128,10 +129,25 @@ const deploy = async () => { const env = await getEnv(); 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'], { stdio: 'inherit', env: Object.assign({}, env, { - COMPOSE_PROJECT_NAME: `${name}-${env.CIRCLE_BRANCH}` + COMPOSE_PROJECT_NAME }) }); };