k-l-lambda commited on
Commit
aba34fa
·
1 Parent(s): cb658ec

Test: Express + Socket.io server

Browse files
Files changed (1) hide show
  1. Dockerfile +8 -3
Dockerfile CHANGED
@@ -2,7 +2,7 @@ FROM node:20-slim
2
 
3
  ENV DEBIAN_FRONTEND=noninteractive
4
 
5
- # Build timestamp: 2026-01-13T03:25
6
 
7
  WORKDIR /app
8
 
@@ -10,13 +10,18 @@ WORKDIR /app
10
  COPY trigo-web/backend/package.json ./package.json
11
  RUN npm install --omit=dev
12
 
13
- # Create a simple test server to verify Express works
14
  RUN echo 'import express from "express"; \
 
 
15
  const app = express(); \
 
 
16
  const port = process.env.PORT || 7860; \
17
  app.use(express.static("app/dist")); \
18
  app.get("/health", (req, res) => res.json({status: "ok"})); \
19
- app.listen(port, "0.0.0.0", () => console.log("Server running on port " + port));' > server.js
 
20
 
21
  # Copy frontend dist
22
  COPY trigo-web/app/dist/ ./app/dist/
 
2
 
3
  ENV DEBIAN_FRONTEND=noninteractive
4
 
5
+ # Build timestamp: 2026-01-13T03:35
6
 
7
  WORKDIR /app
8
 
 
10
  COPY trigo-web/backend/package.json ./package.json
11
  RUN npm install --omit=dev
12
 
13
+ # Create a test server with Express + Socket.io
14
  RUN echo 'import express from "express"; \
15
+ import { createServer } from "http"; \
16
+ import { Server } from "socket.io"; \
17
  const app = express(); \
18
+ const httpServer = createServer(app); \
19
+ const io = new Server(httpServer, { cors: { origin: true } }); \
20
  const port = process.env.PORT || 7860; \
21
  app.use(express.static("app/dist")); \
22
  app.get("/health", (req, res) => res.json({status: "ok"})); \
23
+ io.on("connection", (socket) => console.log("Client connected:", socket.id)); \
24
+ httpServer.listen(port, "0.0.0.0", () => console.log("Server running on port " + port));' > server.js
25
 
26
  # Copy frontend dist
27
  COPY trigo-web/app/dist/ ./app/dist/