0

I have environment:

  • Jenkins
  • Docker
  • proxmox with vm and lxc container
  • angular 9 project

Problem is with my Dockerfile building, it takes around 35-40min.

My dockerfile

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}

I'm using proxmox, where I have lxc container and vm, but in both cases the time to build the project is the same. The virtual machine has 12GB RAM and 12 core.

I also tried on my computer which has 32GB of RAM, Ryzen 5, but the build time is also very long, only above sea level and takes over 10 minutes.

My angular project dependencies

"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"
  }

I do not see anything here that would extend the installation of packages and building a project that much. Maybe you have an idea what the problem is?

1 Answer 1

0

I found solution :)

The problem was with the build configuration, I had optimizations turned on everywhere, I changed the configuration in angular.json to "

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,

And now it builds very quickly :)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .