What’s the best way to install Python on the Docker Hub Playwright image for use in CI pipelines?

I approached it a bit differently, rather than building a custom Docker image upfront, we opted for a quick workaround. We added a before_script section in our .gitlab-ci.yml file to install Python within the container during each job run:

before_script:
  - apt-get update && apt-get install -y python3 python3-pip

While this isn’t ideal for long-term efficiency, since Python gets installed every time a job runs, it allowed us to move forward quickly without major changes. This approach kept everything running within the same Playwright image and unblocked the team. Once our setup was more stable, we transitioned to using a proper Dockerfile for better performance and maintainability.