[英]Docker with Angular - Docker Builds Large Image File
I created a new project using Angular CLI
and tried to set the project up with Docker. 我使用Angular CLI
创建了一个新项目,并尝试使用Docker设置该项目。
After successfully building the image using docker build
, it seems that the image size isn't normal having 1.33GB
. 使用docker build
成功构建映像后,拥有1.33GB
的映像大小似乎不正常。
Also tried to ssh
onto my container and it shows 499M
还尝试将ssh
放到我的容器上,它显示499M
Here's my Docker
file: 这是我的Docker
文件:
FROM node:9.5.0
ENV HOME=/usr/src/app
RUN mkdir -p $HOME
WORKDIR $HOME
COPY ./package.json $HOME
RUN npm install --quiet
COPY . $HOME
EXPOSE 80
CMD ["npm", "start"]
Is there a way to reduce the image size? 有没有办法减小图像尺寸?
Why do I need to reduce the image size? 为什么需要缩小图像尺寸?
No particular reason. 没有特别的理由。 The size just doesn't seem normal for such a small project 对于这么小的项目,大小似乎并不正常
Using alpine
version of node
decreases the size significantly. 使用node
alpine
版本会显着减小大小。
Dockerfile
: FROM node:9.5.0-alpine
Dockerfile
: FROM node:9.5.0-alpine
Size reduced from 1.33GB
down to 720MB
大小从1.33GB
减少到720MB
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.