Skip to content

Commit

Permalink
Devcontainer (#1119)
Browse files Browse the repository at this point in the history
* Create .devcontainer/devcontainer.json

* Update .github/dependabot.yml

* Update .devcontainer/devcontainer.json

* Add hostRequirements

* Update postCreateCommand

* Update

* Update

* Update

* Update

* Set the default value of REACT_APP_EDITOR_APP_ORIGIN in the start script
  • Loading branch information
whitphx committed Sep 16, 2024
1 parent e5dba97 commit 3deaaba
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 1 deletion.
32 changes: 32 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"name": "Stlite",
"image": "mcr.microsoft.com/devcontainers/javascript-node:1-22-bookworm",
"features": {
"ghcr.io/devcontainers/features/python:1": {
"installTools": true,
"version": "3.12.1"
},
"ghcr.io/rocker-org/devcontainer-features/apt-packages:1": {
"packages": "make,protobuf-compiler,libprotobuf-dev"
}
},

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},

"forwardPorts": [3000, 3030],

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "/bin/bash ./.devcontainer/postCreateCommand.sh",

// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"

"hostRequirements": {
"memory": "16gb",
"storage": "16gb"
}
}
10 changes: 10 additions & 0 deletions .devcontainer/postCreateCommand.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
make init

REACT_APP_EDITOR_APP_ORIGIN="https://${CODESPACE_NAME}-3030.app.github.dev"
REACT_APP_SHARING_APP_URL="https://${CODESPACE_NAME}-3000.app.github.dev/"

for file in ~/.zshrc ~/.bashrc; do
echo "" >> $file
echo "export REACT_APP_EDITOR_APP_ORIGIN=${REACT_APP_EDITOR_APP_ORIGIN}" >> $file
echo "export REACT_APP_SHARING_APP_URL=${REACT_APP_SHARING_APP_URL}" >> $file
done
4 changes: 4 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,7 @@ updates:
directory: "/packages/kernel/py/stlite-lib"
schedule:
interval: "daily"
- package-ecosystem: "devcontainers"
directory: "/"
schedule:
interval: weekly
2 changes: 1 addition & 1 deletion packages/sharing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"web-vitals": "^3.5.2"
},
"scripts": {
"start": "cross-env REACT_APP_EDITOR_APP_ORIGIN=http://localhost:3030 BROWSER=none craco start",
"start": "cross-env REACT_APP_EDITOR_APP_ORIGIN=${REACT_APP_EDITOR_APP_ORIGIN:=http://localhost:3030} BROWSER=none craco start",
"build": "craco build",
"test": "craco test",
"eject": "react-scripts eject"
Expand Down

0 comments on commit 3deaaba

Please sign in to comment.