You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+55-8Lines changed: 55 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,14 +21,12 @@ You can read more about the importance of sandboxing, containers vs VMs, and mor
21
21
-[Quickstart - VSCode and Foundry on a new project, unmounted](#quickstart---vscode-and-foundry-on-a-new-project-unmounted)
22
22
-[Usage](#usage)
23
23
-[VSCode](#vscode)
24
+
-[Unmounted](#unmounted)
24
25
-[Mounted](#mounted)
25
26
-[Using on an existing project](#using-on-an-existing-project)
26
27
-[Raw Docker](#raw-docker)
27
28
-[Mounted](#mounted-1)
28
29
-[Using on an existing project](#using-on-an-existing-project-1)
29
-
-[Adding new projects](#adding-new-projects)
30
-
-[Adding new tools/Dockerfiles/containers](#adding-new-toolsdockerfilescontainers)
31
-
-[License](#license)
32
30
-[Acknowledgements](#acknowledgements)
33
31
34
32
## Why are dev containers important?
@@ -91,7 +89,7 @@ cd web3-dev-containers
91
89
92
90
## Quickstart - VSCode and Foundry on a new project, unmounted
93
91
94
-
Please see [VSCode](#VSCode) or [Raw Docker](#Raw-Docker) for more detailed instructions.
92
+
Please see [VSCode](#VSCode) or [Raw Docker](#Raw-Docker) for more instructions.
95
93
96
94
> **Note**
97
95
> `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.
@@ -157,22 +155,71 @@ This will delete all traces of the code you worked on in that container!
157
155
158
156
## VSCode
159
157
160
-
Please see the [Quickstart](#Quickstart---VSCode-and-Foundry-on-a-new-project) for a quick guide on how to use this with VSCode on a new project.
158
+
### Unmounted
159
+
160
+
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.
161
161
162
162
### Mounted
163
163
164
+
If you want to persist your code changes back to your host machine, take these steps instead of what you saw in the quickstart:
165
+
166
+
1. Open the `foundry/mounted` folder in VSCode
167
+
2. Run `Dev Containers: Reopen in Container` from the command palette
168
+
3. Work in the `projects` folder - any changes here will be saved to your host machine
169
+
4. The container will still protect you from malicious scripts, but be careful what you save back to your machine
170
+
171
+
> **Note**
172
+
> 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!
173
+
164
174
### Using on an existing project
165
175
176
+
To use these containers with an existing project:
177
+
178
+
1. Copy the `.devcontainer` folder to your project (mounted or unmounted):
// 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;zsh"
47
+
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// 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;zsh"
49
+
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
0 commit comments