-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
53 lines (40 loc) · 1.78 KB
/
Dockerfile
File metadata and controls
53 lines (40 loc) · 1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# ─────────────────────────────────────────────
# Stage 1: Install dependencies
# ─────────────────────────────────────────────
FROM mcr.microsoft.com/playwright:v1.43.0-jammy AS deps
WORKDIR /app
# Copy package files
COPY package*.json ./
# Install Node dependencies
RUN npm ci
# ─────────────────────────────────────────────
# Stage 2: Runtime image
# ─────────────────────────────────────────────
FROM mcr.microsoft.com/playwright:v1.43.0-jammy AS runner
# Install Java for Allure CLI
RUN apt-get update && apt-get install -y --no-install-recommends \
openjdk-17-jre-headless \
curl \
unzip \
&& rm -rf /var/lib/apt/lists/*
# Install Allure CLI
ARG ALLURE_VERSION=2.27.0
RUN curl -sLo /tmp/allure.zip "https://github.com/allure-framework/allure2/releases/download/${ALLURE_VERSION}/allure-${ALLURE_VERSION}.zip" \
&& unzip -q /tmp/allure.zip -d /opt \
&& ln -s /opt/allure-${ALLURE_VERSION}/bin/allure /usr/local/bin/allure \
&& rm /tmp/allure.zip
WORKDIR /app
# Copy deps from stage 1
COPY --from=deps /app/node_modules ./node_modules
# Copy source
COPY . .
# Create output dirs
RUN mkdir -p allure-results allure-report test-results videos
# Environment defaults
ENV CI=true \
BASE_URL=https://www.saucedemo.com \
NODE_ENV=test
# Expose Allure report port
EXPOSE 5050
# Default: run tests and generate report
CMD ["sh", "-c", "npm test; npm run allure:generate; allure open allure-report --port 5050"]