refactor: consolidate docker-compose service configurations using a shared base anchor

This commit is contained in:
2569718930@qq.com
2026-03-29 23:36:53 +08:00
parent 0cc4f4f0d3
commit c64fa87e05
2 changed files with 11 additions and 7 deletions
+3 -1
View File
@@ -6,6 +6,8 @@ WORKDIR /app
# 设置环境变量
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PIP_DISABLE_PIP_VERSION_CHECK=1 \
PIP_ROOT_USER_ACTION=ignore \
TZ=UTC
# 安装系统依赖 (如果有必要的包可以取消注释)
@@ -15,7 +17,7 @@ ENV PYTHONDONTWRITEBYTECODE=1 \
COPY requirements.txt .
# 安装 Python 依赖
RUN pip install --no-cache-dir -r requirements.txt
RUN pip install --no-cache-dir --prefer-binary -r requirements.txt
# 复制项目代码
COPY . .
+8 -6
View File
@@ -1,10 +1,14 @@
x-polyweather-base: &polyweather-base
build: .
image: polyweather-app:latest
env_file:
- .env
services:
polyweather:
build: .
<<: *polyweather-base
container_name: polyweather_bot
restart: unless-stopped
env_file:
- .env
volumes:
# Persist runtime data outside git workspace.
# Host path defaults to /var/lib/polyweather and can be overridden in .env.
@@ -17,12 +21,10 @@ services:
user: "${UID:-1000}:${GID:-1000}"
polyweather_web:
build: .
<<: *polyweather-base
container_name: polyweather_web
restart: unless-stopped
command: python web/app.py
env_file:
- .env
volumes:
# Web service shares the same runtime data directory as bot/state tasks.
- ${POLYWEATHER_RUNTIME_DATA_DIR:-/var/lib/polyweather}:/var/lib/polyweather