42 lines
1.2 KiB
Docker
42 lines
1.2 KiB
Docker
# 丰享订单监控 —— 生产镜像
|
|
# 只装运行必需的依赖;Playwright / torch / IndexTTS2 都不进镜像(服务器上用不到)
|
|
|
|
FROM python:3.12-slim
|
|
|
|
ENV PYTHONUNBUFFERED=1 \
|
|
PYTHONDONTWRITEBYTECODE=1 \
|
|
PIP_NO_CACHE_DIR=1 \
|
|
TZ=Asia/Shanghai \
|
|
FX_DATA_DIR=/app/data \
|
|
FX_CONFIG=/app/config.yaml
|
|
|
|
RUN apt-get update \
|
|
&& apt-get install -y --no-install-recommends tzdata ca-certificates curl \
|
|
&& rm -rf /var/lib/apt/lists/* \
|
|
&& useradd --create-home --uid 10001 app
|
|
|
|
WORKDIR /app
|
|
|
|
# 国内构建走镜像源;海外或企业内网可 --build-arg PIP_INDEX_URL=https://pypi.org/simple/
|
|
ARG PIP_INDEX_URL=https://mirrors.aliyun.com/pypi/simple/
|
|
ARG PIP_TRUSTED_HOST=mirrors.aliyun.com
|
|
|
|
COPY requirements.txt ./
|
|
RUN pip install --no-cache-dir -i "$PIP_INDEX_URL" --trusted-host "$PIP_TRUSTED_HOST" -r requirements.txt
|
|
|
|
COPY fengxiang ./fengxiang
|
|
COPY order_monitor.py fetch_orders.py push_latest_order.py healthcheck.py ./
|
|
|
|
RUN mkdir -p /app/data && chown -R app:app /app
|
|
|
|
USER app
|
|
WORKDIR /app
|
|
|
|
EXPOSE 8089
|
|
|
|
# 健康检查看的是"是否还在轮询",不是端口是否通
|
|
HEALTHCHECK --interval=60s --timeout=10s --start-period=60s --retries=3 \
|
|
CMD ["python", "healthcheck.py"]
|
|
|
|
CMD ["python", "order_monitor.py"]
|