From 1edcb00a953e36dbc26e7183fef103db52678d1e Mon Sep 17 00:00:00 2001 From: Massiles Ghernaout <749-gm213204@users.noreply.www-apps.univ-lehavre.fr> Date: Sun, 30 Nov 2025 16:14:23 +0100 Subject: [PATCH] simple docker setup for the clients (without ahead of time build) --- game/client/Dockerfile | 20 ++++++++++ game/client/README.md | 73 ----------------------------------- game/client/vite.config.ts | 4 ++ monitor/client/Dockerfile | 20 ++++++++++ monitor/client/README.md | 73 ----------------------------------- monitor/client/vite.config.ts | 4 ++ 6 files changed, 48 insertions(+), 146 deletions(-) create mode 100644 game/client/Dockerfile delete mode 100644 game/client/README.md create mode 100644 monitor/client/Dockerfile delete mode 100644 monitor/client/README.md diff --git a/game/client/Dockerfile b/game/client/Dockerfile new file mode 100644 index 0000000..96e141a --- /dev/null +++ b/game/client/Dockerfile @@ -0,0 +1,20 @@ +# Use official Node image +FROM node:20-alpine + +# Set working directory +WORKDIR /app + +# Copy package.json and lock file +COPY package*.json ./ + +# Install dependencies +RUN npm install + +# Copy the rest of the source code +COPY . . + +# Expose Vite dev server port +EXPOSE 5173 + +# Start Vite dev server +CMD ["npm", "run", "dev", "--", "--host"] diff --git a/game/client/README.md b/game/client/README.md deleted file mode 100644 index d2e7761..0000000 --- a/game/client/README.md +++ /dev/null @@ -1,73 +0,0 @@ -# React + TypeScript + Vite - -This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules. - -Currently, two official plugins are available: - -- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) (or [oxc](https://oxc.rs) when used in [rolldown-vite](https://vite.dev/guide/rolldown)) for Fast Refresh -- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh - -## React Compiler - -The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation). - -## Expanding the ESLint configuration - -If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules: - -```js -export default defineConfig([ - globalIgnores(['dist']), - { - files: ['**/*.{ts,tsx}'], - extends: [ - // Other configs... - - // Remove tseslint.configs.recommended and replace with this - tseslint.configs.recommendedTypeChecked, - // Alternatively, use this for stricter rules - tseslint.configs.strictTypeChecked, - // Optionally, add this for stylistic rules - tseslint.configs.stylisticTypeChecked, - - // Other configs... - ], - languageOptions: { - parserOptions: { - project: ['./tsconfig.node.json', './tsconfig.app.json'], - tsconfigRootDir: import.meta.dirname, - }, - // other options... - }, - }, -]) -``` - -You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules: - -```js -// eslint.config.js -import reactX from 'eslint-plugin-react-x' -import reactDom from 'eslint-plugin-react-dom' - -export default defineConfig([ - globalIgnores(['dist']), - { - files: ['**/*.{ts,tsx}'], - extends: [ - // Other configs... - // Enable lint rules for React - reactX.configs['recommended-typescript'], - // Enable lint rules for React DOM - reactDom.configs.recommended, - ], - languageOptions: { - parserOptions: { - project: ['./tsconfig.node.json', './tsconfig.app.json'], - tsconfigRootDir: import.meta.dirname, - }, - // other options... - }, - }, -]) -``` diff --git a/game/client/vite.config.ts b/game/client/vite.config.ts index 8b0f57b..5460707 100644 --- a/game/client/vite.config.ts +++ b/game/client/vite.config.ts @@ -4,4 +4,8 @@ import react from '@vitejs/plugin-react' // https://vite.dev/config/ export default defineConfig({ plugins: [react()], + server: { + port: 5173, + host: true, + }, }) diff --git a/monitor/client/Dockerfile b/monitor/client/Dockerfile new file mode 100644 index 0000000..2510a91 --- /dev/null +++ b/monitor/client/Dockerfile @@ -0,0 +1,20 @@ +# Use official Node image +FROM node:20-alpine + +# Set working directory +WORKDIR /app + +# Copy package.json and lock file +COPY package*.json ./ + +# Install dependencies +RUN npm install + +# Copy the rest of the source code +COPY . . + +# Expose Vite dev server port +EXPOSE 5174 + +# Start Vite dev server +CMD ["npm", "run", "dev", "--", "--host"] diff --git a/monitor/client/README.md b/monitor/client/README.md deleted file mode 100644 index d2e7761..0000000 --- a/monitor/client/README.md +++ /dev/null @@ -1,73 +0,0 @@ -# React + TypeScript + Vite - -This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules. - -Currently, two official plugins are available: - -- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) (or [oxc](https://oxc.rs) when used in [rolldown-vite](https://vite.dev/guide/rolldown)) for Fast Refresh -- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh - -## React Compiler - -The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation). - -## Expanding the ESLint configuration - -If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules: - -```js -export default defineConfig([ - globalIgnores(['dist']), - { - files: ['**/*.{ts,tsx}'], - extends: [ - // Other configs... - - // Remove tseslint.configs.recommended and replace with this - tseslint.configs.recommendedTypeChecked, - // Alternatively, use this for stricter rules - tseslint.configs.strictTypeChecked, - // Optionally, add this for stylistic rules - tseslint.configs.stylisticTypeChecked, - - // Other configs... - ], - languageOptions: { - parserOptions: { - project: ['./tsconfig.node.json', './tsconfig.app.json'], - tsconfigRootDir: import.meta.dirname, - }, - // other options... - }, - }, -]) -``` - -You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules: - -```js -// eslint.config.js -import reactX from 'eslint-plugin-react-x' -import reactDom from 'eslint-plugin-react-dom' - -export default defineConfig([ - globalIgnores(['dist']), - { - files: ['**/*.{ts,tsx}'], - extends: [ - // Other configs... - // Enable lint rules for React - reactX.configs['recommended-typescript'], - // Enable lint rules for React DOM - reactDom.configs.recommended, - ], - languageOptions: { - parserOptions: { - project: ['./tsconfig.node.json', './tsconfig.app.json'], - tsconfigRootDir: import.meta.dirname, - }, - // other options... - }, - }, -]) -``` diff --git a/monitor/client/vite.config.ts b/monitor/client/vite.config.ts index 8b0f57b..22efc6d 100644 --- a/monitor/client/vite.config.ts +++ b/monitor/client/vite.config.ts @@ -4,4 +4,8 @@ import react from '@vitejs/plugin-react' // https://vite.dev/config/ export default defineConfig({ plugins: [react()], + server: { + port: 5174, + host: true, + }, }) -- GitLab