Dockerfile: build blog template as part of emdash monorepo workspace

Clones full emdash monorepo (with image upload fix), adds blog template
as a workspace package, builds everything together. No package copying
required - workspace resolution handles everything.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Kunthawat Greethong
2026-05-03 16:17:10 +07:00
parent a06c72b9d1
commit f10263f99a

View File

@@ -4,45 +4,32 @@ RUN apk add --no-cache python3 make g++ sqlite git
WORKDIR /app WORKDIR /app
COPY package.json pnpm-lock.yaml* ./ # Clone full emdash monorepo (with patch applied)
RUN corepack enable && corepack prepare pnpm@9.0.0 --activate RUN git clone --depth=1 https://git.moreminimore.com/kunthawat/emdash-patch-imageupload.git emdash
RUN pnpm install
FROM deps AS builder # Clone blog template source
RUN git clone --depth=1 https://git.moreminimore.com/kunthawat/emdash-blog-template.git blog-template
WORKDIR /app WORKDIR /app/emdash
# Clone patched emdash source # Add blog template as workspace package
RUN git clone --depth=1 https://git.moreminimore.com/kunthawat/emdash-patch-imageupload.git emdash-source RUN cp -r /app/blog-template packages/blog-template
WORKDIR /app/emdash-source
# Build core package (contains visual editing toolbar with fix) # Build all packages including the blog template
RUN corepack enable && corepack prepare pnpm@9.0.0 --activate RUN corepack enable && corepack prepare pnpm@9.0.0 --activate
RUN pnpm install RUN pnpm install
RUN cd packages/core && pnpm build RUN cd packages/core && pnpm build
RUN cd packages/auth && pnpm build
# Return to app RUN cd packages/blocks && pnpm install && pnpm build
WORKDIR /app RUN cd packages/admin && pnpm build
COPY --from=deps /app/node_modules ./node_modules RUN cd packages/blog-template && pnpm build
COPY . .
# Replace emdash core with patched version (don't copy whole package - it has circular symlinks)
RUN rm -rf node_modules/emdash/dist node_modules/emdash/src node_modules/emdash/package.json
RUN cp -r emdash-source/packages/core/dist node_modules/emdash/
RUN cp -r emdash-source/packages/core/src node_modules/emdash/
RUN cp emdash-source/packages/core/package.json node_modules/emdash/
RUN pnpm build && mkdir -p storage/uploads
FROM deps AS runner FROM deps AS runner
WORKDIR /app WORKDIR /app
ENV NODE_ENV=production COPY --from=deps /app/emdash/packages/blog-template/dist ./dist
ENV HOST=0.0.0.0 COPY --from=deps /app/emdash/packages/blog-template/node_modules ./node_modules
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/dist ./dist
EXPOSE 4321 EXPOSE 4321