Slim NodeJS Containers


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.
Simply replace the application code here with your own application, run it through Slim.AI's automated container optimization process, and you'll remove up to 90% of the image's vulnerabilities.
No more chasing down hard to patch vulns that your application isn't even using.
Optimization Results
Slimming this Node.js container results in a 90% reduction in container size, meaning a significantly reduced attack surface while requiring no new code!
Image Metadata difference
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 placholder 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"]
The slimming process reduces the size by 9X to just 86MB.