Fixes for all the bullshit
All checks were successful
ci/woodpecker/push/ci Pipeline was successful
ci/woodpecker/push/deploy Pipeline was successful

This commit is contained in:
2026-02-07 16:38:39 -03:00
parent 89cb014163
commit 58f5af27db
4 changed files with 20 additions and 20 deletions

View File

@@ -148,7 +148,7 @@ services:
- CMD
- node
- -e
- 'require("http").get("http://127.0.0.1:3000/", (r) => { r.resume(); process.exit(r.statusCode >= 200 && r.statusCode < 500 ? 0 : 1); }).on("error", () => process.exit(1))'
- 'require("http").get("http://0.0.0.0:3000/", {timeout: 5000}, (r) => { r.resume(); process.exit(r.statusCode >= 200 && r.statusCode < 500 ? 0 : 1); }).on("error", () => process.exit(1))'
interval: 30s
timeout: 10s
retries: 3

View File

@@ -128,10 +128,10 @@ services:
QR_API_URL: http://qr_api:8080
healthcheck:
test:
[
'CMD-SHELL',
'node -e "require(''http'').get(''http://127.0.0.1:3000/'', (r) => { r.resume(); process.exit(r.statusCode >= 200 && r.statusCode < 500 ? 0 : 1); }).on(''error'', () => process.exit(1))"',
]
- CMD
- node
- -e
- 'require("http").get("http://0.0.0.0:3000/", {timeout: 5000}, (r) => { r.resume(); process.exit(r.statusCode >= 200 && r.statusCode < 500 ? 0 : 1); }).on("error", () => process.exit(1))'
interval: 30s
timeout: 10s
retries: 3

2
qr-api/.npmrc Normal file
View File

@@ -0,0 +1,2 @@
# Force pnpm to run build scripts for better-sqlite3
enable-pre-post-scripts=true

View File

@@ -1,25 +1,23 @@
# Build stage: TypeScript only (no native deps in this stage).
# Build stage: use npm (not pnpm) to avoid workspace issues with better-sqlite3.
FROM node:20-bookworm-slim AS builder
RUN corepack enable && corepack prepare pnpm@latest --activate
RUN apt-get update && apt-get install -y --no-install-recommends python3 make g++ \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY package.json pnpm-lock.yaml* ./
RUN pnpm install
COPY package.json ./
RUN npm install
# Verify better-sqlite3 was compiled; fail build if not.
RUN test -f node_modules/better-sqlite3/build/Release/better_sqlite3.node || \
(echo "ERROR: better-sqlite3.node not found after npm install" && exit 1)
COPY . .
RUN pnpm run build
RUN npm run build
RUN npm prune --production
# Runtime: install deps here so better-sqlite3 is compiled for this exact image/platform.
# Runtime: copy pre-built node_modules from builder.
FROM node:20-bookworm-slim
WORKDIR /app
ENV NODE_ENV=production
# 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/node_modules ./node_modules
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/package.json ./package.json
EXPOSE 8080
CMD ["node", "dist/index.js"]