在Docker环境中减少Angular 6中的vendor.js

时间:2019-05-25 11:48:12

标签: angular dockerfile

我在docker上构建了一个Angular 6项目。如何缩小当前50mb中的vendor.js的大小?我们没有在项目中使用Gulp。我还可以使用YUI Compressor吗,如果可以,该如何解决?

以下是dockerfile内容:

FROM node:carbon

VOLUME /usr/src/app
Create app directory
WORKDIR /usr/src/app

Install app dependencies
A wildcard is used to ensure both package.json AND package-lock.json are copied
where available (npm@5+)
COPY package*.json ./

RUN npm cache clean --force
RUN npm i npm@latest -g RUN npx rimraf package-lock.json npm-shrinkwrap.json node_modules RUN npm install @angular/cli --save RUN npm install --save

RUN npm i npm@latest --save
RUN npm audit fix --save RUN npm audit fix --save

If you are building your code for production
RUN npm install --only=production
Bundle app source
COPY . .

MOUNT APP SOURCE
RUN npm i npm -g
EXPOSE 4200 ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/src/app/node_modules/.bin

CMD [ "npm", "start", "--host" ,"0.0.0.0"]
CMD ["sleep","100000000"]
CMD ng serve --poll=10000 --public-host https://localhost --host 0.0.0.0 --port 4200 --base-href=/secure/

0 个答案:

没有答案