Skip to content

Pin to node:18-alpine — node:latest is Node 26 and breaks yargs ESM - #98

Open
jacksonkyle wants to merge 4 commits into
mcguinness:masterfrom
DataSource-Inc:pin-node-18
Open

Pin to node:18-alpine — node:latest is Node 26 and breaks yargs ESM#98
jacksonkyle wants to merge 4 commits into
mcguinness:masterfrom
DataSource-Inc:pin-node-18

Conversation

@jacksonkyle

Copy link
Copy Markdown

Latest Node tag is currently Node 26.x. yargs (a dependency in this tree) loads its CJS entrypoint via require() from a file Node 26 treats as an ES module:

ReferenceError: require is not defined in ES module scope, you can
use import instead
at file:///node_modules/yargs/yargs:3:69

Node 18 LTS doesn't reproduce. Pinning to the version range mcguinness upstream actually tests against.

jacksonkyle and others added 4 commits May 22, 2026 16:01
Latest Node tag is currently Node 26.x. yargs (a dependency in this
tree) loads its CJS entrypoint via require() from a file Node 26
treats as an ES module:

  ReferenceError: require is not defined in ES module scope, you can
  use import instead
    at file:///node_modules/yargs/yargs:3:69

Node 18 LTS doesn't reproduce. Pinning to the version range mcguinness
upstream actually tests against.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
npm install fails on Alpine because the samlp dependency is declared
as `github:mcguinness/node-samlp` and npm spawns git to clone it.
node:18-alpine doesn't ship git, so we get ENOENT for `git`.

apk add no-cache git satisfies the install step. Image size grows by
~30 MB which is fine for a test IdP.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Two issues with the previous Dockerfile:

1. Default --host is "localhost" inside the container — that's the
   container's loopback, so Traefik (in a different container) can't
   reach the IdP and routing fails. Force --host 0.0.0.0.

2. ENTRYPOINT had hardcoded Okta placeholder --acs/--aud values.
   They override any env var Dokploy passes, so the IdP always
   issued assertions for the placeholder audience and the SP
   rejected them. Move to an entrypoint script that translates
   SAML_ACS_URL / SAML_AUDIENCE / SAML_SLO_URL / SAML_ISSUER env
   vars into the matching CLI flags.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The root-level `saml-idp:` key is the legacy Compose v1 schema and
modern Docker Compose validation rejects it with
"additional properties 'saml-idp' not allowed". Wrap in `services:`.

Also:
  - Drop `net: host`, which doesn't fit Dokploy's reverse-proxy
    networking model. Traefik routes via the project's docker
    network instead.
  - `expose` instead of `ports` so the IdP is reachable from sibling
    containers / Traefik but not published on the host.
  - Wire SAML_* env vars through so they reach the entrypoint.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant