项目的Docker镜像具有独立的客户端和服务器端代码库

我有2个独立的代码库的客户端和服务器,我想创build一个单一的Docker镜像,并应该成功运行localhost.Here是我的Dockerfile代码:

FROM debian:jessie # Replace shell with bash so we can source files RUN rm /bin/sh && ln -s /bin/bash /bin/sh # Set environment variables ENV appDir /var/www/app/current # Run updates and install deps RUN apt-get update RUN apt-get install -y -q --no-install-recommends \ apt-transport-https \ build-essential \ ca-certificates \ curl \ g++ \ gcc \ git \ make \ nginx \ sudo \ wget \ && rm -rf /var/lib/apt/lists/* \ && apt-get -y autoclean ENV NVM_DIR /usr/local/nvm ENV NODE_VERSION 7.10.0 # Install nvm with node and npm RUN curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.29.0/install.sh | bash \ && source $NVM_DIR/nvm.sh \ && nvm install $NODE_VERSION \ && nvm alias default $NODE_VERSION \ && nvm use default # Set up our PATH correctly so we don't have to long-reference npm, node, &c. ENV NODE_PATH $NVM_DIR/versions/node/v$NODE_VERSION/lib/node_modules ENV PATH $NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH # Set the work directory RUN mkdir -p /var/www/app/current WORKDIR ${appDir} # Add our package.json and install *before* adding our application files ADD package.json ./ RUN npm i # Install pm2 so we can run our application RUN npm i -g pm2 # Add application files ADD . /var/www/app/current RUN npm install rsync -g RUN npm install webpack -g RUN npm install webpack-dev-server -g RUN webpack-dev-server --config ./webpack.config.dev.js #Expose the port EXPOSE 8080 CMD ["pm2", "start", "processes.json", "--no-daemon"] 

当我构buildDocker Image并运行它时,Docker容器立即退出。

任何人都可以告诉我正确的方式和Docker的代码?