Files
emdash-blog-template/Dockerfile
Kunthawat Greethong e8d4e3e767 Chown entire /app directory to astro user for write access
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-29 20:32:35 +07:00

40 lines
716 B
Docker

FROM node:22-alpine AS deps
RUN apk add --no-cache python3 make g++ sqlite
WORKDIR /app
COPY package.json pnpm-lock.yaml* ./
RUN corepack enable && corepack prepare pnpm@9.0.0 --activate
RUN pnpm install
FROM deps AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
RUN pnpm build && pnpm exec emdash init && pnpm exec emdash seed
FROM deps AS runner
WORKDIR /app
ENV NODE_ENV=production
ENV HOST=0.0.0.0
RUN adduser --system --uid 1001 astro
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/data.db ./data.db
RUN chown -R astro:astro /app
USER astro
EXPOSE 4321
CMD ["node", "./dist/server/entry.mjs"]