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