diff --git a/Dockerfile b/Dockerfile index dfee474..9a34b59 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,9 @@ -FROM node:18-alpine +FROM nginx:stable-alpine -WORKDIR /usr/src/app +WORKDIR /usr/share/nginx/html COPY . . EXPOSE 80 -CMD ["node", "server.js"] +CMD ["nginx", "-g", "daemon off;"] diff --git a/commands.js b/commands.js deleted file mode 100644 index e916ebf..0000000 --- a/commands.js +++ /dev/null @@ -1,68 +0,0 @@ -const services = [ - { name: 'Dev Workspaces', url: 'https://coder.phorge.fr' }, - { name: 'Monitoring', url: 'https://monitoring.phorge.fr' }, - { name: 'Status page', url: 'https://status.phorge.fr/status' }, - { name: 'Git', url: 'https://git.phorge.fr' }, - { name: 'IaaS', url: 'https://iaas.phorge.fr' }, -]; - -const commands = [ - { - names: ['/services'], - description: 'Displays available services', - execute: (socket) => { - socket.write('Available services:\r\n'); - for (const service of services) { - socket.write(`- ${service.name}: ${service.url}\r\n`); - } - }, - }, - { - names: ['/help', 'help'], - description: 'Displays command help', - execute: (socket) => { - socket.write('Available commands:\r\n'); - for (const command of commands) { - socket.write(`- ${command.names[0]}: ${command.description}\r\n`); - } - }, - }, - { - names: ['/exit', 'quit'], - description: 'Exits the terminal session', - execute: (socket) => { - socket.write('Goodbye.\r\n'); - socket.end(); - }, - }, -]; - -const resolveCommand = (input) => { - const normalized = input.trim().toLowerCase(); - return commands.find((command) => command.names.includes(normalized)); -}; - -const handleCommand = (socket, input) => { - const trimmed = input.trim(); - if (!trimmed) { - socket.write('phorge> '); - return; - } - - const command = resolveCommand(trimmed); - if (command) { - command.execute(socket); - if (command.names.includes('/exit') || command.names.includes('quit')) { - return; - } - } else { - socket.write(`Unknown command : ${trimmed}\r\n`); - socket.write('Type /help for assistance.\r\n'); - } - - socket.write('phorge> '); -}; - -module.exports = { - handleCommand, -}; diff --git a/index.html b/index.html index 6b61f04..b46a6df 100644 --- a/index.html +++ b/index.html @@ -31,25 +31,25 @@