-
Notifications
You must be signed in to change notification settings - Fork 50
ci: test docker builds for PRs and pushes on master
#114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds continuous integration testing for Docker image builds on PRs and pushes to the master branch. The workflow validates that the Docker image can be successfully built on both linux/amd64 and linux/arm64/v8 platforms and can create and build a sample SPFx React webpart project.
Changes:
- Adds new CI workflow that builds the Docker image and tests it by creating a sample SPFx webpart
- Converts Dockerfile to multi-stage build with test stages for automated validation
- Adds docker-bake.hcl configuration for managing build targets and platforms
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
.github/workflows/ci.yml |
New CI workflow that builds and tests the Docker image on PRs and master branch pushes |
docker-bake.hcl |
New Docker Bake configuration defining build targets for default image and test scenarios |
Dockerfile |
Refactored to multi-stage build with test stages (test-base, test-webpart) for CI validation |
.github/workflows/build-and-push.yaml |
Updated to specify the 'default' build target for consistency with new multi-stage structure |
.gitattributes |
Enforces LF line endings for consistent cross-platform behavior |
.dockerignore |
Excludes unnecessary files from Docker build context (.github, assets, OS-specific files) |
README.md |
Adds documentation section with examples for building and running custom images |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| - uses: actions/checkout@v6 | ||
| - uses: docker/setup-buildx-action@v3 | ||
| with: | ||
| cleanup: false |
Copilot
AI
Jan 11, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent indentation: this line uses 4 spaces for indentation while the rest of the file uses 2 spaces. This should be adjusted to maintain consistent YAML formatting.
| cleanup: false | |
| cleanup: false |
| - uses: actions/checkout@v6 | ||
| - uses: docker/setup-buildx-action@v3 | ||
| with: | ||
| cleanup: false |
Copilot
AI
Jan 11, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent indentation: this line uses 4 spaces for indentation while the rest of the file uses 2 spaces. This should be adjusted to maintain consistent YAML formatting.
| --solution-name spfx-webpart \ | ||
| --component-name HelloWorld \ | ||
| --framework react \ | ||
| --package-manager pnpm \ |
Copilot
AI
Jan 11, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The yo command is missing the '--no-insight' flag that's shown in the CONTRIBUTING.md examples. Without this flag, the Yeoman generator may attempt to send telemetry and could cause interactive prompts or delays during the automated build process.
| --package-manager pnpm \ | |
| --package-manager pnpm \ | |
| --no-insight \ |
| --skip-install | ||
|
|
||
| WORKDIR spfx-webpart | ||
|
|
Copilot
AI
Jan 11, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pnpm cache mount may not be effective because pnpm is not configured to use the custom store directory. Consider adding 'pnpm config set store-dir /usr/app/spfx/test/.pnpm-store' before running 'pnpm install' to ensure the cache mount is actually utilized.
| RUN pnpm config set store-dir /usr/app/spfx/test/.pnpm-store |
| targets = [ | ||
| "test-webpart" | ||
| ] |
Copilot
AI
Jan 11, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The "test" target definition is missing the "target" field that specifies which Dockerfile build stage to build. Based on the Dockerfile, this should be 'target = "test-webpart"'. The "targets" field appears to be invalid syntax for a bake target definition - it's typically used in group definitions, not target definitions.
| targets = [ | |
| "test-webpart" | |
| ] | |
| target = "test-webpart" |
| build: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v6 |
Copilot
AI
Jan 11, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ci.yml workflow uses actions/checkout@v6 while the existing build-and-push.yaml workflow uses actions/checkout@v4. These should use the same version for consistency across the repository's CI workflows.
| runs-on: ubuntu-latest | ||
| needs: build | ||
| steps: | ||
| - uses: actions/checkout@v6 |
Copilot
AI
Jan 11, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ci.yml workflow uses actions/checkout@v6 while the existing build-and-push.yaml workflow uses actions/checkout@v4. These should use the same version for consistency across the repository's CI workflows.
Related Issue
fix #116
Details
Adds GitHub CI workflow to test docker image builds.
Helps ensure repo changes build and are tested against a sample SPFx project:
linux/amd64linux/arm64/v8See example runs:
GitHub Docker Report example (build) [Click to open]
Docker Build summary
For a detailed look at the build, download the following build record archive and import it into Docker Desktop's Builds view.
Build records include details such as timing, dependencies, results, logs, traces, and other information about a build. Learn more
⬇️ CalvinTPark~docker-spfx~N682B3.dockerbuild (36.43 KB - includes 1 build record)
Find this useful? Let us know
N682B3Build inputs
Bake definition
{ "group": { "default": { "targets": [ "default" ] } }, "target": { "default": { "context": ".", "dockerfile": "Dockerfile", "tags": [ "docker.io/m365pnp/spfx:latest", "docker.io/m365pnp/spfx:online" ], "cache-from": [ { "scope": "dockerspfx", "type": "gha" } ], "cache-to": [ { "mode": "max", "scope": "dockerspfx", "type": "gha" } ], "target": "default", "platforms": [ "linux/amd64", "linux/arm64/v8" ] } } }GitHub Docker Report example (test) [Click to open]
Docker Build summary
For a detailed look at the build, download the following build record archive and import it into Docker Desktop's Builds view.
Build records include details such as timing, dependencies, results, logs, traces, and other information about a build. Learn more
⬇️ CalvinTPark~docker-spfx~0RMDXK.dockerbuild (74.39 KB - includes 1 build record)
Find this useful? Let us know
0RMDXKBuild inputs
Bake definition
{ "group": { "default": { "targets": [ "test" ] } }, "target": { "test": { "context": ".", "dockerfile": "Dockerfile", "cache-from": [ { "scope": "dockerspfx", "type": "gha" } ], "cache-to": [ { "mode": "max", "scope": "dockerspfx", "type": "gha" } ], "platforms": [ "linux/amd64", "linux/arm64/v8" ], "output": [ { "type": "cacheonly" } ] } } }