refactor: consolidate docker-compose service configurations using a shared base anchor
This commit is contained in:
+3
-1
@@ -6,6 +6,8 @@ WORKDIR /app
|
|||||||
# 设置环境变量
|
# 设置环境变量
|
||||||
ENV PYTHONDONTWRITEBYTECODE=1 \
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
||||||
PYTHONUNBUFFERED=1 \
|
PYTHONUNBUFFERED=1 \
|
||||||
|
PIP_DISABLE_PIP_VERSION_CHECK=1 \
|
||||||
|
PIP_ROOT_USER_ACTION=ignore \
|
||||||
TZ=UTC
|
TZ=UTC
|
||||||
|
|
||||||
# 安装系统依赖 (如果有必要的包可以取消注释)
|
# 安装系统依赖 (如果有必要的包可以取消注释)
|
||||||
@@ -15,7 +17,7 @@ ENV PYTHONDONTWRITEBYTECODE=1 \
|
|||||||
COPY requirements.txt .
|
COPY requirements.txt .
|
||||||
|
|
||||||
# 安装 Python 依赖
|
# 安装 Python 依赖
|
||||||
RUN pip install --no-cache-dir -r requirements.txt
|
RUN pip install --no-cache-dir --prefer-binary -r requirements.txt
|
||||||
|
|
||||||
# 复制项目代码
|
# 复制项目代码
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|||||||
+8
-6
@@ -1,10 +1,14 @@
|
|||||||
|
x-polyweather-base: &polyweather-base
|
||||||
|
build: .
|
||||||
|
image: polyweather-app:latest
|
||||||
|
env_file:
|
||||||
|
- .env
|
||||||
|
|
||||||
services:
|
services:
|
||||||
polyweather:
|
polyweather:
|
||||||
build: .
|
<<: *polyweather-base
|
||||||
container_name: polyweather_bot
|
container_name: polyweather_bot
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
env_file:
|
|
||||||
- .env
|
|
||||||
volumes:
|
volumes:
|
||||||
# Persist runtime data outside git workspace.
|
# Persist runtime data outside git workspace.
|
||||||
# Host path defaults to /var/lib/polyweather and can be overridden in .env.
|
# Host path defaults to /var/lib/polyweather and can be overridden in .env.
|
||||||
@@ -17,12 +21,10 @@ services:
|
|||||||
user: "${UID:-1000}:${GID:-1000}"
|
user: "${UID:-1000}:${GID:-1000}"
|
||||||
|
|
||||||
polyweather_web:
|
polyweather_web:
|
||||||
build: .
|
<<: *polyweather-base
|
||||||
container_name: polyweather_web
|
container_name: polyweather_web
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
command: python web/app.py
|
command: python web/app.py
|
||||||
env_file:
|
|
||||||
- .env
|
|
||||||
volumes:
|
volumes:
|
||||||
# Web service shares the same runtime data directory as bot/state tasks.
|
# Web service shares the same runtime data directory as bot/state tasks.
|
||||||
- ${POLYWEATHER_RUNTIME_DATA_DIR:-/var/lib/polyweather}:/var/lib/polyweather
|
- ${POLYWEATHER_RUNTIME_DATA_DIR:-/var/lib/polyweather}:/var/lib/polyweather
|
||||||
|
|||||||
Reference in New Issue
Block a user