Skip to content

Commit

Permalink
WIP: devcontainer walkthrough.
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchdenny committed Oct 25, 2024
1 parent bfab2be commit ae8b6c3
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 15 deletions.
37 changes: 23 additions & 14 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,43 +15,52 @@
}
},

"containerEnv": {
"DOTNET_ROOT": "/workspaces/aspire/.dotnet"
},

// 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": [
15887, // playground/waitfor/WaitForSandbox.AppHost
5180, // playground/waitfor/WaitForSandbox.ApiService
7024 // playground/waitfor/WaitFor.Frontend
15887, // playground/waitfor AppHost
5180, // playground/waitfor ApiService
7024, // playground/waitfor Frontend
15551 // playground/waitfor PGAdmin
],
"portsAttributes": {
"15887": {
"label": "WaitForSandbox.AppHost",
"label": "WaitFor Playground: AppHost",
"protocol": "https"
},
"5180": {
"label": "WaitForSandbox.ApiService",
"label": "WaitFor Playground: ApiService",
"protocol": "http"
},
"7024": {
"label": "WaitFor.Frontend",
"label": "WaitFor Playground: Frontend",
"protocol": "https"
},
"15551": {
"label": "WaitFor Playground: PGAdmin",
"protocol": "http"
}
},
"otherPortsAttributes": {
"onAutoForward": "ignore"
},

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "rm -rf .dotnet && sudo chmod +x dotnet.sh && ./dotnet.sh restore",
"customizations": {
"vscode": {
"extensions": [
"ms-dotnettools.csdevkit"
]
"ms-dotnettools.csdevkit",
"ms-azuretools.vscode-bicep",
"ms-azuretools.azure-dev"
],
"settings": {
"remote.autoForwardPorts": false
}
}
}
},
"postStartCommand": "dotnet dev-certs https --trust"

// Configure tool-specific properties.
// "customizations": {},
Expand Down
10 changes: 9 additions & 1 deletion playground/waitfor/WaitForSandbox.AppHost/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,15 @@
.WithPasswordAuthentication()
.RunAsContainer(c =>
{
c.WithPgAdmin();
c.WithPgAdmin(c =>
{
c.WithHostPort(15551);
// Variables that we are going to need to set when we detect that
// we are run run mode with codespaces.
c.WithEnvironment("PGADMIN_CONFIG_PROXY_X_HOST_COUNT", "1");
c.WithEnvironment("PGADMIN_CONFIG_PROXY_X_PREFIX_COUNT", "1");
});
})
.AddDatabase("db");

Expand Down

0 comments on commit ae8b6c3

Please sign in to comment.