From 4aa8dd0dfe750774ff7107b3e1b8a97a5a4e5f68 Mon Sep 17 00:00:00 2001 From: Aditya <97450298+1234-ad@users.noreply.github.com> Date: Thu, 2 Oct 2025 14:39:13 +0530 Subject: [PATCH] improve: enhance Docker Compose configuration with better practices - Add health check for better container monitoring - Use more descriptive service name - Add restart policy for production reliability - Include environment variables for better configuration - Add comments for clarity - Optimize volume mounting for development --- compose.yml | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/compose.yml b/compose.yml index 08a7de72a..a1e57dc42 100644 --- a/compose.yml +++ b/compose.yml @@ -1,16 +1,31 @@ services: - drawdb: + drawdb-dev: image: node:20-alpine - container_name: drawdb + container_name: drawdb-development ports: - - 5173:5173 - working_dir: /var/www/html + - "5173:5173" + working_dir: /app volumes: - - ./:/var/www/html + # Mount source code for development + - ./:/app + # Use named volume for node_modules to improve performance + - node_modules:/app/node_modules + environment: + - NODE_ENV=development command: sh -c "npm install && npm run dev -- --host" + restart: unless-stopped + healthcheck: + test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:5173"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 40s networks: - - default + - drawdb-network + +volumes: + node_modules: networks: - default: - driver: bridge + drawdb-network: + driver: bridge \ No newline at end of file