# Dockerfile for Playwright testing environment # Based on official Playwright Docker image with non-root user setup FROM mcr.microsoft.com/playwright:v1.49.1-noble # Create a non-root user for running tests RUN useradd -ms /bin/bash pwuser && \ mkdir -p /home/pwuser/app && \ chown -R pwuser:pwuser /home/pwuser # Switch to non-root user USER pwuser # Set working directory WORKDIR /home/pwuser/app # Copy package files COPY --chown=pwuser:pwuser package.json pnpm-lock.yaml ./ # Install pnpm globally for the user RUN npm install -g pnpm # Install dependencies RUN pnpm install --frozen-lockfile # Copy the rest of the application COPY --chown=pwuser:pwuser . . # Run Playwright tests CMD ["pnpm", "exec", "playwright", "test"]