feat: 生产化 — nginx alpine + webnet 网络 + healthcheck

This commit is contained in:
gitadmin 2026-07-13 17:47:41 +08:00
parent 853620df5f
commit dba679eaa5
2 changed files with 27 additions and 15 deletions

View File

@ -1,20 +1,20 @@
services: services:
www-dev: web:
image: node:20-alpine image: nginx:alpine
container_name: www-local-ai container_name: www-ai
working_dir: /app restart: always
healthcheck:
test: ["CMD", "wget", "--spider", "-q", "http://localhost:80/"]
interval: 30s
timeout: 5s
retries: 3
start_period: 10s
volumes: volumes:
- ./src:/app - ./html:/usr/share/nginx/html
- node_modules:/app/node_modules - ./nginx.conf:/etc/nginx/conf.d/default.conf
ports:
- "6173:5173"
command: sh -c "npm install && npm run dev -- --hostname 0.0.0.0"
networks: networks:
- devnet - webnet
volumes:
node_modules:
networks: networks:
devnet: webnet:
driver: bridge external: true

12
nginx.conf Normal file
View File

@ -0,0 +1,12 @@
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
index index.html;
location / {
try_files $uri $uri.html $uri/ /index.html;
}
error_page 404 /404.html;
}