0
感谢Docker for Mac,现在可以在Docker容器内运行本地开发服务器。我们只需将本地存储库作为卷装入容器即可。如果我们在本地进行更改,它会自动更新容器(感谢您的体积),我们不必重新启动服务器。如何构建用于生产的卷的码头图像
我们无法弄清的是这些图像应该如何为生产而建造。就拿这个简单的节点服务为例:
FROM node:6
# Install the dependencies outside of the application's volume directory
ADD package.json .npmrc /node/
RUN npm install --prefix /node
# Set up the correct paths for the new node modules installation
ENV NODE_PATH /node/node_modules:$NODE_PATH
ENV PATH $PATH:/node/node_modules/.bin
# Create an endpoint to mount the service's repository
VOLUME /runtime
WORKDIR /runtime
# Expose the application's port
EXPOSE 10010
# Start the server
CMD scripts/start
为了创造我们的生产容器,我们真的很想代替ADD
安装卷的文件。这样我们可以部署图像并简单地运行它。 Docker处理这个问题的正确方法是什么?
可能的重复[当我的开发环境将我的代码库装入容器时,如何构建docker映像?](http://stackoverflow.com/questions/40914696/how-do-i-build-docker-images-当-我的开发环境坐骑 - 我的代码库中) – Matt