feat(docker): update docker-compose commands and add health checks for services

This commit is contained in:
cfngc4594 2025-02-22 00:10:47 +08:00
parent a69f819da4
commit 840cd1e70b
2 changed files with 35 additions and 2 deletions

View File

@ -35,7 +35,7 @@ git clone https://github.com/cfngc4594/monaco-editor-lsp-next
cd monaco-editor-lsp-next cd monaco-editor-lsp-next
# Start containers in detached mode # Start containers in detached mode
docker compose up -d docker compose up -d --build
``` ```
### 🔧 Manual Setup ### 🔧 Manual Setup
@ -46,7 +46,7 @@ git clone https://github.com/cfngc4594/monaco-editor-lsp-next
cd monaco-editor-lsp-next cd monaco-editor-lsp-next
# Start specific containers (lsp-c and lsp-cpp) in detached mode # Start specific containers (lsp-c and lsp-cpp) in detached mode
docker compose up -d lsp-c lsp-cpp docker compose up -d --build lsp-c lsp-cpp
# Install project dependencies using Bun package manager # Install project dependencies using Bun package manager
bun install bun install

View File

@ -3,25 +3,58 @@ services:
build: build:
context: ./ context: ./
dockerfile: Dockerfile dockerfile: Dockerfile
image: monaco-editor-lsp-next:latest
container_name: monaco-editor-lsp-next container_name: monaco-editor-lsp-next
restart: always restart: always
ports: ports:
- "3000:3000" - "3000:3000"
networks:
- monaco-editor-lsp-next
depends_on:
- lsp-c
- lsp-cpp
healthcheck:
test: ["CMD-SHELL", "curl --fail http://localhost:3000 || exit 1"]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
lsp-c: lsp-c:
build: build:
context: ./docker/lsp/clangd context: ./docker/lsp/clangd
dockerfile: Dockerfile dockerfile: Dockerfile
image: lsp-c:latest
container_name: lsp-c container_name: lsp-c
restart: always restart: always
ports: ports:
- "4594:3000" - "4594:3000"
networks:
- monaco-editor-lsp-next
healthcheck:
test: ["CMD-SHELL", "nc -zv localhost 3000"]
interval: 10s
timeout: 5s
retries: 5
lsp-cpp: lsp-cpp:
build: build:
context: ./docker/lsp/clangd context: ./docker/lsp/clangd
dockerfile: Dockerfile dockerfile: Dockerfile
image: lsp-cpp:latest
container_name: lsp-cpp container_name: lsp-cpp
restart: always restart: always
ports: ports:
- "4595:3000" - "4595:3000"
networks:
- monaco-editor-lsp-next
healthcheck:
test: ["CMD-SHELL", "nc -zv localhost 3000"]
interval: 10s
timeout: 5s
retries: 5
networks:
monaco-editor-lsp-next:
name: monaco-editor-lsp-next
driver: bridge