base image for quizRoom socket

This commit is contained in:
MathieuSevignyLavallee 2024-11-05 16:37:07 -05:00
parent 4cca066751
commit 85bd93792c
5 changed files with 261 additions and 4507 deletions

View file

@ -4,15 +4,18 @@ FROM node:18
# Create a working directory # Create a working directory
WORKDIR /usr/src/app WORKDIR /usr/src/app
# Copy package.json and install dependencies # Copy package.json and package-lock.json (if available) and install dependencies
COPY package*.json ./ COPY package*.json ./
RUN npm install RUN npm install
# Copy all source code to the container # Copy the rest of the source code to the container
COPY . . COPY . .
# Build the TypeScript code
RUN npm run build
# Expose WebSocket server port # Expose WebSocket server port
EXPOSE 4500 EXPOSE 4500
# Start the WebSocket server # Start the server using the compiled JavaScript file
CMD ["node", "app.js"] CMD ["node", "dist/app.js"]

View file

@ -4,7 +4,7 @@ import { Server, ServerOptions } from "socket.io";
// Import setupWebsocket // Import setupWebsocket
import { setupWebsocket } from "./socket/setupWebSocket"; import { setupWebsocket } from "./socket/setupWebSocket";
const port = process.env.WS_PORT ? parseInt(process.env.WS_PORT) : 4500; const port = 4500;
// Create HTTP and WebSocket server // Create HTTP and WebSocket server
const server = http.createServer(); const server = http.createServer();

File diff suppressed because it is too large Load diff

View file

@ -1,21 +1,23 @@
{ {
"name": "ets-pfe004-evaluetonsavoir-quizroom", "name": "quizroom",
"version": "1.0.0", "version": "1.0.0",
"main": "app.js", "main": "index.js",
"scripts": { "scripts": {
"start": "node app.js", "start": "node dist/app.js",
"test": "jest --colors" "build": "tsc",
"dev": "ts-node app.ts"
}, },
"keywords": [],
"author": "", "author": "",
"license": "ISC", "license": "ISC",
"description": "", "description": "",
"dependencies": {
"express": "^4.18.2",
"jsonwebtoken": "^9.0.2",
"socket.io": "^4.7.2"
},
"devDependencies": { "devDependencies": {
"jest": "^29.7.0", "@types/express": "^5.0.0",
"jest-mock": "^29.7.0" "ts-node": "^10.9.2",
"typescript": "^5.6.3"
},
"dependencies": {
"http": "^0.0.1-security",
"socket.io": "^4.8.1"
} }
} }

14
quizRoom/tsconfig.json Normal file
View file

@ -0,0 +1,14 @@
{
"compilerOptions": {
"target": "ES6",
"module": "commonjs",
"outDir": "./dist",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true
},
"include": ["./**/*"],
"exclude": ["node_modules"]
}