-
Notifications
You must be signed in to change notification settings - Fork 28
Feat docker devcontainer #154
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| { | ||
| "name": "dev", | ||
| "image": "mcr.microsoft.com/devcontainers/base:debian", | ||
| "customizations": { | ||
| "vscode": { | ||
| "extensions": [ | ||
| "StarkWare.cairo1", | ||
| "tamasfe.even-better-toml", | ||
| "rust-lang.rust-analyzer" | ||
| ] | ||
| } | ||
| }, | ||
| "features": { | ||
| "ghcr.io/devcontainers/features/rust:1": { | ||
| "version": "stable" | ||
| } | ||
| }, | ||
| "postCreateCommand": "bash .devcontainer/install-tools.sh", | ||
| "remoteUser": "vscode" | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,30 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #!/usr/bin/env bash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| set -e | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "🚀 Setting up development environment..." | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Install dependencies | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| apt-get update && apt-get install -y curl git build-essential | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Apt commands will fail under non-root remoteUser postCreateCommand runs as the “vscode” user; calling apt-get without sudo will fail. Use sudo and noninteractive flags. -apt-get update && apt-get install -y curl git build-essential
+sudo apt-get update -y
+sudo DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends curl git build-essential
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Install asdf | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.14.0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo '. "$HOME/.asdf/asdf.sh"' >> ~/.bashrc | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo '. "$HOME/.asdf/completions/asdf.bash"' >> ~/.bashrc | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| . ~/.asdf/asdf.sh | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+11
to
+15
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Make asdf install idempotent and avoid .bashrc duplication Guard clone, avoid appending duplicate lines, and quiet ShellCheck for sourcing. -# Install asdf
-git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.14.0
-echo '. "$HOME/.asdf/asdf.sh"' >> ~/.bashrc
-echo '. "$HOME/.asdf/completions/asdf.bash"' >> ~/.bashrc
-. ~/.asdf/asdf.sh
+# Install asdf (idempotent)
+if [ ! -d "$HOME/.asdf" ]; then
+ git clone https://github.com/asdf-vm/asdf.git "$HOME/.asdf" --branch v0.14.0
+fi
+grep -qxF '. "$HOME/.asdf/asdf.sh"' "$HOME/.bashrc" || echo '. "$HOME/.asdf/asdf.sh"' >> "$HOME/.bashrc"
+grep -qxF '. "$HOME/.asdf/completions/asdf.bash"' "$HOME/.bashrc" || echo '. "$HOME/.asdf/completions/asdf.bash"' >> "$HOME/.bashrc"
+# shellcheck disable=SC1090
+. "$HOME/.asdf/asdf.sh"📝 Committable suggestion
Suggested change
🧰 Tools🪛 Shellcheck (0.10.0)[warning] 14-14: ShellCheck can't follow non-constant source. Use a directive to specify location. (SC1090) 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Add and install plugins | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| asdf plugin add scarb || true | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| asdf install scarb 2.10.1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| asdf global scarb 2.10.1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| asdf plugin add dojo https://github.com/dojoengine/asdf-dojo || true | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| asdf install dojo 1.5.0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| asdf global dojo 1.5.0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| asdf plugin add starknet-foundry || true | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| asdf install starknet-foundry 0.35.0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| asdf global starknet-foundry 0.35.0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+17
to
+27
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Avoid masking real failures with Fail fast if a plugin is unavailable, and keep installs DRY with variables. -# Add and install plugins
-asdf plugin add scarb || true
-asdf install scarb 2.10.1
-asdf global scarb 2.10.1
-
-asdf plugin add dojo https://github.com/dojoengine/asdf-dojo || true
-asdf install dojo 1.5.0
-asdf global dojo 1.5.0
-
-asdf plugin add starknet-foundry || true
-asdf install starknet-foundry 0.35.0
-asdf global starknet-foundry 0.35.0
+# Add and install plugins
+SCARB_VERSION=2.10.1
+DOJO_VERSION=1.5.0
+SNF_VERSION=0.35.0
+
+ensure_plugin() {
+ local name="$1"; shift
+ if ! asdf plugin list | grep -qx "$name"; then
+ asdf plugin add "$name" "$@"
+ fi
+}
+
+ensure_plugin scarb
+asdf install scarb "${SCARB_VERSION}"
+asdf global scarb "${SCARB_VERSION}"
+
+ensure_plugin dojo https://github.com/dojoengine/asdf-dojo
+asdf install dojo "${DOJO_VERSION}"
+asdf global dojo "${DOJO_VERSION}"
+
+ensure_plugin starknet-foundry
+asdf install starknet-foundry "${SNF_VERSION}"
+asdf global starknet-foundry "${SNF_VERSION}"
+
+asdf reshim📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "✅ Environment ready!" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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.
🛠️ Refactor suggestion
Harden shell options
Prefer strict mode to surface errors early.
🤖 Prompt for AI Agents