我有环境:
问题是我的Dockerfile大楼,大约需要35-40分钟。
我的文件
FROM node:12.6-stretch
ARG ABSOLUTE_PATH=./app
ARG build_command="node --max_old_space_size=5120 node_modules/@angular/cli/bin/ng build"
COPY $ABSOLUTE_PATH/package.json /app/package.json
COPY $ABSOLUTE_PATH/.npmrc /app/.npmrc
WORKDIR /app
RUN npm i
RUN node node_modules/@angular/cli/bin/ng version
COPY $ABSOLUTE_PATH/. ./
RUN npm run build-dependency
RUN npm run ${build_command}我正在使用proxmox,其中我有lxc容器和vm,但在这两种情况下,构建项目的时间是相同的。虚拟机有12 12内存和12核。
我也尝试了我的电脑,它有32 of的RAM,Ryzen 5,但构建时间也很长,仅高于海平面,需要超过10分钟。
我的角度项目依赖关系
"dependencies": {
"@angular/animations": "10.1.4",
"@angular/cdk": "10.2.3",
"@angular/common": "10.1.4",
"@angular/compiler": "10.1.4",
"@angular/core": "10.1.4",
"@angular/forms": "10.1.4",
"@angular/http": "7.2.16",
"@angular/material": "10.2.3",
"@angular/material-moment-adapter": "10.2.3",
"@angular/platform-browser": "10.1.4",
"@angular/platform-browser-dynamic": "10.1.4",
"@angular/router": "10.1.4",
"@angular/service-worker": "10.1.4",
"@ngrx/effects": "10.0.0",
"@ngrx/store": "10.0.0",
"@ngrx/store-devtools": "10.0.0",
"@turf/turf": "5.1.6",
"@types/jszip": "3.4.1",
"@types/jwt-decode": "2.2.1",
"@types/lodash": "4.14.159",
"angular-oauth2-oidc": "9.2.2",
"angular-oauth2-oidc-jwks": "9.0.0",
"angular-resize-event": "1.2.2",
"apexcharts": "3.20.0",
"axios": "0.19.2",
"bootstrap": "4.1.3",
"core-js": "3.6.5",
"highlight.js": "9.18.3",
"jszip": "3.5.0",
"jwt-decode": "^2.2.0",
"lodash": "4.17.20",
"material-design-icons": "^3.0.1",
"mathjs": "9.2.0",
"moment": "2.27.0",
"ng-apexcharts": "1.5.1",
"ngx-image-cropper": "1.5.1",
"ngx-quill": "12.0.1",
"normalizr": "^3.6.0",
"ol": "5.3.3",
"proj4": "2.6.2",
"quill": "1.3.7",
"rxjs": "6.6.3",
"tslib": "2.0.1",
"tui-calendar": "1.12.13",
"zone.js": "0.10.3"
},
"devDependencies": {
"@angular-devkit/build-angular": "0.1001.4",
"@angular-devkit/build-ng-packagr": "0.1001.4",
"@angular/cli": "10.1.4",
"@angular/compiler-cli": "10.1.4",
"@angular/language-service": "10.1.4",
"@types/jasmine": "^3.3.16",
"@types/jasminewd2": "^2.0.8",
"@types/node": "^12.12.54",
"codelyzer": "^6.0.0",
"jasmine-core": "~3.5.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~5.0.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage-istanbul-reporter": "~3.0.2",
"karma-jasmine": "~3.3.0",
"karma-jasmine-html-reporter": "^1.5.0",
"ng-packagr": "^10.0.0",
"node-sass": "^4.14.1",
"protractor": "~7.0.0",
"ts-node": "8.3.0",
"tslint": "6.1.3",
"typescript": "3.9.7"
}在这里,我没有看到任何东西会扩展软件包的安装和构建一个项目。也许你知道问题出在哪里?
发布于 2022-10-07 06:25:17
我找到了解决办法:)
问题在于构建配置,我在任何地方都打开了优化,将angular.json中的配置更改为“
optimization": false,
"outputHashing": "none",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"showCircularDependencies": false,
"aot": true,
"statsJson": false,
"progress": false,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": false,
"serviceWorker": true,现在它构建得非常快:)
https://serverfault.com/questions/1112357
复制相似问题