Skip to content

Angular CLI Analytics ID causes Docker build to hang #25008

Closed
@KevinDufendach

Description

@KevinDufendach

Command

build

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

Angular 14

Description

I'm trying to build an Angular 15 project in Docker, but with CLI analytics enabled, the build always hangs at the RUN npm run build step and never completes.

Minimal Reproduction

See minimal reproduction here:
https://github.com/KevinDufendach/ng-15-docker-build-issue

This a fresh Angular 15.2.5 "ng new" project with the Dockerfile, .dockerignore, and nginx.conf copied from a working Angular 14 fresh install. Run "ng serve" and allowed usage analytics. Then, to reproduce, run the command:

docker build .

Dockerfile

FROM node:16-alpine as builder

COPY package.json package-lock.json ./
RUN npm set strict-ssl false
RUN npm ci && mkdir /app && mv ./node_modules ./app
WORKDIR /app
COPY . /app/

RUN npm run build # Builds successfully but never moves to next step

This can be fixed by setting the "cli" analytics to "false":

angular.json

"cli": {
  "analytics": false,
},

Fix mentioned here: https://stackoverflow.com/questions/75981611/how-do-i-fix-docker-getting-stuck-at-run-npm-run-build-with-angular-15/75999756#75999756

Exception or Error

No response

Your Environment

Angular CLI: 15.2.5
Node: 18.15.0
Package Manager: npm 9.2.0
OS: win32 x64

Angular: 15.2.6
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1502.5
@angular-devkit/build-angular   15.2.5
@angular-devkit/core            15.2.5
@angular-devkit/schematics      15.2.5
@angular/cli                    15.2.5
@schematics/angular             15.2.5
rxjs                            7.8.0
typescript                      4.9.5

Anything else relevant?

No response

Metadata

Metadata

Assignees

Labels

needs: investigationRequires some digging to determine if action is needed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions