This commit is contained in:
2026-02-07 15:20:46 -03:00
parent af3ed05278
commit 7f79d997d2
3 changed files with 19 additions and 20 deletions

View File

@@ -10,7 +10,7 @@ depends_on:
- ci
steps:
- name: Docker image build (qr-api + qr-web, multi-arch)
- name: Docker image build (qr-api + qr-web)
image: docker:latest
environment:
DOCKER_API_VERSION: '1.43'
@@ -27,7 +27,7 @@ steps:
- /var/run/docker.sock:/var/run/docker.sock
commands:
- set -e
- echo "=== Multi-arch Docker build (amd64 + arm64) ==="
- echo "=== Docker build ==="
- 'echo "Commit SHA: ${CI_COMMIT_SHA:0:8}"'
- |
apk add --no-cache git

View File

@@ -54,10 +54,10 @@ services:
condition: service_healthy
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://127.0.0.1:3000/", (r) => { r.resume(); process.exit(r.statusCode >= 200 && r.statusCode < 500 ? 0 : 1); }).on("error", () => process.exit(1))'
interval: 30s
timeout: 10s
retries: 3
@@ -121,12 +121,10 @@ services:
SHORT_DOMAIN: https://mifi.me
healthcheck:
test:
[
'CMD',
'node',
'-e',
"require('http').get('http://127.0.0.1:8080/health', (r) => { r.resume(); process.exit(r.statusCode === 200 ? 0 : 1); }).on('error', () => process.exit(1))",
]
- CMD
- node
- -e
- 'require("http").get("http://127.0.0.1:8080/health", (r) => { r.resume(); process.exit(r.statusCode === 200 ? 0 : 1); }).on("error", () => process.exit(1))'
interval: 10s
timeout: 5s
retries: 5
@@ -146,10 +144,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://127.0.0.1:3000/", (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

@@ -1,4 +1,4 @@
# Use Debian-based image so better-sqlite3 prebuilds (glibc) work; Alpine/musl has no prebuilds.
# Build stage: compile app and native deps (better-sqlite3) for target platform.
FROM node:20-bookworm-slim AS builder
RUN corepack enable && corepack prepare pnpm@latest --activate
WORKDIR /app
@@ -6,13 +6,14 @@ 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).
FROM node:20-bookworm-slim
RUN corepack enable && corepack prepare pnpm@latest --activate
WORKDIR /app
ENV NODE_ENV=production
COPY package.json pnpm-lock.yaml* ./
RUN pnpm install --prod
COPY package.json ./
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/dist ./dist
EXPOSE 8080
CMD ["node", "dist/index.js"]