Files
emdash-blog-template/Dockerfile
Kunthawat Greethong ba717ceeff Dockerfile: enable pnpm hoisting so react/react-dom are at top-level
The pnpm isolated linker puts packages deep in .pnpm/store. Adding
node-linker=hoisted to .npmrc makes pnpm hoist packages like npm, so
react is accessible at /app/node_modules/react.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-03 17:38:07 +07:00

46 lines
1.3 KiB
Docker

FROM node:22-alpine AS deps
RUN apk add --no-cache python3 make g++ sqlite git
WORKDIR /app
# Clone full emdash monorepo (with patch applied)
RUN git clone --depth=1 https://git.moreminimore.com/kunthawat/emdash-patch-imageupload.git emdash
# Clone blog template source
RUN git clone --depth=1 https://git.moreminimore.com/kunthawat/emdash-blog-template.git blog-template
WORKDIR /app/emdash
# Add blog template as workspace package and install all deps
RUN cp -r /app/blog-template packages/blog-template
RUN corepack enable && corepack prepare pnpm@9.0.0 --activate
# Enable hoisting so packages are accessible at top-level node_modules
RUN echo "node-linker=hoisted" >> .npmrc
RUN pnpm install
# Build all packages including the blog template
RUN cd packages/core && pnpm build
RUN cd packages/auth && pnpm build
RUN cd packages/blocks && pnpm install && pnpm build
RUN cd packages/admin && pnpm build
RUN cd packages/blog-template && pnpm build
# Final stage - copy everything from deps stage (which now has the built artifacts)
FROM deps
WORKDIR /app
ENV NODE_ENV=production
ENV HOST=0.0.0.0
COPY --from=0 /app/emdash/node_modules ./node_modules
COPY --from=0 /app/emdash/packages/blog-template/dist ./dist
EXPOSE 4321
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]