Add Dockerfile and CI for container image builds#15
Conversation
|
The prefix={{branch}} template resolves empty on PRs, producing
an invalid tag like ":-949cd9f". Use the default sha prefix instead.
Hatchling validates readme = "README.md" from pyproject.toml during build. The *.md exclusion in .dockerignore was removing it.
There was a problem hiding this comment.
Pull request overview
This PR adds Docker containerization support to enable running VIP tests as Kubernetes Jobs in PTD deployments. The implementation includes a multi-stage Dockerfile optimized for layer caching, a GitHub Actions workflow for automated image builds and publishing to GHCR, and a .dockerignore file to minimize image size.
Changes:
- Added Dockerfile based on Microsoft's Playwright Python image with uv package management
- Added GitHub Actions workflow for building and pushing container images to ghcr.io
- Added .dockerignore to exclude non-essential files from the Docker context
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| Dockerfile | Multi-stage build with uv package manager, Playwright browser installation, and pytest entrypoint |
| .github/workflows/docker.yml | CI pipeline for building and pushing images with semver tagging on main branch and version tags |
| .dockerignore | Excludes development files, documentation, and test framework code to reduce image size |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -0,0 +1,30 @@ | |||
| # VIP - Verified Installation of Posit | |||
There was a problem hiding this comment.
The PR description mentions using --co as a pytest option to list test cases, but this is not a valid pytest option. The correct option is --collect-only (or its short form --co is actually not valid - pytest only accepts --collect-only). This should be corrected in the test plan.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
The Playwright base image already has an 'ubuntu' user at UID 1000. Reuse it instead of trying to create a new user at the same UID.
Summary
Dockerfilebased onmcr.microsoft.com/playwright/python:v1.52.0-noblewith uv for package management.github/workflows/docker.ymlCI pipeline to build and push toghcr.io/posit-dev/vip.dockerignoreto exclude non-essential files from the imageDetails
This enables running VIP as a container image, which is needed for Kubernetes Job-based verification in PTD deployments (
ptd verify).Image details:
mcr.microsoft.com/playwright/python:v1.52.0-noble(includes Chromium)uv(copied fromghcr.io/astral-sh/uv:latest)uv run pytest— additional args can be appendedvip.tomlat/app/vip.tomlCI triggers:
main→ taggedlatestv*→ semver image tags (1.0.0,1.0,1)Test plan
docker build -t vip:test .docker run --rm vip:test --co(should list test cases)