More fixes?
Some checks failed
ci/woodpecker/push/ci Pipeline failed
ci/woodpecker/push/deploy unknown status

This commit is contained in:
2026-02-07 15:55:14 -03:00
parent bd80e91062
commit 1b28a22589
5 changed files with 107 additions and 40 deletions

View File

@@ -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"]