Sign inSign up

kchason/nodejs-ci

By kchason

•Updated 18 days ago

NodeJS (18, 20, 22, 23, 24, 25, 26) with additional tools helpful for CI environments.

Image
Integration & delivery
Developer tools
0

10K+

kchason/nodejs-ci repository overview

⁠Overview

Provides a vanilla NodeJS (https://hub.docker.com/_/node/⁠) image with several helpful tools for CI runners.

Current inclusions are:

  • Google Chrome for JS test utilities such as Karma and Jasmine
  • Xvfb for UI testing
  • tslint, eslint, stylelint, and codelyzer for linting

Example usage with Angular:

⁠Usage
const isDocker = require('is-docker')();

module.exports = function (config) {
  config.set({
       ...
       browsers: ['ChromeCustom'],
    customLaunchers: {
      ChromeCustom: {
        base: 'ChromeHeadless',
        // We must disable the Chrome sandbox when running Chrome inside Docker (Chrome's sandbox needs
        // more permissions than Docker allows by default)
        flags: isDocker ? ['--no-sandbox'] : []
      }
    },
    singleRun: true,
    restartOnFileChange: false
  });
};

Then ng test is able to utilize the ChromeHeadless environment. Docker does not let it be run without --no-sandbox which is was drove the addition of the isDocker check.

⁠Dockerfile
ARG NODE_VERSION="23"

FROM node:${NODE_VERSION}-slim

# Install the required packages
RUN apt-get update && apt-get install git curl wget gnupg -y &&\
    wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - &&\
    echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list &&\
    apt-get update &&\
    apt-get -y install google-chrome-stable xvfb &&\
    apt-get clean -y &&\ 
    npm install -g tslint eslint codelyzer stylelint

# Specifies the default working directory
WORKDIR /usr/app

Tag summary

Content type

Image

Digest

sha256:4c398aab9…

Size

483.2 MB

Last updated

18 days ago

docker pull kchason/nodejs-ci