Refactors Playwright Dockerfile

Updates the Playwright Dockerfile to streamline the build process.

This change improves the Dockerfile by:

- Using `npm ci` for faster and more reliable dependency installation
- Copying the .npmrc file before copying the code.
- Installing Playwright browsers within the playwright-tests directory.
This commit is contained in:
maguire-arman 2025-07-09 13:02:42 -04:00
parent 6c0947ad32
commit ca4c50f01a

View file

@ -5,14 +5,16 @@ FROM mcr.microsoft.com/playwright:v1.48.0-noble
# Set the working directory in the container
WORKDIR /app
# Copy package.json and package-lock.json
COPY package*.json ./
ARG NPM_CONFIG_USERCONFIG=/tmp/.npmrc
COPY playwright-tests/.npmrc /tmp/.npmrc
# Copy the application code
COPY . .
# Install dependencies
RUN npm install
RUN npm ci
RUN npm --prefix playwright-tests ci
# Install Playwright browsers
RUN npx playwright install chromium --with-deps
# Copy the rest of the application code
COPY . .
RUN npx --prefix playwright-tests playwright install chromium --with-deps