Files
EVOLV/Dockerfile
znetsixe c25866e7bc fix(docker): chown /data/evolv to node-red before WORKDIR
The original Dockerfile switched to USER node-red before WORKDIR
/data/evolv, so the auto-created parent directory ended up root-owned
and `RUN npm install` failed with EACCES trying to mkdir node_modules.

Fix: mkdir + chown explicitly as root, then WORKDIR + USER node-red.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-11 15:41:00 +02:00

48 lines
1.9 KiB
Docker

########################################
# EVOLV — Node-RED Development Image
########################################
FROM nodered/node-red:latest
# Install curl for health checks
USER root
RUN apk add --no-cache curl
# Set working directory to the EVOLV bind mount location.
# Create + chown explicitly so the unprivileged node-red user can
# write `node_modules` during `npm install` below. Without this the
# WORKDIR is created as root and npm fails with EACCES.
RUN mkdir -p /data/evolv && chown -R node-red:node-red /data/evolv
WORKDIR /data/evolv
USER node-red
# -------------------------------------------------------
# Layer-cache: copy dependency manifests first
# -------------------------------------------------------
COPY --chown=node-red:node-red package.json package-lock.json* ./
# Copy generalFunctions early (it's a file: dependency)
COPY --chown=node-red:node-red nodes/generalFunctions/ ./nodes/generalFunctions/
# Install dependencies — skip scripts to avoid unused TensorFlow native build
RUN npm install --ignore-scripts
# Install Node-RED palette nodes used by demo flows
RUN cd /usr/src/node-red && npm install @flowfuse/node-red-dashboard
# -------------------------------------------------------
# Copy entrypoint and settings
# -------------------------------------------------------
COPY --chown=node-red:node-red docker/entrypoint.sh /data/evolv/docker/entrypoint.sh
COPY --chown=node-red:node-red docker/settings.js /data/evolv/docker/settings.js
# -------------------------------------------------------
# Health check: Node-RED admin API
# -------------------------------------------------------
HEALTHCHECK --interval=15s --timeout=5s --start-period=30s --retries=3 \
CMD curl -sf http://localhost:1880/nodes || exit 1
# -------------------------------------------------------
# Entrypoint
# -------------------------------------------------------
ENTRYPOINT ["sh", "/data/evolv/docker/entrypoint.sh"]