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

View File

@@ -54,10 +54,10 @@ services:
condition: service_healthy condition: service_healthy
healthcheck: healthcheck:
test: test:
[ - CMD
'CMD-SHELL', - node
'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))"', - -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 interval: 30s
timeout: 10s timeout: 10s
retries: 3 retries: 3
@@ -121,12 +121,10 @@ services:
SHORT_DOMAIN: https://mifi.me SHORT_DOMAIN: https://mifi.me
healthcheck: healthcheck:
test: test:
[ - CMD
'CMD', - node
'node', - -e
'-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))'
"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 interval: 10s
timeout: 5s timeout: 5s
retries: 5 retries: 5
@@ -146,10 +144,10 @@ services:
QR_API_URL: http://qr_api:8080 QR_API_URL: http://qr_api:8080
healthcheck: healthcheck:
test: test:
[ - CMD
'CMD-SHELL', - node
'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))"', - -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 interval: 30s
timeout: 10s timeout: 10s
retries: 3 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 FROM node:20-bookworm-slim AS builder
RUN corepack enable && corepack prepare pnpm@latest --activate RUN corepack enable && corepack prepare pnpm@latest --activate
WORKDIR /app WORKDIR /app
@@ -6,13 +6,14 @@ COPY package.json pnpm-lock.yaml* ./
RUN pnpm install RUN pnpm install
COPY . . COPY . .
RUN pnpm run build 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 FROM node:20-bookworm-slim
RUN corepack enable && corepack prepare pnpm@latest --activate
WORKDIR /app WORKDIR /app
ENV NODE_ENV=production ENV NODE_ENV=production
COPY package.json pnpm-lock.yaml* ./ COPY package.json ./
RUN pnpm install --prod COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/dist ./dist COPY --from=builder /app/dist ./dist
EXPOSE 8080 EXPOSE 8080
CMD ["node", "dist/index.js"] CMD ["node", "dist/index.js"]