wrolpi/docker/app/Dockerfile
lrnselfreliance d69f8317aa
serve, single-file and readability-extractor install from a committed lockfile (#912)
They were installed with `npm i -g`, which pinned only the three top-level versions and
resolved their 156 dependencies fresh from the registry, so a forged TLS certificate (as
the eMudhra key compromise allowed) could change code WROLPi runs on every archive.
npm-tools/package-lock.json pins every package with its sha512, and install_npm_tools.sh
runs `npm ci` and links the commands into /usr/local/bin for every install path, upgrades,
both images and the archive container.  The app container's unpinned, unused global serve
is removed.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 10:39:08 -06:00

21 lines
559 B
Docker

# base image
# Node 20 matches the nodejs package shipped by Debian 13 (trixie).
FROM node:20-trixie
WORKDIR /app
ENV PATH /app/node_modules/.bin:$PATH
# install and cache app dependencies
USER root
COPY app/public /app/public
COPY app/src /app/src
COPY app/package.json app/package-lock.json app/tsconfig.json /app/
# "node" user will run the app after build.
RUN chown -R node:node /app
# Install dependencies as "node", this is to avoid changing ownership of many files.
USER node
RUN npm install
# Run the production build
CMD ["npm", "run", "start"]