Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
**/.DS_Store
**/Thumbs.db

.github
assets
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
1 change: 1 addition & 0 deletions .github/workflows/build-and-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,4 @@ jobs:
${{ vars.DOCKER_ORG }}/spfx:${{ env.docker_image_tag_name }}
${{ vars.DOCKER_ORG }}/spfx:latest
${{ vars.DOCKER_ORG }}/spfx:online
target: default
43 changes: 43 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: ci

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6

Copilot AI Jan 11, 2026

Copy link

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.

Copilot uses AI. Check for mistakes.
- uses: docker/setup-buildx-action@v3
with:
cleanup: false
Comment thread
DonKirkham marked this conversation as resolved.
- uses: docker/bake-action@v6.10.0
with:
source: .
targets: default
push: false
set: |
*.cache-from=type=gha,scope=dockerspfx
*.cache-to=type=gha,scope=dockerspfx,mode=max

test:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v6
Comment thread
DonKirkham marked this conversation as resolved.
- uses: docker/setup-buildx-action@v3
with:
cleanup: false
Comment thread
DonKirkham marked this conversation as resolved.
- uses: docker/bake-action@v6.10.0
with:
source: .
targets: test
push: false
set: |
*.cache-from=type=gha,scope=dockerspfx
*.cache-to=type=gha,scope=dockerspfx,mode=max
41 changes: 39 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
FROM node:22.16.0
# ----------------- default (start) -----------------------

FROM node:22.16.0 AS default

EXPOSE 4321 35729

Expand All @@ -16,4 +18,39 @@
RUN npm i --location=global gulp-cli@3 yo pnpm
RUN npm i --location=global @microsoft/generator-sharepoint@1.21.1

CMD /bin/bash
CMD /bin/bash

Check warning on line 21 in Dockerfile

View workflow job for this annotation

GitHub Actions / build

JSON arguments recommended for ENTRYPOINT/CMD to prevent unintended behavior related to OS signals

JSONArgsRecommended: JSON arguments recommended for CMD to prevent unintended behavior related to OS signals More info: https://docs.docker.com/go/dockerfile/rule/json-args-recommended/

Check warning on line 21 in Dockerfile

View workflow job for this annotation

GitHub Actions / test

JSON arguments recommended for ENTRYPOINT/CMD to prevent unintended behavior related to OS signals

JSONArgsRecommended: JSON arguments recommended for CMD to prevent unintended behavior related to OS signals More info: https://docs.docker.com/go/dockerfile/rule/json-args-recommended/

# ----------------- default (end) ---------------------------


# ----------------- test-base (start) -----------------------

FROM default AS test-base

RUN mkdir -p test/.pnpm-store
WORKDIR test

# ----------------- test-base (end) -----------------------


# ----------------- test-webpart (start) ------------------

FROM test-base AS test-webpart

RUN yo @microsoft/sharepoint --component-type webpart \
--solution-name spfx-webpart \
--component-name HelloWorld \
--framework react \
--package-manager pnpm \
Comment thread
DonKirkham marked this conversation as resolved.
--skip-install

WORKDIR spfx-webpart

Comment thread
DonKirkham marked this conversation as resolved.
RUN --mount=type=cache,target=/usr/app/spfx/test/.pnpm-store,sharing=locked \
pnpm install

RUN pnpm build

WORKDIR ..

# ----------------- test-webpart (end) ------------------
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,17 @@ You can also use this image for [Visual Studio development containers](./Develop
- **drop-5**: contains the SharePoint Framework Yeoman generator from the [developer preview drop 5](https://github.com/SharePoint/sp-dev-docs/wiki/Release-Notes-Drop-5)
- **drop-4**: contains the SharePoint Framework Yeoman generator from the [developer preview drop 4](https://github.com/SharePoint/sp-dev-docs/wiki/Release-Notes-Drop-4-and-MDL2)

### Build

```sh
docker buildx build . --target default --tag my-spfx
```

```sh
cd [your project]
docker run -it --rm --name ${PWD##*/} -v $PWD:/usr/app/spfx -p 4321:4321 -p 35729:35729 my-spfx
```

## Known issues

### Unable to write files to disk
Expand Down
23 changes: 23 additions & 0 deletions docker-bake.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
target "default" {
target = "default"
tags = [
"docker.io/m365pnp/spfx:latest",
"docker.io/m365pnp/spfx:online"
]
platforms = [
"linux/amd64",
"linux/arm64/v8"
]
}


target "test" {
targets = [
"test-webpart"
]
Comment thread
DonKirkham marked this conversation as resolved.
output = ["type=cacheonly"]
platforms = [
"linux/amd64",
"linux/arm64/v8"
]
}