pbnj

Dockerfile

# Stage 1 - build
FROM node:20-alpine AS builder

WORKDIR /hexo

RUN apk add --no-cache git
RUN npm install -g hexo-cli

RUN hexo init . && npm install

# Clean up default files
RUN rm -rf source/* scaffolds themes/landscape

# Copy each build,
RUN git clone --depth=1 https://github.com/LTDev-LLC/hexo-theme-flux-palette.git themes/flux-palette && rm -rf themes/flux-palette/.git
# or COPY a local fork/clone
# COPY ../hexo-theme-flux-palette themes/flux-palette

RUN npm install @swc/core

# Copy config and content
COPY . .

RUN hexo clean && hexo generate || { echo "Hexo generate failed"; exit 1; }

# Stage 2 - run
FROM busybox:latest
COPY --from=builder /hexo/public /www
CMD ["httpd", "-f", "-v", "-p", "8024", "-h", "/www"]