dockerized

This commit is contained in:
Jose Conde 2024-07-17 00:14:14 +02:00
parent 2b54efb604
commit d322442022
3 changed files with 9 additions and 57 deletions

8
Dockerfile Normal file
View File

@ -0,0 +1,8 @@
FROM node:22-alpine
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm i
COPY . .
RUN npm run build
EXPOSE 3000
CMD ["node", "dist/server/index.js"]

View File

@ -1,56 +0,0 @@
import { PlayerAI } from "./game/entities/player/PlayerAI";
import { PlayerHuman } from "./game/entities/player/PlayerHuman";
import {LoggingService} from "./common/LoggingService";
import { MatchSession } from "./game/MatchSession";
console.log('process.arg :>> ', process.argv);
// const game = new DominoesGame([
// new PlayerAI("1", "Player 1"),
// new PlayerAI("2", "Player 2"),
// new PlayerAI("3", "Player 3"),
// new PlayerAI("4", "Player 4"),
// ]);
// const logger = new LoggingService();
// async function wait(ms: number) {s
// return new Promise(resolve => setTimeout(resolve, ms));
// }
async function playSolo(seed?: string) {
const session = new MatchSession(new PlayerHuman( "Jose"), "Test Game");
console.log(`Session (${session.id}) created by: ${session.creator.name}`);
setTimeout(() => session.addPlayerToSession(new PlayerAI("AI 2")), 1000);
setTimeout(() => session.addPlayerToSession(new PlayerAI("AI 3")), 2000);
setTimeout(() => session.addPlayerToSession(new PlayerAI("AI 4")), 3000);
session.start(seed);
}
async function playHumans(seed?: string) {
const session = new MatchSession(new PlayerHuman("Jose"), "Test Game");
session.addPlayerToSession(new PlayerHuman("Pepe"));
session.addPlayerToSession(new PlayerHuman("Juan"));
session.addPlayerToSession(new PlayerHuman("Luis"));
session.start(seed);
}
async function playAIs(seed?: string) {
const session = new MatchSession(new PlayerAI("AI 1"), "Test Game");
session.addPlayerToSession(new PlayerAI("AI 2"));
session.addPlayerToSession(new PlayerAI("AI 3"));
session.addPlayerToSession(new PlayerAI("AI 4"));
session.start(seed);
}
async function playTeams(seed?: string) {
const session = new MatchSession(new PlayerHuman("Jose"), "Test Game");
session.addPlayerToSession(new PlayerAI("AI 1"));
session.addPlayerToSession(new PlayerHuman("Juan"));
session.addPlayerToSession(new PlayerAI("AI 2"));
session.start(seed);
}
const blockedSeed = '1719236688462-ytwrwzfzoi-01aad98f';
const seed2 = '1719237652000-09vddd3hsth7-adbc1842';
playSolo('1719248315701-itmcciws3oi-e5dd2024');