Skip to content

Commit 739b53f

Browse files
committed
Updated Docker file to generate allure reports in docker
1 parent 0c69aed commit 739b53f

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

Dockerfile.playwright

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# ---- Build Stage ----
22
FROM mcr.microsoft.com/playwright:v1.53.1-jammy AS build
33

4-
# Install Java 11 (required for Allure)
4+
# Install Java 11 (for Allure)
55
RUN 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

1111
WORKDIR /app
1212

13-
# Copy only package files first to cache layer
13+
# Copy package files first to leverage Docker caching
1414
COPY package*.json ./
1515

1616
# Install Node dependencies
@@ -19,31 +19,30 @@ RUN npm ci
1919
# Copy environment files
2020
COPY env ./env
2121

22-
# Copy the rest of the application
22+
# Copy the full application
2323
COPY . .
2424

2525
# ---- Final Stage ----
2626
FROM 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
2929
RUN 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-
3836
ENV JAVA_HOME=/usr/lib/jvm/temurin-11-jdk-amd64
3937
ENV PATH=$JAVA_HOME/bin:$PATH
4038

4139
WORKDIR /app
4240

43-
# Copy node_modules and built app from build stage
41+
# Copy built assets and node_modules from the build stage
4442
COPY --from=build /app/node_modules ./node_modules
4543
COPY --from=build /app/env ./env
4644
COPY --from=build /app/. .
4745
COPY --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

Comments
 (0)