Skip to content

Latest commit

 

History

History
34 lines (20 loc) · 2.07 KB

README.md

File metadata and controls

34 lines (20 loc) · 2.07 KB

node-dev

Dockerized development environment for Node.js with Yarn through Corepack.

> Usage

./project.sh start      # build the image, create package.json or install its dependencies
./project.sh clean      # remove the containers, images, volumes and all files here, after asking (--force: without)

./project.sh start generates docker-compose.yml, then runs yarn init -y if there is no package.json, or yarn install if there is one, and prints the container's environment variables. Existing files are not overwritten, so you can develop your own project in their place.

On GNU/Linux project.sh adds your user and group id to the containers in docker-compose.yml, so the files they create in this directory are owned by you.

The container uses the host's network (network_mode: host), so development servers started in it are reachable on localhost.

> Image

The Dockerfile of aljazmc/node-debian, with the Debian packages pinned to a day (SNAPSHOT). Based on debian:13.8 with Node.js (NODE_VERSION), downloaded from nodejs.org for amd64 or arm64 and verified with the release keys, Corepack (COREPACK_VERSION) installed with npm, and ShellCheck. Arguments that are not a command are passed to node, e.g. docker compose run --rm node hello.js. COREPACK_ENABLE_DOWNLOAD_PROMPT=0 lets Corepack download Yarn without asking.

A shell in the container, with this directory as the home directory:

docker compose run --rm node bash

> In use

aljazmc, a Yarn 4 monorepo of dependency-free TypeScript packages (a formatter, a linter, a monorepo release tool and a test runner), is developed with a project.sh built from this one: Docker is its only requirement for development.

> License

Node.js is free and open-source software licensed under the MIT License, Yarn under the BSD 2-Clause License.