A Dockerfile for EleventyJS

Context

I like to use 'Long Term Support (LTS)' releases. These never include new enough versions of NodeJS to build my website. podman to the rescue.

Here is a quick Dockerfile

# 
FROM node:21.4 as builder

FROM builder

MAINTAINER Edward Delaporte 

RUN npm add --location=global npm @11ty/eleventy
WORKDIR /app

COPY package.json /app
COPY package-lock.json /app

RUN cd /app;npm install

ENTRYPOINT ["npx", "eleventy", "--serve"]
# 

And here are some commands

  1. Build the image
podman build -t website .
  1. Got an image built?
$ podman image list        
REPOSITORY                     TAG         IMAGE ID      CREATED         SIZE
localhost/website              latest      65b259905584  25 seconds ago  1.19 GB
  1. Run it!
podman run --rm -v .:/app -p 8080:8080 localhost/website
  1. Maybe dig around inside to debug it!
podman run --rm -v .:/app -p 8080:8080 -it --entrypoint bash localhost/website
  1. Audit and update packages.
podman run --rm -v .:/app -p 8080:8080 -it --entrypoint bash localhost/website
npm audit fix