Skip to content

Commit

Permalink
chore: fix devcontainer to have foundry installed
Browse files Browse the repository at this point in the history
  • Loading branch information
mariocao committed Jul 24, 2024
1 parent 720aaf2 commit 48623ad
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 73 deletions.
5 changes: 3 additions & 2 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ RUN apt-get update \
# Tools
RUN apt-get -y install --no-install-recommends vim git

RUN curl -L https://foundry.paradigm.xyz | bash
RUN source /home/vscode/.bashrc && foundryup
# Foundry (already added to postCreateCommand)
# RUN curl -L https://foundry.paradigm.xyz | bash
# RUN source ~/.bashrc && foundryup
142 changes: 71 additions & 71 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,72 +1,72 @@
{
"name": "seda-evm-contracts",
"dockerComposeFile": "docker-compose.yml",
"service": "vscode",
"workspaceFolder": "/workspace",
// Comment the next line if you want to keep your containers running after VS Code shuts down.
"shutdownAction": "stopCompose",
"features": {
"ghcr.io/devcontainers/features/common-utils:1": {
"installZsh": "true",
"username": "vscode",
"uid": "1000",
"gid": "1000",
"upgradePackages": "true"
},
"ghcr.io/devcontainers/features/rust:1": "latest",
"ghcr.io/devcontainers/features/git:1": {
"version": "latest",
"ppa": "false"
}
},
"overrideFeatureInstallOrder": [
"ghcr.io/devcontainers/features/common-utils"
],
// Allow dubious ownership in GIT repository
"postStartCommand": "git config --global --add safe.directory $PWD",
// Configure tool-specific properties.
"customizations": {
// Configure properties specific to VS Code.
"vscode": {
// Set *default* container specific settings.json values on container create.
"settings": {
"lldb.executable": "/usr/bin/lldb",
// VS Code don't watch files under ./target
"files.watcherExclude": {
"**/target/**": true
},
"rust-analyzer.checkOnSave.command": "clippy",
"rust-analyzer.rustfmt.extraArgs": [
"+nightly"
],
"[rust]": {
"editor.defaultFormatter": "rust-lang.rust-analyzer",
"editor.formatOnSave": true
}
},
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"vadimcn.vscode-lldb",
"mutantdino.resourcemonitor",
"rust-lang.rust-analyzer",
"tamasfe.even-better-toml",
"serayuzgur.crates",
"Tyriar.sort-lines",
"2gua.rainbow-brackets",
"oderwat.indent-rainbow",
"dtsvet.vscode-wasm",
"JuanBlanco.solidity"
]
}
},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "rustc --version",
// Set `remoteUser` to `root` to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode",
"mounts": [
"source=${localWorkspaceFolderBasename}-target,target=${containerWorkspaceFolder}/target,type=volume"
],
"postCreateCommand": "sudo chown vscode target"
}
"name": "seda-evm-contracts",
"dockerComposeFile": "docker-compose.yml",
"service": "vscode",
"workspaceFolder": "/workspace",
// Comment the next line if you want to keep your containers running after VS Code shuts down.
"shutdownAction": "stopCompose",
"features": {
"ghcr.io/devcontainers/features/common-utils:1": {
"installZsh": "true",
"username": "vscode",
"uid": "1000",
"gid": "1000",
"upgradePackages": "true"
},
"ghcr.io/devcontainers/features/rust:1": "latest",
"ghcr.io/devcontainers/features/git:1": {
"version": "latest",
"ppa": "false"
}
},
"overrideFeatureInstallOrder": [
"ghcr.io/devcontainers/features/common-utils"
],
// Allow dubious ownership in GIT repository
"postStartCommand": "git config --global --add safe.directory $PWD",
// Configure tool-specific properties.
"customizations": {
// Configure properties specific to VS Code.
"vscode": {
// Set *default* container specific settings.json values on container create.
"settings": {
"lldb.executable": "/usr/bin/lldb",
// VS Code don't watch files under ./target
"files.watcherExclude": {
"**/target/**": true
},
"rust-analyzer.checkOnSave.command": "clippy",
"rust-analyzer.rustfmt.extraArgs": [
"+nightly"
],
"[rust]": {
"editor.defaultFormatter": "rust-lang.rust-analyzer",
"editor.formatOnSave": true
}
},
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"EditorConfig.EditorConfig",
"vadimcn.vscode-lldb",
"mutantdino.resourcemonitor",
"rust-lang.rust-analyzer",
"tamasfe.even-better-toml",
"serayuzgur.crates",
"Tyriar.sort-lines",
"oderwat.indent-rainbow",
"dtsvet.vscode-wasm",
"NomicFoundation.hardhat-solidity"
]
}
},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "rustc --version",
// Set `remoteUser` to `root` to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode",
"mounts": [
"source=${localWorkspaceFolderBasename}-target,target=${containerWorkspaceFolder}/target,type=volume"
],
"postCreateCommand": "bash ./.devcontainer/postCreateCommand.sh"
}
13 changes: 13 additions & 0 deletions .devcontainer/postCreateCommand.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash

set -ex

sudo chown vscode target

# Foundry Install
curl -L https://foundry.paradigm.xyz/ | bash
/home/vscode/.foundry/bin/foundryup

# Update path
echo export PATH=\"$PATH:/home/vscode/.foundry/bin >> ~/.bashrc
echo export PATH=$PATH:/home/vscode/.foundry/bin >> ~/.zshrc

0 comments on commit 48623ad

Please sign in to comment.