From 23c7c199739a25a5340a24e5b52f03117989ff4c Mon Sep 17 00:00:00 2001 From: Jose Storopoli Date: Sat, 29 Jun 2024 08:20:26 -0300 Subject: [PATCH] chore: update devcontainer mounts better caching with volumes for cargo --- .devcontainer/devcontainer.json | 56 +++++++++++++++------------------ 1 file changed, 26 insertions(+), 30 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 0e8123b..167c67c 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,31 +1,27 @@ -// For format details, see https://aka.ms/devcontainer.json. For config options, see the -// README at: https://github.com/devcontainers/templates/tree/main/src/rust { - "name": "Rust", - // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile - "image": "mcr.microsoft.com/devcontainers/rust:latest", - "features": { - "ghcr.io/devcontainers/features/node:latest": {}, - "ghcr.io/devcontainers/features/docker-in-docker:2": {} - }, - // Use 'mounts' to make the cargo cache persistent in a Docker Volume. - // "mounts": [ - // { - // "source": "devcontainer-cargo-cache-${devcontainerId}", - // "target": "/usr/local/cargo", - // "type": "volume" - // } - // ] - // Features to add to the dev container. More info: https://containers.dev/features. - // "features": {}, - // Use 'forwardPorts' to make a list of ports inside the container available locally. - "forwardPorts": [ - 3000 - ] - // Use 'postCreateCommand' to run commands after the container is created. - // "postCreateCommand": "rustc --version", - // Configure tool-specific properties. - // "customizations": {}, - // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. - // "remoteUser": "root" -} \ No newline at end of file + "name": "Rust", + + "image": "mcr.microsoft.com/devcontainers/rust:latest", + + "features": { + "ghcr.io/devcontainers/features/node:latest": {}, + "ghcr.io/devcontainers/features/docker-in-docker:2": {} + }, + + "mounts": [ + { + "source": "${localEnv:HOME}${localEnv:USERPROFILE}/.config/gh", + "target": "/home/vscode/.config/gh", + "type": "bind" + }, + { + "source": "devcontainer-cargo-cache", + "target": "/usr/local/cargo", + "type": "volume" + } + ], + + "forwardPorts": [ + 3000 + ] +}