加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
docker-compose.yml 2.12 KB
一键复制 编辑 原始数据 按行查看 历史
zodiac4006 提交于 2023-11-05 22:07 . add env init
version: "3.3"
services:
traefik:
image: "traefik:v2.10"
networks:
- fars-net
command:
# 是否启动WEB UI
- --api.dashboard=true
- --providers.docker=true
- --providers.docker.exposedByDefault=false
- --providers.docker.constraints=Label(`traefik.constraint-label`, `fars-docker`)
- --entrypoints.web.address=:80
ports:
# 服务端口
- "80:80"
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
labels:
- traefik.enable=true
- traefik.constraint-label=fars-docker
# 配置traefik api@internal
- traefik.http.routers.api.rule=Host(`traefik.zodiac.com`) && PathPrefix(`/api`)
- traefik.http.routers.api.service=api@internal
- traefik.http.routers.api.middlewares=auth
# 配置traefik dashboard@internal
- traefik.http.routers.dashboard.rule=Host(`traefik.zodiac.com`)
- traefik.http.routers.dashboard.service=dashboard@internal
- traefik.http.routers.dashboard.middlewares=auth
# 配置安全认证
- traefik.http.middlewares.auth.basicauth.users=test:$$apr1$$H6uskkkW$$IgXLP6ewTrSuBkTrqE8wj/,test2:$$apr1$$d9hr9HBB$$4HxwgUir3HP4EsggP/QNo0
db:
image: postgres:12
networks:
- fars-net
ports:
# 服务端口
- "5432:5432"
volumes:
- app-db-data:/var/lib/postgresql/data/pgdata
env_file:
- .env
environment:
- PGDATA=/var/lib/postgresql/data/pgdata
deploy:
placement:
constraints:
- node.labels.fars-docker.app-db-data == true
pgadmin:
image: dpage/pgadmin4
networks:
- fars-net
depends_on:
- db
env_file:
- .env
labels:
- traefik.enable=true
- traefik.docker.network=fars-net
- traefik.constraint-label=fars-docker
- traefik.http.routers.fars-docker-pgadmin.entrypoints=web
- traefik.http.routers.fars-docker-pgadmin-http.rule=Host(`pgadmin.zodiac.com`)
- traefik.http.services.fars-docker-pgadmin.loadbalancer.server.port=5050
volumes:
app-db-data:
networks:
fars-net:
# Allow setting it to false for testing
external: false
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化