fix(nodered): base is Alpine — use apk + su-exec, not apt + gosu

This commit is contained in:
Mitchell R 2026-05-19 04:06:36 +02:00
parent eb1ac8245a
commit a523e678c7
No known key found for this signature in database
2 changed files with 6 additions and 8 deletions

View file

@ -8,11 +8,9 @@ FROM nodered/node-red:latest
USER root USER root
# gosu lets the entrypoint drop from root to node-red after fixing /data # su-exec lets the entrypoint drop from root → node-red after fixing /data.
# perms. nodered/node-red is Debian-slim based so apt is the right channel. # nodered/node-red:latest is Alpine-based — apt isn't present.
RUN apt-get update \ RUN apk add --no-cache su-exec
&& apt-get install -y --no-install-recommends gosu \
&& rm -rf /var/lib/apt/lists/*
# Copy our nodes into a path outside /data (which is volume-mounted) # Copy our nodes into a path outside /data (which is volume-mounted)
COPY nodered /usr/src/betterframe-nodes COPY nodered /usr/src/betterframe-nodes

View file

@ -26,6 +26,6 @@ fi
# Ensure the volume + seeded file are owned by node-red. # Ensure the volume + seeded file are owned by node-red.
chown -R node-red:root "$DATA" 2>/dev/null || true chown -R node-red:root "$DATA" 2>/dev/null || true
# Drop to the node-red user before launching. nodered/node-red is Debian # Drop to the node-red user before launching. nodered/node-red is Alpine
# based; we installed gosu in the Dockerfile for this. # based; the Dockerfile installs su-exec for this.
exec gosu node-red:node-red npm start --cache /data/.npm -- --userDir /data "$@" exec su-exec node-red:node-red npm start --cache /data/.npm -- --userDir /data "$@"