Repository: github.com/detoxd/detoxd | Images: images/node
Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine. Created by Ryan Dahl in 2009, it enables JavaScript to run server-side, making it possible to build scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient.
Node.js applications face unique security challenges:
NODE_ENV=productionFROM detoxd/node:22-alpine-detox.1
# Create app directory
WORKDIR /app
# Copy package files first (for better caching)
COPY package*.json ./
# Install production dependencies only
RUN npm ci --only=production && \
npm cache clean --force
# Copy application code
COPY --chown=nodeuser:nodeuser . .
# Run as non-root user
USER nodeuser
# Use specific command (not npm start)
CMD ["node", "server.js"]
const helmet = require('helmet');
const rateLimit = require('express-rate-limit');
const hpp = require('hpp');
const xss = require('xss-clean');
const app = express();
// Security headers
app.use(helmet());
// Rate limiting
app.use(rateLimit({
windowMs: 15 * 60 * 1000, // 15 minutes
max: 100 // limit each IP to 100 requests per window
}));
// Prevent parameter pollution
app.use(hpp());
// Prevent XSS attacks
app.use(xss());
// Disable X-Powered-By
app.disable('x-powered-by');
# Audit dependencies
npm audit
# Fix vulnerabilities automatically
npm audit fix
# Check for outdated packages
npm outdated
# Use lockfile
npm ci # Instead of npm install
# Always use lockfile
package-lock=true
# Audit on install
audit=true
# Ignore scripts from dependencies (optional, may break some packages)
ignore-scripts=true
# Use specific registry
registry=https://registry.npmjs.org/
NODE_ENV=production
NODE_OPTIONS="--max-old-space-size=256"
NPM_CONFIG_LOGLEVEL=error
Content type
Image
Digest
sha256:c8d724913…
Size
54.5 MB
Last updated
6 months ago
docker pull detoxd/node:22.22.2-alpine3.23-detox.1