Dockerfile.playwright-ci 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. # Streamlined Dockerfile for Playwright E2E Testing
  2. # Optimized for speed: builds app outside Docker, installs only Playwright deps inside
  3. # Cache-optimized: layers ordered by frequency of change
  4. FROM mcr.microsoft.com/playwright:v1.53.1-noble
  5. # Install system dependencies (rarely changes - good for caching)
  6. # Use BuildKit cache mounts for faster APT operations
  7. RUN --mount=type=cache,id=apt-cache,target=/var/cache/apt \
  8. --mount=type=cache,id=apt-lists,target=/var/lib/apt/lists \
  9. apt-get update && apt-get install -y \
  10. # VSCode dependencies
  11. libasound2t64 \
  12. libatk-bridge2.0-0 \
  13. libdrm2 \
  14. libxkbcommon0 \
  15. libxcomposite1 \
  16. libxdamage1 \
  17. libxrandr2 \
  18. libgbm1 \
  19. libxss1 \
  20. # Additional Chrome dependencies
  21. fonts-liberation \
  22. libappindicator3-1 \
  23. libnss3 \
  24. lsb-release \
  25. xdg-utils \
  26. # Process management
  27. procps \
  28. # D-Bus for virtual display
  29. dbus-x11 \
  30. # VS Code secrets API support in Docker
  31. gnome-keyring \
  32. libsecret-1-0 \
  33. libsecret-1-dev
  34. # Install pnpm globally (rarely changes - good for caching)
  35. RUN npm install -g [email protected]
  36. # Set environment variables (rarely changes - good for caching)
  37. ENV NODE_ENV=production \
  38. CI=true \
  39. DISPLAY=:99 \
  40. DOCKER_CONTAINER=true \
  41. ELECTRON_DISABLE_SANDBOX=false \
  42. ELECTRON_ENABLE_LOGGING=true
  43. # Create workspace directory
  44. WORKDIR /workspace
  45. # Copy entrypoint script with execute permissions
  46. COPY --chmod=755 apps/playwright-e2e/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
  47. # Set entrypoint
  48. ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]