Files
dev-toolbox/docker-compose.yml
T
promise_cyf 7dcb094f4e feat(juhe): 增加Redis缓存与每日调用限流
重构聚合数据客户端为服务层,引入Redis缓存及每日调用上限50次,超限后降级使用缓存;调整默认激活prod并移除MySQL profile;处理静态资源404异常。

添加用户友好界面,增加京备案号
2026-10-10 14:24:49 +08:00

38 lines
1.5 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 只部署应用本身;Redis 已在宿主机 Docker 中运行,MySQL 暂不需要。
services:
app:
build:
context: .
dockerfile: Dockerfile
image: dev-toolbox:latest
container_name: dev-toolbox
restart: unless-stopped
ports:
- "8077:8077"
environment:
# 激活生产 profile(info 日志、关闭 H2 控制台)
SPRING_PROFILES_ACTIVE: prod
# Redis:容器内通过 host.docker.internal 访问宿主机上已发布的 6379
# 前提:宿主机运行的 Redis 容器已把端口映射出来(docker run 时带 -p 6379:6379)
REDIS_HOST: host.docker.internal
REDIS_PORT: "6379"
REDIS_PASSWORD: ""
REDIS_DATABASE: "0"
# 项目暂未使用数据库,用 H2 内存库避免依赖 MySQL;将来接入 MySQL 时删掉这三行,
# 改用 MYSQL_HOST/MYSQL_PORT/MYSQL_DATABASE/MYSQL_USERNAME/MYSQL_PASSWORD 即可
SPRING_DATASOURCE_DRIVER_CLASS_NAME: org.h2.Driver
SPRING_DATASOURCE_URL: "jdbc:h2:mem:dev_toolbox;MODE=MySQL;DB_CLOSE_DELAY=-1;DATABASE_TO_LOWER=TRUE"
SPRING_DATASOURCE_USERNAME: sa
SPRING_DATASOURCE_PASSWORD: ""
# 聚合数据 key:如需覆盖 yml 里的默认值,取消注释并填写(或写在同目录 .env 文件里)
# JUHE_WEATHER_KEY: ""
# JUHE_SOUP_KEY: ""
TZ: Asia/Shanghai
# 让容器能通过 host.docker.internal 访问宿主机(Linux 上必需)
extra_hosts:
- "host.docker.internal:host-gateway"