I created a docker container to run tasks with gulp. All tasks are running, the problem is I can't enable livrereload in Chrome although I exposed the 35729 port in my container.
Here is the Dockerfile :
FROM ubuntu:latest
MAINTAINER jiboulex
EXPOSE 80 8080 3000 35729
RUN apt-get update
RUN apt-get install curl -y
RUN apt-get install software-properties-common -y
RUN add-apt-repository ppa:chris-lea/node.js
RUN apt-get update
RUN apt-get install nodejs -y
RUN curl -L https://www.npmjs.com/install.sh | sh
RUN npm install --global gulp -y
# overwrite this with 'CMD []' in a dependent Dockerfile
CMD ["/bin/bash"]
I create the image with the following command :
docker build -t gulp_image .
I create a container :
docker run --name=gulp_container -i -t --rm -v /var/www/my_app:/var/www/my_app:rw gulp_image bash
then in my container
cd /var/www/my_app
gulp
Here is my Gulpfile.js
var gulp = require('gulp'),
livereload = require('gulp-livereload'),
exec = require('child_process').exec;
gulp.task('js', function() {
gulp.src([
'./src/js/*.js'
]).pipe(livereload());
});
gulp.task('watch', function(){
var onChange = function (event) {
console.log('File '+event.path+' has been '+event.type);
};
livereload.listen();
gulp.watch([
'./src/js/*.js'
], ['js'])
.on('change', onChange);
});
gulp.task('default', ['watch', 'js']);
When I edit a js file, I can see in my container that the files are processed but when I try to enable live reload in my browser (Chrome), I got the following message : "Could not connect to LiveReload server.."
Anyone got a clue about what I missed or didn't do ? Thanks for reading !