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