|
| 1 | +// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: |
| 2 | +// https://github.com/microsoft/vscode-dev-containers/tree/v0.209.6/containers/ubuntu |
| 3 | +{ |
| 4 | + "name": "Codespace Workstation", |
| 5 | + "build": { |
| 6 | + "dockerfile": "../Dockerfile", |
| 7 | + "target": "codespace-workstation", |
| 8 | + // NOTE: by using 'cacheFrom' here we will be able to reuse |
| 9 | + // the Docker layers from previous devcontainer builds! |
| 10 | + "cacheFrom": "ghcr.io/reboot-dev/mono/workstation" |
| 11 | + }, |
| 12 | + "customizations": { |
| 13 | + "vscode": { |
| 14 | + // Set *default* container specific settings.json values on container create. |
| 15 | + "settings": {}, |
| 16 | + |
| 17 | + // Add the IDs of extensions you want installed when the container is created. |
| 18 | + "extensions": [ |
| 19 | + // Bazel makes VS Code aware of BUILD file syntax and tools. |
| 20 | + "BazelBuild.vscode-bazel", |
| 21 | + // Make VS Code respect .editorconfig files. |
| 22 | + "EditorConfig.EditorConfig", |
| 23 | + // Enable GitHub Copilot. |
| 24 | + "GitHub.copilot", |
| 25 | + // GitHub Pull Requests allows PR reviewers and authors to see and reply |
| 26 | + // to review comment in VS Code. |
| 27 | + "GitHub.vscode-pull-request-github", |
| 28 | + // Python support. |
| 29 | + "ms-python.python", |
| 30 | + // Python type checking. |
| 31 | + "ms-python.mypy-type-checker", |
| 32 | + // Automatically do import sorting in Python. |
| 33 | + "ms-python.isort", |
| 34 | + // C++ support. |
| 35 | + "ms-vscode.cpptools", |
| 36 | + // Additional C++ support. |
| 37 | + "ms-vscode.cpptools-extension-pack", |
| 38 | + // Use clang-format to format files. |
| 39 | + "xaver.clang-format", |
| 40 | + // Open in GitHub: provides links to open the current file + line number in GitHub. |
| 41 | + "ziyasal.vscode-open-in-github", |
| 42 | + // Protocol buffer support. |
| 43 | + "zxh404.vscode-proto3", |
| 44 | + // Spell checker. |
| 45 | + "streetsidesoftware.code-spell-checker", |
| 46 | + // Add autotmatic line/comment wrapper. |
| 47 | + "stkb.rewrap", |
| 48 | + // Prettier code formatter. |
| 49 | + "esbenp.prettier-vscode", |
| 50 | + // YAPF code formatter. |
| 51 | + "eeyore.yapf" |
| 52 | + ] |
| 53 | + } |
| 54 | + }, |
| 55 | + // Use 'forwardPorts' to make a list of ports inside the container available locally. |
| 56 | + "forwardPorts": [ |
| 57 | + // The HTTP port exposed by default in examples. |
| 58 | + 3000, |
| 59 | + // The gRPC backend port exposed by default in examples. |
| 60 | + 9991 |
| 61 | + ], |
| 62 | + // Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. |
| 63 | + "remoteUser": "vscode", |
| 64 | + "features": { |
| 65 | + // We need to be able to run docker-in-docker. Docker-on-docker is not enough; that would mean we |
| 66 | + // need to completely change the paths that we use for volume bindings. |
| 67 | + // |
| 68 | + // Keeping this feature here would increase the first boot time of our |
| 69 | + // Codespaces, but that's not user-visible since this happens during |
| 70 | + // Codespace Prebuilds: see |
| 71 | + // https://github.com/reboot-dev/mono/issues/107 . It would be even |
| 72 | + // better to move this installation functionality to the Dockerfile, |
| 73 | + // but that's complicated. |
| 74 | + // https://github.com/microsoft/vscode-dev-containers/blob/main/script-library/docs/docker-in-docker.md |
| 75 | + "ghcr.io/devcontainers/features/docker-in-docker:2": { |
| 76 | + "version": "latest" |
| 77 | + }, |
| 78 | + // GitHub recently changed their default to no longer install sshd by default. |
| 79 | + // See: https://github.com/cli/cli/issues/5739. We now need to add it in |
| 80 | + // explicitly. |
| 81 | + "ghcr.io/devcontainers/features/sshd:1": { |
| 82 | + "version": "latest" |
| 83 | + } |
| 84 | + }, |
| 85 | + // Specify a minimum machine size for Codespaces to work reasonably: |
| 86 | + // https://docs.github.com/en/codespaces/setting-up-your-project-for-codespaces/setting-a-minimum-specification-for-codespace-machines#setting-a-minimum-machine-specification |
| 87 | + "hostRequirements": { |
| 88 | + // k3d commands easily run out of disk with only 64GB of storage: |
| 89 | + // request at least 128GB. As of Apr 2022, the only machines with this |
| 90 | + // much storage are the expensive 16-core machines, but only specify |
| 91 | + // storage because that's our only hard constraint. |
| 92 | + // TODO(alexmc): Can we reduce disk usage to reduce machine |
| 93 | + // requirements? See https://github.com/reboot-dev/mono/issues/134 . |
| 94 | + "storage": "128gb" |
| 95 | + }, |
| 96 | + "containerEnv": { |
| 97 | + // Pass on variable 'RESPECT_DEVCONTAINER_YML' so that |
| 98 | + // we can skip steps that we intend only when using Codespaces. |
| 99 | + "RESPECT_DEVCONTAINER_YML": "${localEnv:RESPECT_DEVCONTAINER_YML:false}", |
| 100 | + // Pass on 'GCP_REMOTE_CACHE_CREDENTIALS_BASE64' so that we |
| 101 | + // can run any builds that might need the remote cache. |
| 102 | + "GCP_REMOTE_CACHE_CREDENTIALS_BASE64": "${localEnv:GCP_REMOTE_CACHE_CREDENTIALS_BASE64}", |
| 103 | + // Export a file path that contains credentials that can be used to |
| 104 | + // access a Google Cloud Storage bucket which we use as a remote |
| 105 | + // `bazel` cache to speed up builds. |
| 106 | + // The credentials file will be populated using a combination of secrets |
| 107 | + // and the `updateContentCommand` below. |
| 108 | + // As it turns out, we can not export this variable inside the script |
| 109 | + // or on the "command line", so we do it here. |
| 110 | + "GOOGLE_APPLICATION_CREDENTIALS": "/home/vscode/google_application_credentials.json" |
| 111 | + }, |
| 112 | + // The below lifecycle hooks refer to lifecycle events documented here: |
| 113 | + // https://code.visualstudio.com/docs/remote/devcontainerjson-reference#_lifecycle-scripts |
| 114 | + // https://docs.github.com/en/codespaces/developing-in-codespaces/codespaces-lifecycle |
| 115 | + // https://docs.github.com/en/codespaces/prebuilding-your-codespaces/configuring-prebuilds#configuring-time-consuming-tasks-to-be-included-in-the-prebuild |
| 116 | + // oncreateCommand runs inside the container after the Codespace template |
| 117 | + // is created: this happens only once, well before a user is assigned. |
| 118 | + "onCreateCommand": ".devcontainer/on_create.sh", |
| 119 | + // updateContent runs inside the container after repo content is updated |
| 120 | + // with new commits. We use it to build new content so users' builds are |
| 121 | + // mostly incremental. |
| 122 | + "updateContentCommand": ".devcontainer/update_content.sh" |
| 123 | +} |
0 commit comments