Add NAS-friendly Docker dev image (compose-based build and preview)
Lint, build, test and deploy / build (push) Successful in 1m40s
Lint, build, test and deploy / test (push) Successful in 6s
Lint, build, test and deploy / deploy (push) Successful in 4s

This commit is contained in:
Leon Xu committed 2026-11-29 15:12:38 -08:00
1 parent c96f7294ec
commit 6551070646
4 files changed
+75

No files matched your search

+29
View File
@@ -0,0 +1,29 @@
# 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"]