Files
ukmesh/Dockerfile.backend
T
Ben 6ec9329697 Refactor backend route and service boundaries
Split the monolithic backend router into domain route modules for health, radio, node status, coverage, nodes, owner, telemetry, stats, pathing, and misc endpoints.

Introduce the first service layer extractions for stats and owner so route files are now thin wrappers around business logic instead of owning heavy query orchestration and cache policy directly.

Harden DB startup by separating schema/migration bootstrap from the normal request pool timeout path. Startup schema initialization and migrations now run through a dedicated no-timeout startup pool, while runtime query timeouts remain in place.

This refactor also replaces the old monolithic startup schema asset flow with base schema + migration support, adds DB/config asset resolution cleanup, and substantially reduces backend/src/api/routes.ts from its previous multi-thousand-line state to a smaller registration/helper module.

Current roadmap status:
- route decomposition is effectively complete enough to stop splitting route files further
- stats service extraction is complete
- owner service extraction is complete
- next planned slice is pathing service extraction, followed by repository extraction under stats, owner, and pathing
2026-03-20 01:40:22 +00:00

19 lines
667 B
Docker

# Backend only — API, WebSocket, MQTT ingestion, DB
FROM node:20-alpine AS backend-builder
WORKDIR /build/backend
COPY backend/package.json ./
RUN npm install
COPY backend/ ./
RUN npm run build
FROM node:20-alpine AS runtime
WORKDIR /app
COPY backend/package.json ./
RUN npm install --omit=dev && npm cache clean --force
COPY --from=backend-builder /build/backend/dist ./dist
COPY --from=backend-builder /build/backend/src/db/schema ./dist/db/schema
COPY --from=backend-builder /build/backend/src/db/migrations ./dist/db/migrations
COPY --from=backend-builder /build/backend/src/db/owner-auth.sql ./dist/db/owner-auth.sql
EXPOSE 3000
CMD ["node", "dist/index.js"]