Efficiently creating a hierarchy of devcontainers #68
-
I have a repository with a primary This is the primary file: {
"name": "All patterns",
"image": "mcr.microsoft.com/devcontainers/dotnet:6.0",
"features": {
"ghcr.io/devcontainers/features/azure-cli:1": {
"installBicep": true,
"extensions": "cosmosdb-preview"
}
},
"containerEnv": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"customizations": {
"vscode": {
"extensions": [
"ms-dotnettools.csharp",
"ms-azuretools.vscode-bicep"
]
}
}
} I'm following the monorepo pattern where we have multiple example patterns in a single repo. The only difference between this primary file and the alternates is the workspace mount. Each alternate mounts to a subfolder so you can focus on a single pattern. Here's an example: {
"name": "Preallocation pattern",
"image": "mcr.microsoft.com/devcontainers/dotnet:6.0",
"workspaceMount": "source=${localWorkspaceFolder},target=/workspace,type=bind",
"workspaceFolder": "/workspace/preallocation/source/",
"updateContentCommand": "dotnet build Cosmos_Patterns_Preallocation.csproj",
"features": {
"ghcr.io/devcontainers/features/azure-cli:1": {
"installBicep": true,
"extensions": "cosmosdb-preview"
}
},
"containerEnv": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"customizations": {
"codespaces": {
"openFiles": [
"readme.md"
]
},
"vscode": {
"settings": {
"git.openRepositoryInParentFolders": "always"
},
"extensions": [
"ms-dotnettools.csharp",
"ms-azuretools.vscode-bicep"
]
}
}
} Overall, it technically works. Unfortunately, I have almost ten patterns and I want to setup pre-builds. This means that we have to rebuild the same image that is mostly the same over and over again saturating the GitHub runners. Is there a more efficient way to do this? Is there a concept of inheritance with devcontainers and prebuilds? Can I use a GitHub action to prebuild most of the image and just use the prebuild runners to apply the mount? Has anyone tried something similar? My "scooby sense" says this is not the best way to do it, but I can't find documentation on a better alternative. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I just realized I posted this in the wrong forum, this is a question for GitHub Codespaces and not DevContainers. Here's the link to the correctly posted discussion: https://github.com/orgs/community/discussions/65602 |
Beta Was this translation helpful? Give feedback.
I just realized I posted this in the wrong forum, this is a question for GitHub Codespaces and not DevContainers.
Here's the link to the correctly posted discussion: https://github.com/orgs/community/discussions/65602