mirror of
https://github.com/gadgethd/ukmesh.git
synced 2026-09-11 01:25:35 +00:00
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>
17 lines
503 B
Docker
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"]
|