Copy Paste Board
Pre-requisites:
1 WSL Installed (powershell as admin -> wsl install
2 Docker Installed (download docker desktop and make sure to include wsl options to make your life easier
3 /etc/wsl.conf edited with the lines mentioned in /etc/resolv.conf (and uncomment them)
4 edited /etc/resolv.conf to ensure your dns is working inside wsl/docker (nameserver 8.8.8.8)
5 chmod 640 ~\.bash_history #quick and dirty fix to enable ctrl+r and ctrl+s functions in linux/wsl.
# Start a linux session
wsl
# Create a local folder. Anywhere is fine really. I just prefer to not do it in /mnt/c/Users...
mkdir /usr/src/app1
cd !$
# This last line when pasting will take the previous input from mkdir and then use that designator for the cd command.
# Run the container as the current user of the operating system and mount the local director into it.
docker run -it --rm --name spfx-helloworld -v ${PWD}:/usr/app/spfx -p 4321:4321 -p 35729:35729 --user $(id -u):$(id -g) m365pnp/spfx
# Let's scaffold a project
yo @microsoft/sharepoint
# Choose
# -- Extension
# -- App
# -- Name etc
# By default docker localhost is not bound to 0.0.0.0 interface. The default shipping contents is not meant as install for this docker stuff. So post yo, you need to change some stuff to make it happen.
outside the container
nano config/serve.json
...
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/spfx-serve.schema.json",
"port": 4321,
"https": true,
"serveConfigurations": {
...
---
...
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/spfx-serve.schema.json",
"ipAddress": "0.0.0.0",
"port": 4321,
"https": true,
"serveConfigurations": {
...
# This will enable you to access it on localhost:4321 later as 0.0.0.0:4321 in the container will be made available to your box. (-p 4321:4321)
---
Want VS CODE? Follow: https://github.com/pnp/docker-spfx/blob/master/DevelopmentContainers.md
gulp trust-dev-cert
gulp serve --nobrowser
---
create your code where you want
gulp package-solution --ship