docker DB local

This commit is contained in:
vicentefalco 2017-10-18 18:26:40 +02:00
parent 09a24fe8e8
commit d07f65893d
2 changed files with 12 additions and 8 deletions

View File

@ -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();
});
});

View File

@ -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",