Skip to content

Commit 7ad265b

Browse files
committed
Base image updated.
1 parent 25129aa commit 7ad265b

File tree

1 file changed

+30
-33
lines changed

1 file changed

+30
-33
lines changed

Dockerfile

Lines changed: 30 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,58 @@
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 \
1014
unzip \
1115
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/*
1722

1823
# Set working directory
1924
WORKDIR /app
2025

2126
# Copy requirements file first for better Docker layer caching
2227
COPY requirements.txt /app/requirements.txt
2328

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
2733

2834
# 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
3338

3439
# Copy the main application script and configuration file
3540
# Assumes your Playwright script is named main.py
3641
COPY main.py /app/main.py
3742
COPY test_config.yml /app/test_config.yml
3843

3944
# --- 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.
4245
# Uncomment only if you intend to run report generation *inside* this container.
4346
# COPY scripts/generate_html_report.py /app/scripts/generate_html_report.py
4447
# COPY scripts/templates/report_template.html /app/scripts/templates/report_template.html
4548
# ---------------------------------------------
4649

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)
4951
ENV PLAYWRIGHT_BROWSERS_PATH=/root/.cache/ms-playwright
5052

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"]
5455

5556
# --- 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"]
6158
# ---------------------------------------------------------------------

0 commit comments

Comments
 (0)