trion-development / docker-ng-cli Goto Github PK
View Code? Open in Web Editor NEWDocker image for Angular CLI
Home Page: https://www.trion.de/
License: MIT License
Docker image for Angular CLI
Home Page: https://www.trion.de/
License: MIT License
Hi.
I like using this image for my local development and CI pipelines!
I would like to have aggregated tags in Docker Hub, so images may be referenced using only major or minor version parts.
Example: tag 11 should refer to most modern version of 11.x, and tag 10.0 should refer to most modern version of 10.0.x.
Many other project use this schema.
Thanks.
The readme says
Currently this image uses node 9 (npm 5) and Debian stretch as base distribution.
But it's based on node:lts-slim which is node 12. I was thrown for a second on how this might be working since angular 8 requires node 10 or later.
Since node LTS is 14.15.1 this image is no longer nodejs 12 npm 6. Would it be possible to update the image to use node 12-slim or similar?
Our build is failing because of a dependency "node-sass" build errors. Aparently node-sass doesn't support node 14.15.1.
When run via gitlab CI, with this job description:
lint:nglint:
stage: test
image: trion/ng-cli:${CLI_VERSION}
script:
- ng lint
this error occurs:
Running with gitlab-runner 13.8.0 (775dd39d)
on code-fbi-h-da-de-runner-6b97bf74f7-lkkgn uS4iLib3
Resolving secrets
00:00
Preparing the "kubernetes" executor
00:00
Using Kubernetes namespace: ci
WARNING: Pulling GitLab Runner helper image from Docker Hub. Helper image is migrating to registry.gitlab.com, for more information see https://docs.gitlab.com/runner/configuration/advanced-configuration.html#migrating-helper-image-to-registrygitlabcom
Using Kubernetes executor with image trion/ng-cli:${CLI_VERSION} ...
Preparing environment
00:06
Waiting for pod ci/runner-us4ilib3-project-15457-concurrent-0rlw7t to be running, status is Pending
Waiting for pod ci/runner-us4ilib3-project-15457-concurrent-0rlw7t to be running, status is Pending
ContainersNotReady: "containers with unready status: [build helper]"
ContainersNotReady: "containers with unready status: [build helper]"
Running on runner-us4ilib3-project-15457-concurrent-0rlw7t via code-fbi-h-da-de-runner-6b97bf74f7-lkkgn...
Getting source from Git repository
00:01
Fetching changes with git depth set to 50...
Initialized empty Git repository in /builds/istlujime/angular-ci-cd-test/.git/
Created fresh repository.
Checking out 71a77e4f as master...
Skipping Git submodules setup
Downloading artifacts
00:00
Downloading artifacts for build (270294)...
Downloading artifacts from coordinator... ok id=270294 responseStatus=200 OK token=dsXdsdkz
WARNING: dist/: lchown dist/: operation not permitted (suppressing repeats)
Executing "step_script" stage of the job script
00:01
$ ng lint
An unhandled exception occurred: Cannot find module '@angular-eslint/builder/package.json'
Require stack:
- /usr/local/lib/node_modules/@angular/cli/node_modules/@angular-devkit/architect/node/node-modules-architect-host.js
- /usr/local/lib/node_modules/@angular/cli/node_modules/@angular-devkit/architect/node/index.js
- /usr/local/lib/node_modules/@angular/cli/models/architect-command.js
- /usr/local/lib/node_modules/@angular/cli/commands/lint-impl.js
- /usr/local/lib/node_modules/@angular/cli/node_modules/@angular-devkit/schematics/tools/export-ref.js
- /usr/local/lib/node_modules/@angular/cli/node_modules/@angular-devkit/schematics/tools/index.js
- /usr/local/lib/node_modules/@angular/cli/utilities/json-schema.js
- /usr/local/lib/node_modules/@angular/cli/models/command-runner.js
- /usr/local/lib/node_modules/@angular/cli/lib/cli/index.js
- /usr/local/lib/node_modules/@angular/cli/lib/init.js
- /usr/local/lib/node_modules/@angular/cli/bin/ng
See "/tmp/ng-eoBgYw/angular-errors.log" for further details.
Cleaning up file based variables
00:00
ERROR: Job failed: command terminated with exit code 1
The expected behavior would be that the job runs trough fine. Cannot find module '@angular-eslint/builder/package.json'
does not occur in my local development environment, as these modules are present, both in node_modules and package.json.
My package.json:
{
"name": "angular-ci-test",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development",
"test": "ng test",
"lint": "ng lint"
},
"private": true,
"dependencies": {
"@angular/animations": "~12.0.3",
"@angular/common": "~12.0.3",
"@angular/compiler": "~12.0.3",
"@angular/core": "~12.0.3",
"@angular/forms": "~12.0.3",
"@angular/platform-browser": "~12.0.3",
"@angular/platform-browser-dynamic": "~12.0.3",
"@angular/router": "~12.0.3",
"rxjs": "~6.6.0",
"tslib": "^2.1.0",
"zone.js": "~0.11.4"
},
"devDependencies": {
"@angular-devkit/build-angular": "^12.0.3",
"@angular-devkit/core": "^12.0.3",
"@angular-eslint/builder": "12.1.0",
"@angular-eslint/eslint-plugin": "12.1.0",
"@angular-eslint/eslint-plugin-template": "12.1.0",
"@angular-eslint/schematics": "12.1.0",
"@angular-eslint/template-parser": "12.1.0",
"@angular/cli": "~12.0.3",
"@angular/compiler-cli": "~12.0.3",
"@types/jasmine": "~3.6.0",
"@types/node": "^12.11.1",
"@typescript-eslint/eslint-plugin": "4.23.0",
"@typescript-eslint/parser": "4.23.0",
"ajv": "^6.12.6",
"angular-eslint": "0.0.1-alpha.0",
"eslint": "^7.26.0",
"jasmine-core": "~3.7.0",
"karma": "~6.3.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.0.3",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.5.0",
"typescript": "~4.2.3"
}
}
Hello there!
First of all, thanks for the great images. They're super useful and it's great that someone is able to maintain them!
I'd like to point out that since version 7.x this image is no longer built from a tagged version of node.
This may cause some issues with modules that both require a specific version of ng-cli, and specific versions of node.
For example, I still use angular 6.0.7, which installs node-sass 4.9.0, which requires node 10 to work.
Unfortunately, the 6.0.7 image uses node 8 instead (which is not supported at all by node-sass 4.9.0).
Images from 7.x and above point to the latest version of node available, which makes things work, but require node-sass to be compiled at each run, with lots of time lost.
For my personal needs, having a 6.0.7 image with node 10.x would be perfect.
Any thought?
Thank you!
Please update the readme at https://hub.docker.com/r/trion/ng-cli to show the correct Node and NPM versions. This gave us a big headache this morning. Thank you!
Wanting to use this image to run unit tests with Angular 15.2.9 but the latest I see is 15.2.7.
Tried using 15.2.7 but ran into some errors - Can we build a 15.2.9 version ?
cd MyDemo
docker run -u $(id -u) --rm -p 4200:4200 -v "$PWD":/app trion/ng-cli ng serve -host 0.0.0.0
Should read:
cd MyDemo
docker run -u $(id -u) --rm -p 4200:4200 -v "$PWD":/app trion/ng-cli ng serve --host 0.0.0.0
I'm using version 8.1.0 to support an application that hasn't yet been migrated, but I'm assuming that it is the same for newer versions?
What are the possibilities of adding the curl
utility to this image?
We use it to upload and download artifacts to our internal repository. I know you already added the zip
utility (thank you!), and this would make things even better.
We actually use the ng-cli-e2e
image, but since this is the base image, it would get added there, as well.
I can create an image off of yours, but it would be nice if this was added here, instead.
I can also create a pull request to this repo, if you'd like.
Thanks, and keep up the great work!
ng set
was deprecated and removed in favor of ng config
ng set
appears a couple time in the documentation
ng set --global packageManager=yarn
can be replaced with ng config -g cli.packageManager yarn
I want to use all three trion-ng-cli images (ng-cli, ng-cli-e2e, ng-cli-karma) for CI/CD, using Gitlab Runners. The pipeline basically looks like that:
In between those jobs, I want to cache npm dependencies. Sadly, the third job fails due to "operation permitted" when trying to change some of the npm cache. The reason here is that the ng-cli-e2e and ng-cli-karma images have root
as default user, and the npm cache created by the first image is owned by the root
user. Using the ng-cli image in the third job, the default user is node
, not having write permissions for the npm cache created by the root
user.
To illustrate my issue, I ran these commands:
PS C:\Users\Sebastian Oltmanns> docker run trion/ng-cli whoami
node
PS C:\Users\Sebastian Oltmanns> docker run trion/ng-cli-e2e whoami
root
PS C:\Users\Sebastian Oltmanns> docker run trion/ng-cli-karma whoami
root
I may be wrong in any conclusion. Maybe there is some other reason for this behaviour. Can somebody help me with this?
When we mount any file to this docker image they are being wirtten as 1003 user.. but i guess only node has permission to write over here.. so 1003 npm i fails
We noticed our builds started to fail after doing some research it looks like the base image for this package was recently changed. This change has made it so we cannot install ssh-agent onto the machine.
$ which ssh-agent || ( apt-get update -y && apt-get install openssh-clients -y )
Hit:1 http://security.debian.org/debian-security stretch/updates InRelease
Ign:2 http://deb.debian.org/debian stretch InRelease
Hit:3 http://deb.debian.org/debian stretch-updates InRelease
Hit:4 http://deb.debian.org/debian stretch Release
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package openssh-clients
ERROR: Job failed: exit code 1
I would like to use your docker images but the repository doesn't seem to have any license. Please consider adding a license
Thank you!
Now we have to add yarn by ourselves.
We would like to use a preinstalled yarn in the pipeline.
I've been using ng-cli-karma to run builds on bitbucket pipelines, but when things switched to node:8, the builds began to fail with a node-sass error:
`29 09 2017 00:30:38.713:ERROR [karma]: Error: Module build failed: Error: Missing binding /opt/atlassian/pipelines/agent/build/node_modules/node-sass/vendor/linux-x64-57/binding.node
Node Sass could not find a binding for your current environment: Linux 64-bit with Node.js 8.x
Found bindings for the following environments:
Locally, I installed NodeJS 8, and reproduced a similar error. I ran the recommended command for npm rebuild node-sass --force
, which rebuilt the items in the node_modules folder, and everything once again worked for ng building and testing.
On bitbucket, I actually stash node_modules.tar.gz in the Downloads, and use curl to pull that file and decompress it to speed the node_modules setup process. So, I updated that file with the node-sass updates, and tried the build again. It got a little further, but still failed on my ng test step:
Error: Module build failed: Error: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version
GLIBCXX_3.4.21' not found (required by /opt/atlassian/pipelines/agent/build/node_modules/node-sass/vendor/linux-x64-57/binding.node)`
It appears that the node-sass is depending on GLIBCXX_3.4.21, but that's not accessible in the container. Any ideas on how to make that file available? Otherwise, I may have to fork this dockerfile and create a version that still uses node:6...
Thanks for taking a look.
Hi There,
I was using your image file to use it in my bit bucket pipeline. however I need to install the zip package in the docker but I'm getting the permission errors as below:
+ apt-get update
Reading package lists...
E: List directory /var/lib/apt/lists/partial is missing. - Acquire (13: Permission denied)
+ apt-get install zip -y
E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
Can you tell me how can we resolve these permission issues?
Just wondering if you might consider changing from node:lts-slim to something with a newer node version? :)
Hi, we have been using this docker image in our CICD process for quite some time now and it was working fine. From last few days suddenly we are seeing below error in below steps.
Initially the error is in npm ci step and we tried changing the image tag to 8.3.12 and npm ci error got resolved and has moved to ng build step
npm ci
ng build --prod
Error: Cannot find module 'node-sass'```
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.