11# ---- Build Stage ----
22FROM mcr.microsoft.com/playwright:v1.53.1-jammy AS build
33
4- # Install Java 11 (required for Allure)
4+ # Install Java 11 (for Allure)
55RUN apt-get update && apt-get install -y wget gnupg2 && \
66 wget -qO - https://packages.adoptium.net/artifactory/api/gpg/key/public | gpg --dearmor -o /usr/share/keyrings/adoptium.gpg && \
77 echo "deb [signed-by=/usr/share/keyrings/adoptium.gpg] https://packages.adoptium.net/artifactory/deb focal main" | tee /etc/apt/sources.list.d/adoptium.list && \
@@ -10,7 +10,7 @@ RUN apt-get update && apt-get install -y wget gnupg2 && \
1010
1111WORKDIR /app
1212
13- # Copy only package files first to cache layer
13+ # Copy package files first to leverage Docker caching
1414COPY package*.json ./
1515
1616# Install Node dependencies
@@ -19,31 +19,30 @@ RUN npm ci
1919# Copy environment files
2020COPY env ./env
2121
22- # Copy the rest of the application
22+ # Copy the full application
2323COPY . .
2424
2525# ---- Final Stage ----
2626FROM mcr.microsoft.com/playwright:v1.53.1-jammy
2727
28- # Install Java 11 (required for Allure) in the final image
28+ # Install Java 11 and Allure CLI
2929RUN apt-get update && apt-get install -y wget gnupg2 && \
3030 wget -qO - https://packages.adoptium.net/artifactory/api/gpg/key/public | gpg --dearmor -o /usr/share/keyrings/adoptium.gpg && \
3131 echo "deb [signed-by=/usr/share/keyrings/adoptium.gpg] https://packages.adoptium.net/artifactory/deb focal main" | tee /etc/apt/sources.list.d/adoptium.list && \
3232 apt-get update && apt-get install -y temurin-11-jdk && \
33+ npm install -g allure-commandline --force && \
3334 rm -rf /var/lib/apt/lists/*
3435
35- # Install Allure CLI globally in the final image
36- RUN npm install -g allure-commandline --force
37-
3836ENV JAVA_HOME=/usr/lib/jvm/temurin-11-jdk-amd64
3937ENV PATH=$JAVA_HOME/bin:$PATH
4038
4139WORKDIR /app
4240
43- # Copy node_modules and built app from build stage
41+ # Copy built assets and node_modules from the build stage
4442COPY --from=build /app/node_modules ./node_modules
4543COPY --from=build /app/env ./env
4644COPY --from=build /app/. .
4745COPY --from=build /app/package*.json ./
4846
49- CMD ["npm", "run", "test:allure"]
47+ # Default CMD — runs Playwright tests and generates Allure report
48+ CMD ["npm", "run", "test:allure"]
0 commit comments