version: '3.8' services: backend: build: context: ./backend dockerfile: Dockerfile container_name: teapot_backend restart: always environment: # 指定SQLite数据库文件挂载到/app/data中,防止容器重启丢失数据 - SPRING_DATASOURCE_URL=jdbc:sqlite:/app/data/teapot-system.db # NAS服务器的关键:确保商品图片或数据库不随容器重启销毁 volumes: - ./data:/app/data frontend: build: context: ./frontend dockerfile: Dockerfile container_name: teapot_frontend restart: always depends_on: - backend ports: # 选择避开了NAS常见的80, 443, 3000, 8080等端口,用 8090 作为外部访问端。 # 你可以在NAS路由器或面板中直接访问: http://群晖NAS_IP:8090 - "8090:8090"