Slim Starter Pack: Node.js

Attention Node.js developers!

Optimize and harden your containerized applications the easy way — with Slim.AI.

This Starter Kit will help you proactively remove vulnerabilities from your applications.

No more chasing down hard to patch vulns that your application isn't even using.

Slimming this Node.js container results in a 90% reduction in container size, meaning a significantly reduced attack surface while requiring 0 new code!

Meta Data difference by severity

Get Started

To start this dockerized Node.js application, all you will need is a running Docker daemon. From there, running this app requires just two simple commands executed in the app directory.

  docker build -t node-hw .
  docker run -dp 8080:8080 node-website

From there, you can navigate to localhost:8080 on your host machine.

Sample Application

Our sample application is a simple “Hello World” Node.js express web server.

const express = require('express')
const app = express()
const port = 300

app.get('/', (req, res) => {
 res.send('Hello World!')
})

app.listen(port, () => {
 console.log(`Example app listening at http://localhost:${port}`)
})

Replace this placeholder code with your own application code and install any necessary dependencies to create your own "slimmable" container.

Sample Dockerfile

Our Dockerfile builds off of the node:16 base image.

FROM node:latest 

WORKDIR /usr/src/app 

COPY package*.json ./ 

RUN npm ci 

USER node 

COPY app.js ./ 

EXPOSE 3000 

ENTRYPOINT ["node", "app.js"]