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
I find that in some case you may prefer to persist your build caches, bash history, etc... inside a local folder instead of inside a volume.
The following approach keeps a subset of cache or history in each project on the local disk.
requirements:
For this feature you will have to mount your project inside your devcontanier at the same position as it is on your host.
This is mandatory to not lose the data if the devcontainer is rebuild.
Thus, if the devcontainer is destroyed or rebuilt or if the docker volumes are removed the project specific build caches and bash history data will not be lost. They will still be
use onCreateCmd:
Add the following in .devcontainer/devcontainers.json:
Just open a Codespace container directly on GitHub or checkout the project locally to use your host.
Github Codespace
Keep in mind that here the persistence will occur in the current project checkout host. As it is a VM the data may be lost if this host is changed. However this is changing nothing as it is also the case if the data were kept inside a docker volume if the docker instance is renewed. So this is not a real warn, just an observation :)
The text was updated successfully, but these errors were encountered:
Hello,
I find that in some case you may prefer to persist your build caches, bash history, etc... inside a local folder instead of inside a volume.
The following approach keeps a subset of cache or history in each project on the local disk.
requirements:
use
onCreateCmd
:Add the following in
.devcontainer/devcontainers.json
:And now create a script
.devcontainer/on-create-cmd.sh
:Do not forget to add execution rights for your script:
Result inside the devcontainer
gitignore
As you can see now the project go build caches, vscode-extensions and bash history are generated inside the project path itself on your local disk.
I recommend that you finally add the following lines to
.devcontainer/.gitignore
to keep those file from versioning:Working example:
You can view a working example of this on one of my personal test project: https://github.com/7d4b9/utrade/tree/dev/.devcontainer
Just open a Codespace container directly on GitHub or checkout the project locally to use your host.
Github Codespace
Keep in mind that here the persistence will occur in the current project checkout host. As it is a VM the data may be lost if this host is changed. However this is changing nothing as it is also the case if the data were kept inside a docker volume if the docker instance is renewed. So this is not a real warn, just an observation :)
The text was updated successfully, but these errors were encountered: