Docker - Running watchify inside container does not work

617 views Asked by At

I'm new to docker and trying to build my dev-container. I would like to have running watchify(https://www.npmjs.com/package/watchify) for concat files while Im developing.

Docker can manage volumes. I could have watchify running on my system but I would like to put it on docker host.

I manage to build the container and image.

"scripts": {

    "watchjs": "node_modules/.bin/watchify ./public/js/dependencies.js -o ./public/js/all.js",

    "start:dev": "npm run watchjs & node app.js"
 }

When running the container with "npm run start:dev" it just exits.

Any idea why this is happening? Can I get running the watchjs and node app on the container?

This is how Im building the images/containers:

# Build your image
docker build -t albertof/blog .

# Docker create container
docker create -P --name blog-container -v ~/Projects/Docker/example:/Blog albertof/blog

# Docker start running container
docker start blog-container

And here my Dockerfile

FROM node:argon
MAINTAINER XXX ZZZ [email protected]

# Update libraries and dependencies
# RUN apt-get update -qq

# Install bower
RUN npm install -g bower

# Make folder that contains blog
RUN mkdir -p Blog

# Set up working directory (from now on we are located inside /Blog)
WORKDIR /Blog

# Expose server
EXPOSE 8000

#
#   LEAVE FILES THAT CHANGE OFTEN AT THE END
#   
#   THIS WILL ALLOW DOCKER TO BUILD FASTER
#
#   STEPS WILL BE EXECUTED ALL OVER SINCE THE MOMENT IT FIND DIFFS
#

# Add npm
ADD ./package.json .

# Install dependencies defined in packaje.json
RUN npm install

# Add bower.json
ADD ./bower.json .

# Install bower components
RUN bower install --config.interactive --allow-root

ENTRYPOINT ["npm"]
CMD ["start:dev"]
0

There are 0 answers