[英]Docker config angular project
Sorry for my english. 对不起我的英语不好。 I new docker and for me now it not easy.
我是新的码头工人,对我来说现在不容易。 I want configurate this project:
我要配置这个项目:
Then i added two files 然后我添加了两个文件
my docker-compose 我的码头工人组成
web:
build: .
ports:
- '49153:49153'
volumes:
- .:/usr/src/app/
environment:
- NODE_ENV=dev
command: bash -c "npm start"
Dockerfile Dockerfile
FROM node:8.6 as node
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY package.json /usr/src/app
RUN npm install
RUN npm install -g angular-cli
COPY . /usr/src/app
EXPOSE 49153
CMD [ "npm", "start" ]
Then i run like this: 然后我像这样运行:
docker-compose build
and 和
docker-compose up
My question: haw i correct write settings to Docker? 我的问题:我如何正确写入Docker设置? In console when i do
docker-compose build
message 在控制台中执行
docker-compose build
消息时
gyp verb tmpdir == cwd automatically will remove dev files after to save disk space
gyp verb command install [ '8.6.0' ]
gyp verb install input version string "8.6.0"
gyp verb install installing version: 8.6.0
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version not already installed, continuing with install 8.6.0
gyp verb ensuring nodedir is created /usr/local/lib/node_modules/angular-cli/node_modules/node-sass/.node-gyp/8.6.0
gyp WARN EACCES user "nobody" does not have permission to access the dev dir "/usr/local/lib/node_modules/angular-cli/node_modules/node-sass/.node-gyp/8.6.0"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/angular-cli/node_modules/node-sass/.node-gyp"
Before getting on to answer your question: 在继续回答您的问题之前:
Add a .dockerignore file and add the below line in it - 添加.dockerignore文件,并在其中添加以下行-
node_modules node_modules
npm-debug.log NPM-的debug.log
This will prevent your local modules and debug logs from being copied onto your Docker image and possibly overwriting modules installed within your image. 这样可以防止将本地模块和调试日志复制到Docker映像中,并可能覆盖映像中安装的模块。
I see you trying to use multi-stage build in your Dockerfile with just one stage in it. 我看到您尝试在Dockerfile中使用仅包含一个阶段的多阶段构建 。 The below is screenshot of my Dockerfile for the angular quickstart sample
以下是我的Dockerfile的角度快速入门示例的屏幕截图
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.