← Back to index

Docker + Node.js Template

Docker pipeline with Node.js lint/test integration. Runs ESLint and tests before building the Docker image.

Setup

Recommended: External CI/CD Configuration

Go to Settings > CI/CD > General pipelines and set CI/CD configuration file to:

https://gitlab-ci-yaml-template.enouvo.com/docker/.nodejs.gitlab-ci.yml

Alternative: Include in .gitlab-ci.yml

include:
  - 'https://gitlab-ci-yaml-template.enouvo.com/docker/.nodejs.gitlab-ci.yml'

What it includes

Additional Variables

VariableDefaultDescription
NODE_VERSION22.22Node.js version for test image
NODEJS_LINT_CMDlintnpm script name for linting
NODEJS_TEST_CMDtestnpm script name for testing

Package Manager Detection

Automatically detects the package manager from lockfiles:

Override with NODE_PACKAGE_MANAGER variable.

Coverage

Coverage reports are automatically configured for both Jest and Vitest projects. The cobertura reporter is injected for GitLab MR coverage visualization.