FROM mcr.microsoft.com/playwright:v1.58.2-jammy WORKDIR /app # 安装依赖 COPY package*.json ./ RUN npm ci # 复制测试文件 COPY e2e ./e2e COPY playwright.config.ts ./ COPY tsconfig.json ./ # 创建测试结果目录 RUN mkdir -p /app/test-results /app/playwright-report # 安装Playwright浏览器 RUN npx playwright install --with-deps chromium # 设置环境变量 ENV CI=true ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright # 运行测试 CMD ["npx", "playwright", "test", "--reporter=json", "--reporter=html", "--reporter=junit"] # 健康检查 HEALTHCHECK --interval=30s --timeout=10s --retries=3 \ CMD test -f /app/playwright-report/index.html || exit 1