Files
ukmesh/Dockerfile.backend
T
BenandClaude Sonnet 4.6 a946a07488 Separate frontend and backend into distinct containers
Splits the monolithic app container into:
- backend: Node.js handling MQTT, WebSocket, API, DB (no static files)
- app: Nginx serving the React SPA, proxying /api and /ws to backend

This means future dashboards (app.ukmesh.com etc.) can be added as
additional Nginx containers pointing at the same backend with no
duplicate calculations or DB connections.

Also updates nginx.website.conf to proxy to backend instead of app,
and bumps website host port from 3001 to 3002 to avoid conflict.

NOTE: Cloudflare Zero Trust tunnel route for app.teessidemesh.com
must be updated from http://app:3000 to http://app:80.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-04 10:58:23 +00:00

17 lines
503 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.sql ./dist/db/schema.sql
EXPOSE 3000
CMD ["node", "dist/index.js"]