Skip to content

Add an optional compose-based containerized dev environment #34462

Description

@clement-igonet

Description

Setting up a reproducible three.js dev environment currently depends on the host machine: a matching Node version, a Chromium download for e2e testing (~200 MB, per CONTRIBUTING.md), and OS-specific differences that occasionally surface in screenshot-based e2e results. New contributors pay this cost on their first PR, and CI behavior is not always easy to reproduce locally.

Solution

An optional, documented compose.yml at the repo root (works with both docker compose and podman compose) providing two services:

  • dev: Node LTS container running npm ci and npm start, with the repo bind-mounted and port 8080 published, so compose up dev gives the local server from a clean environment.
  • test: same image running npm run lint and npm run test-unit (and optionally npm run test-e2e with the browser dependencies preinstalled), matching the CI environment more closely for reproducing failures.

The containers change nothing for contributors who prefer plain npm ci; it is an additive convenience, a few dozen lines plus a short section in CONTRIBUTING.md. I am happy to submit a PR if there is interest.

Alternatives

  • A devcontainer.json (VS Code / Codespaces specific; compose is editor-neutral, and a devcontainer can reuse the same compose file later).
  • Documenting a plain docker run one-liner in CONTRIBUTING.md (no orchestration of dev vs test, harder to keep in sync).
  • Status quo: works, but environment drift between contributors and CI remains a support cost (e.g. e2e screenshot instability across platforms).

Additional context

The e2e README notes the effort spent making screenshots deterministic; a pinned container image removes one more source of variance (fonts, browser build, platform rendering). I am preparing GIS-related example contributions and would use this setup for all testing; other example authors would benefit the same way.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions