rastasheep / alpine-node-chromium Goto Github PK
View Code? Open in Web Editor NEWDockerized chromium inside node alpine image
License: MIT License
Dockerized chromium inside node alpine image
License: MIT License
https://developers.google.com/web/updates/2017/04/headless-chrome
I think it should be --diable-gpu
browsers: ['ChromiumNoSandbox'],
customLaunchers: {
ChromiumNoSandbox: {
base: 'ChromiumHeadless',
flags: ['--no-sandbox', '--headless', '--disabled-gpu']
}
}
FYI: Dockerhub is throwing the following error upon build:
Build failed: The command '/bin/sh -c echo "http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories && echo "http://dl-cdn.alpinelinux.org/alpine/edge/main" >> /etc/apk/repositories && echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories && apk --no-cache update && apk --no-cache upgrade && apk add --no-cache --virtual .build-deps gifsicle pngquant optipng libjpeg-turbo-utils udev ttf-opensans chromium && rm -rf /var/cache/apk/* /tmp/*' returned a non-zero code: 2
https://hub.docker.com/r/rastasheep/alpine-node-chromium/builds/bexrrmephx5djohxjoewnra/
Hello,
we are creating a pipeline for a node project.
Our goal is obtain the lcov.info
file (which will later read by SonarQube) with the command
ng test --code-coverage
From our local machine is working fine, so I consider the project itself correctly configured.
This is our karma configuration (as written in the documentation we added the browser definition)
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular-devkit/build-angular/plugins/karma')
],
client: {
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, '../coverage'),
reports: ['html', 'lcovonly', 'text-summary'],
fixWebpackSourcePaths: true
},
reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ["ChromiumNoSandbox"],
//browsers: ["ChromeHeadless"],
customLauchers: {
ChromiumNoSandbox: {
base: 'ChromiumHeadless',
flags: ['--no-sandbox', '--headless', '--disable-gpu', '--disable-translate', '--disable-extensions']
}
},
singleRun: false
});
};
This is our docker image:
FROM rastasheep/alpine-node-chromium:10-alpine
ARG ng_version=latest
RUN npm install -g @angular/cli@$ng_version --unsafe-perms && \
ng version
ENTRYPOINT ["ng"]
We started from this image and we added the ng
command line which will be used from our project.
When the pipeline is running and the image is loaded, we are getting this error:
Step #2 - "NG Test Code Coverage": 10 07 2020 08:09:24.662:WARN [karma]: No captured browser, open http://localhost:9876/
Step #2 - "NG Test Code Coverage": 10 07 2020 08:09:24.734:INFO [karma-server]: Karma v4.1.0 server started at http://0.0.0.0:9876/
Step #2 - "NG Test Code Coverage": 10 07 2020 08:09:24.735:INFO [launcher]: Launching browsers ChromiumNoSandbox with concurrency unlimited
Step #2 - "NG Test Code Coverage": 10 07 2020 08:09:24.736:ERROR [launcher]: Cannot load browser "ChromiumNoSandbox": it is not registered! Perhaps you are missing some plugin?
Step #2 - "NG Test Code Coverage": 10 07 2020 08:09:24.737:ERROR [karma-server]: Error: Found 1 load error
Step #2 - "NG Test Code Coverage": at Server.<anonymous> (/workspace/node_modules/karma/lib/server.js:182:27)
Step #2 - "NG Test Code Coverage": at Object.onceWrapper (events.js:299:28)
Step #2 - "NG Test Code Coverage": at Server.emit (events.js:215:7)
Step #2 - "NG Test Code Coverage": at emitListeningNT (net.js:1335:10)
Step #2 - "NG Test Code Coverage": at processTicksAndRejections (internal/process/task_queues.js:79:21)
This is the error:
Cannot load browser "ChromiumNoSandbox": it is not registered! Perhaps you are missing some plugin?
We completed the Karma configuration with the example we found on this repository README, and it should work.
Do you have any suggestion on what is missing from our configuration?
Hello,
I tried to remove udev
dependency and looks like all the things are worked as expected.
Do you know udev
was added? Maybe I'm missing something?
When karma tries to start chromium, it fails with this error.
Running chromium-browser in a shell inside the container also fails:
`/ # uname -a
Linux test-6c59d6496d-f42hw 3.10.0-1062.4.3.el7.x86_64 #1 SMP Wed Nov 13 23:58:53 UTC 2019 x86_64 Linux
/ # chromium-browser --no-sandbox --headless --disable-gpu --disable-translate --disable-extensions
[1222/120012.881675:WARNING:dns_config_service_posix.cc(341)] Failed to read DnsConfig.
[1222/120012.929962:ERROR:zygote_host_impl_linux.cc(259)] Failed to adjust OOM score of renderer with pid 41: Permission denied (13)
[1222/120013.065123:ERROR:gl_implementation.cc(282)] Failed to load /usr/lib/chromium/swiftshader/libGLESv2.so: Error loading shared library /usr/lib/chromium/swiftshader/libGLESv2.so: No such file or directory
[1222/120013.067796:WARNING:dns_config_service_posix.cc(341)] Failed to read DnsConfig.
[1222/120013.069274:ERROR:viz_main_impl.cc(176)] Exiting GPU process due to errors during initialization
[1222/120013.077492:WARNING:gpu_process_host.cc(1220)] The GPU process has crashed 1 time(s)`
Image used: rastasheep/alpine-node-chromium:latest
Host system: CentOS Linux release 7.7.1908 (Core)
Docker version: 19.03.5, build 633a0ea
Kubernetes version: Client 1.17.0, Server 1.16.3
Thanks for looking into it.
Trying to run ng test --single-run
fails with:
02 10 2017 18:40:13.629:INFO [karma]: Karma v1.7.0 server started at http://0.0.0.0:9876/
02 10 2017 18:40:13.631:INFO [launcher]: Launching browser Chrome with unlimited concurrency
02 10 2017 18:40:13.637:INFO [launcher]: Starting browser Chrome
10% building modules 2/4 modules 2 active /build/src /\.spec\.ts$/02 10 2017 18:40:14.596:ERROR [launcher]: Cannot start Chrome
Failed to move to new namespace: PID namespaces supported, Network namespace supported, but failed: errno = Operation not permitted
[17:17:1002/184013.842119:FATAL:zygote_host_impl_linux.cc(182)] Check failed: ReceiveFixedMessage(fds[0], kZygoteBootMessage, sizeof(kZygoteBootMessage), &boot_pid).
I'm trying to run Pact-JS with Karma to do consumer tests, but I'm unable to run pact-mock-service.
I've created a sample project illustrating the problem: https://github.com/nieldw/pact-karma-alpine-issue
The error I'm getting is:
WARN: [email protected]/1 on 3d34c88a62ad: Pact exited with code 127.
I've tried the solution at https://github.com/pact-foundation/pact-ruby-standalone/wiki/Using-the-pact-ruby-standalone-with-Alpine-Linux-Docker, basically, adding:
RUN apk add --no-cache --virtual build-dependencies build-base
However, this fails with
ERROR: unsatisfiable constraints:
musl-1.1.19-r4:
breaks: musl-dev-1.1.19-r7
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.