From 3deaaba71faccb74088d4971031a65a7178a1c98 Mon Sep 17 00:00:00 2001 From: "Yuichiro Tachibana (Tsuchiya)" Date: Mon, 16 Sep 2024 04:14:46 +0100 Subject: [PATCH] Devcontainer (#1119) * 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 --- .devcontainer/devcontainer.json | 32 ++++++++++++++++++++++++++++++ .devcontainer/postCreateCommand.sh | 10 ++++++++++ .github/dependabot.yml | 4 ++++ packages/sharing/package.json | 2 +- 4 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 .devcontainer/devcontainer.json create mode 100644 .devcontainer/postCreateCommand.sh diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 000000000..42b54e366 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -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" + } +} diff --git a/.devcontainer/postCreateCommand.sh b/.devcontainer/postCreateCommand.sh new file mode 100644 index 000000000..1ac531738 --- /dev/null +++ b/.devcontainer/postCreateCommand.sh @@ -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 diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 5c857bab3..dd899592e 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -12,3 +12,7 @@ updates: directory: "/packages/kernel/py/stlite-lib" schedule: interval: "daily" + - package-ecosystem: "devcontainers" + directory: "/" + schedule: + interval: weekly diff --git a/packages/sharing/package.json b/packages/sharing/package.json index 17b50784d..6babc93d9 100644 --- a/packages/sharing/package.json +++ b/packages/sharing/package.json @@ -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"