docker dbLocal

This commit is contained in:
vicentefalco 2017-10-18 06:41:17 +02:00
parent 85ec628ae6
commit a0955cf50d
2 changed files with 25 additions and 2 deletions

View File

@ -11,6 +11,8 @@ var fs = require('fs');
var webpack = require('webpack');
var WebpackDevServer = require('webpack-dev-server');
var exec = require('child_process').exec;
// Configuration
var srcDir = './client';
@ -148,3 +150,24 @@ gulp.task('watch', function() {
gulp.watch(routeFiles, ['routes']);
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);
}
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', () => {
callback();
});
});

View File

@ -1,12 +1,12 @@
FROM mysql:5.6.37
MAINTAINER Vicente Falco
ENV MYSQL_ALLOW_EMPTY_PASSWORD yes
COPY localDB01Structure.sql /docker-entrypoint-initdb.d
COPY localDB02Inserts.sql /docker-entrypoint-initdb.d
RUN chmod -R 755 /docker-entrypoint-initdb.d
CMD ["mysqld"]
EXPOSE 3306