1
- # Dockerfile for running Playwright QA tests
2
-
3
- # Use the specified base image (ensure it has Python 3.x)
4
- FROM flybase/harvdev-docker:latest
5
-
6
- # Install base system dependencies potentially needed by Playwright install or Python build tools
7
- # Playwright browser dependencies will be handled by 'playwright install --with-deps' later
8
- RUN apk update && \
9
- apk add --no-cache \
1
+ # Dockerfile for running Playwright QA tests using a Debian-based Python image
2
+
3
+ # Use an official Python 3.11 Slim Debian (Bookworm) base image
4
+ FROM python:3.11-slim-bookworm
5
+
6
+ # Install base system dependencies using apt-get
7
+ # - build-essential includes gcc, g++, make etc. (like build-base on Alpine)
8
+ # - libyaml-dev for PyYAML C extensions (like yaml-dev on Alpine)
9
+ # - unzip, gnupg potentially needed by Playwright install scripts
10
+ # - curl is useful for debugging network issues
11
+ # - ca-certificates helps ensure HTTPS connections work reliably
12
+ RUN apt-get update && \
13
+ apt-get install -y --no-install-recommends \
10
14
unzip \
11
15
gnupg \
12
- build-base \
13
- # Keep yaml-dev in case PyYAML needs C extensions, safer than removing
14
- yaml-dev \
15
- # Clean apk cache to reduce image size
16
- && rm -rf /var/cache/apk/*
16
+ build-essential \
17
+ libyaml-dev \
18
+ curl \
19
+ ca-certificates \
20
+ # Clean apt cache to reduce image size
21
+ && rm -rf /var/lib/apt/lists/*
17
22
18
23
# Set working directory
19
24
WORKDIR /app
20
25
21
26
# Copy requirements file first for better Docker layer caching
22
27
COPY requirements.txt /app/requirements.txt
23
28
24
- # Install Python dependencies from requirements file (including Playwright)
25
- RUN pip install --no-cache-dir --upgrade pip setuptools wheel && \
26
- pip install --no-cache-dir -r requirements.txt
29
+ # Install Python dependencies using python3's pip module
30
+ # Ensures we use the correct pip associated with python3
31
+ RUN python3 -m pip install --no-cache-dir --upgrade pip setuptools wheel && \
32
+ python3 -m pip install --no-cache-dir -r requirements.txt
27
33
28
34
# Install Playwright browsers and their OS dependencies using the --with-deps flag
29
- # This is crucial as it installs necessary system libraries for the browser on Alpine Linux.
30
- # Currently installing only Chromium, as implied by the original Dockerfile.
31
- # Add 'firefox' or 'webkit' if needed: playwright install --with-deps chromium firefox webkit
32
- RUN playwright install --with-deps chromium
35
+ # This command works on Debian/Ubuntu too; it will use apt-get internally.
36
+ # Installing only chromium, add 'firefox' or 'webkit' if needed.
37
+ RUN python3 -m playwright install --with-deps chromium
33
38
34
39
# Copy the main application script and configuration file
35
40
# Assumes your Playwright script is named main.py
36
41
COPY main.py /app/main.py
37
42
COPY test_config.yml /app/test_config.yml
38
43
39
44
# --- Optional: Copy Report Generation Files ---
40
- # These are typically NOT needed inside *this* container if your GitHub Action
41
- # generates the report *after* this container runs and artifacts are copied out.
42
45
# Uncomment only if you intend to run report generation *inside* this container.
43
46
# COPY scripts/generate_html_report.py /app/scripts/generate_html_report.py
44
47
# COPY scripts/templates/report_template.html /app/scripts/templates/report_template.html
45
48
# ---------------------------------------------
46
49
47
- # Set environment variable for Playwright browser path (recommended for consistency)
48
- # The path /root/.cache/ms-playwright is common when running as root user in containers.
50
+ # Set environment variable for Playwright browser path (standard location for root user)
49
51
ENV PLAYWRIGHT_BROWSERS_PATH=/root/.cache/ms-playwright
50
52
51
- # Define the default command to run the test script.
52
- # This aligns with the GitHub Action running tests and then handling reports externally.
53
- CMD ["python" , "main.py" , "--config" , "test_config.yml" ]
53
+ # Define the default command to run the test script using python3
54
+ CMD ["python3" , "main.py" , "--config" , "test_config.yml" ]
54
55
55
56
# --- Optional: Alternative CMD for In-Container Report Generation ---
56
- # If you uncommented the COPY lines for report scripts above and want to
57
- # run everything inside the container, you could use this CMD instead:
58
- # CMD ["sh", "-c", "python main.py --config test_config.yml && python scripts/generate_html_report.py"]
59
- # Note: This would require mounting /app/docs volume in your 'docker run' command
60
- # in the GitHub Action if you want to retrieve the generated report.
57
+ # CMD ["sh", "-c", "python3 main.py --config test_config.yml && python3 scripts/generate_html_report.py"]
61
58
# ---------------------------------------------------------------------
0 commit comments