Docker - 在容器内运行watchify不起作用

时间:2016-02-16 17:13:02

标签: docker browserify watchify

我是docker的新手并试图构建我的开发容器。我希望在开发过程中运行 watchify https://www.npmjs.com/package/watchify)来获取concat文件。

Docker可以管理卷。我可以在我的系统上运行 watchify ,但我想把它放在docker host 上。

我设法构建容器和图像。

"scripts": {

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

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

使用“npm run start:dev”运行容器时,它就会退出。

知道为什么会这样吗?我可以在容器上运行watchjs和node app吗?

这是我构建图像/容器的方式:

# 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

这是我的Dockerfile

FROM node:argon
MAINTAINER XXX ZZZ xxx@zzz.com

# 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 个答案:

没有答案