From d07f65893da499c5e382044d96a04a091ccfc8ac Mon Sep 17 00:00:00 2001 From: vicentefalco Date: Wed, 18 Oct 2017 18:26:40 +0200 Subject: [PATCH] docker DB local --- gulpfile.js | 19 +++++++++++-------- package.json | 1 + 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 221d4ca9b..58ddd90cb 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -6,6 +6,7 @@ var merge = require('merge-stream'); var extend = require('gulp-extend'); var install = require('gulp-install'); var print = require('gulp-print'); +var runSequence = require('run-sequence'); var del = require('del'); var fs = require('fs'); var webpack = require('webpack'); @@ -151,23 +152,25 @@ gulp.task('watch', function() { gulp.watch(localeFiles, ['locales']); }); -gulp.task('test', ['deleteDockerDb', 'buildDockerDb'], (callback) => { - exec('docker run -d --name dbLocal -p 3306:3306 dblocal:latest', (err, stdout, stderr) => { - if (err) { - throw new Error(err); - } +gulp.task('test', () => { + process.env.NODE_ENV = gutil.env.env || 'test'; + console.log(process.env.NODE_ENV); + runSequence('deleteDockerDb', 'buildDockerDb', 'runDockerDb'); +}); + +gulp.task('runDockerDb', (callback) => { + exec('docker run -d --name dblocal -p 3306:3306 dblocal:latest', (err, stdout, stderr) => { callback(err); }); }); + gulp.task('buildDockerDb', (callback) => { exec('docker build -t dblocal:latest ./services/db', (err, stdout, stderr) => { - if (err) - throw new Error(err); callback(err); }); }); gulp.task('deleteDockerDb', (callback) => { - exec('docker rm -f dbLocal', () => { + exec('docker rm -f dblocal', (err, stdout, stderr) => { callback(); }); }); diff --git a/package.json b/package.json index e3cfad2c2..517f86530 100644 --- a/package.json +++ b/package.json @@ -60,6 +60,7 @@ "node-sass": "^3.11.0", "nodemon": "^1.12.0", "raw-loader": "*", + "run-sequence": "^2.2.0", "sass-loader": "^4.0.2", "style-loader": "^0.13.1", "webpack": "^2.2.0",