More fixes?
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# Build stage: compile app and native deps (better-sqlite3) for target platform.
|
||||
# Build stage: TypeScript only (no native deps in this stage).
|
||||
FROM node:20-bookworm-slim AS builder
|
||||
RUN corepack enable && corepack prepare pnpm@latest --activate
|
||||
WORKDIR /app
|
||||
@@ -6,14 +6,20 @@ COPY package.json pnpm-lock.yaml* ./
|
||||
RUN pnpm install
|
||||
COPY . .
|
||||
RUN pnpm run build
|
||||
RUN pnpm prune --prod
|
||||
|
||||
# Runtime: copy built artifacts and node_modules (with compiled better_sqlite3.node).
|
||||
# Runtime: install deps here so better-sqlite3 is compiled for this exact image/platform.
|
||||
FROM node:20-bookworm-slim
|
||||
WORKDIR /app
|
||||
ENV NODE_ENV=production
|
||||
COPY package.json ./
|
||||
COPY --from=builder /app/node_modules ./node_modules
|
||||
# Install build deps needed to compile better-sqlite3; remove after install to keep image small.
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends python3 make g++ \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
RUN corepack enable && corepack prepare pnpm@latest --activate
|
||||
COPY package.json pnpm-lock.yaml* ./
|
||||
RUN pnpm install --prod \
|
||||
&& apt-get purge -y python3 make g++ \
|
||||
&& apt-get autoremove -y --purge \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
COPY --from=builder /app/dist ./dist
|
||||
EXPOSE 8080
|
||||
CMD ["node", "dist/index.js"]
|
||||
|
||||
Reference in New Issue
Block a user