mirror of
https://git.oceanpay.cc/danial/kami_apple_exchage.git
synced 2025-12-18 21:19:19 +00:00
- 移除 screenshot 相关代码和配置 - 修改 SNAPSHOT_DIR 路径为复数形式 - 更新 Dockerfile 和 docker-compose 文件中的数据目录结构 - 优化 playwright_service 中的等待逻辑 - 修改异常日志输出,使用 traceback 提供更详细的信息
58 lines
2.1 KiB
Docker
58 lines
2.1 KiB
Docker
FROM mcr.microsoft.com/playwright/python:v1.48.0-jammy
|
|
|
|
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
|
|
|
|
ENV DEBIAN_FRONTEND=noninteractive \
|
|
UV_COMPILE_BYTECODE=1 \
|
|
PATH="/app/.venv/bin:$PATH" \
|
|
UV_LINK_MODE=copy \
|
|
TZ=Asia/Shanghai \
|
|
PYTHONUNBUFFERED=1 \
|
|
PYTHONDONTWRITEBYTECODE=1 \
|
|
PLAYWRIGHT_BROWSERS_PATH=/app/playwright-browsers \
|
|
GEVENT_SUPPORT=false \
|
|
DOCKER_CONTAINER=true \
|
|
DISPLAY="" \
|
|
PLAYWRIGHT_HEADLESS=true
|
|
|
|
WORKDIR /app
|
|
|
|
RUN apt-get update && apt-get install -y \
|
|
gcc g++ curl wget gnupg \
|
|
libasound2-dev libxss1 libgconf-2-4 libxrandr2 libatk1.0-dev libgtk-3-dev libgdk-pixbuf2.0-dev libxcomposite-dev libxcursor-dev libxdamage-dev libxi-dev libxtst-dev libnss3-dev libcups2-dev libxrandr-dev libasound2-dev libpangocairo-1.0-0 libgdk-pixbuf2.0-0 libgtk-3-0 libgconf-2-4 libnss3 libxss1 libxtst6 fonts-liberation libappindicator1 xdg-utils \
|
|
tzdata \
|
|
&& rm -rf /var/lib/apt/lists/* && apt-get clean && apt-get autoremove -y
|
|
|
|
# 设置时区为东八区
|
|
RUN ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
|
|
dpkg-reconfigure -f noninteractive tzdata
|
|
|
|
COPY pyproject.toml uv.lock ./
|
|
COPY --chmod=755 docker-entrypoint.sh ./
|
|
|
|
RUN uv sync --frozen && \
|
|
chmod -R 755 /app/.venv/bin/*
|
|
|
|
RUN mkdir -p /app/data/uploads /app/logs /app/data/playwright-browsers
|
|
|
|
COPY app ./app
|
|
COPY scripts ./scripts
|
|
COPY .env.production .env
|
|
COPY run.py ./
|
|
|
|
# Install Playwright browsers with explicit path and retry mechanism
|
|
RUN python -m playwright install chromium --with-deps || \
|
|
python -m playwright install chromium || \
|
|
echo "Playwright browser installation will be completed at runtime"
|
|
|
|
# Ensure proper permissions for browser files
|
|
RUN if [ -d "/app/playwright-browsers" ]; then \
|
|
find /app/playwright-browsers -type f -exec chmod +x {} \; 2>/dev/null || true; \
|
|
fi
|
|
|
|
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
|
|
CMD python -c "from app.core.arq_worker import get_arq_worker; worker = get_arq_worker(); print('Arq worker healthy')" || exit 1
|
|
|
|
EXPOSE 8000
|
|
|
|
ENTRYPOINT ["./docker-entrypoint.sh"] |