# Dev/build image for the Hexo site. # # Purpose: lets any Docker-capable machine (e.g. a NAS) build and preview # the site without installing Node, yarn, or a node_modules folder on the # host. Dependencies are baked into the image; the source is mounted in. # # Build: docker build -t hexo-dev . # Preview: docker compose up -> http://localhost:4000 # Build: docker compose run --rm hexo generate # # node:22-slim (Debian/glibc) matches the CI runner, avoiding any musl # compatibility surprises in npm packages. FROM node:22-slim # yarn via corepack, hexo CLI globally RUN corepack enable && npm install -g hexo-cli WORKDIR /site # Locked dependencies live INSIDE the image. Rebuild the image whenever # package.json / yarn.lock change, and reset the compose volume (-V). COPY package.json yarn.lock ./ RUN yarn install --frozen-lockfile && yarn cache clean EXPOSE 4000 # Everything runs through hexo; bind 0.0.0.0 so LAN machines can preview. ENTRYPOINT ["hexo"] CMD ["server", "-p", "4000", "-H", "0.0.0.0"]