services: backend: image: node:20-alpine working_dir: /app volumes: - ./backend:/app # Only install if node_modules is missing, otherwise just start command: sh -c "if [ ! -d 'node_modules' ]; then npm install; fi && node index.js" ports: - "3001:3001" environment: - PORT=3001 networks: - monitor-net frontend: image: node:20-alpine working_dir: /app volumes: - ./frontend:/app # Only install if node_modules is missing, otherwise just start dev server command: sh -c "if [ ! -d 'node_modules' ]; then npm install; fi && npm run dev -- --host" ports: - "5173:5173" environment: - VITE_API_URL=http://localhost:3001 networks: - monitor-net networks: monitor-net: driver: bridge