// `apf-portal` devcontainer — VSCode Dev Containers spec. // // Pinned Node + pnpm via corepack via the official typescript-node image // (Bookworm base). The container has access to the host docker daemon // through the docker socket (`docker-outside-of-docker` feature), so // `infra/local/dev.sh up` on the HOST creates the postgres/redis/otel // containers and this container connects to them through the shared // `apf-portal-dev` network. // // Workflow: // 1. On the host: ./infra/local/dev.sh up (creates the network) // 2. In VSCode: F1 → "Dev Containers: Reopen in Container" // 3. Inside the container: pnpm exec nx serve portal-bff (connects to postgres:5432) { "name": "apf-portal", "image": "mcr.microsoft.com/devcontainers/typescript-node:1-24-bookworm", "features": { "ghcr.io/devcontainers/features/docker-outside-of-docker:1": {}, "ghcr.io/devcontainers/features/common-utils:2": { "installZsh": false, "configureZshAsDefaultShell": false } }, // `initializeCommand` runs on the HOST before the container starts. // Fail fast if the infra network isn't up — otherwise the BFF would // get connection-refused on every Postgres query inside the container. "initializeCommand": "docker network inspect apf-portal-dev > /dev/null 2>&1 || { echo '❌ Bring up infra first: ./infra/local/dev.sh up' >&2 ; exit 1 ; }", // Attach to the same Compose network as postgres/redis/otel so DNS // resolution (`postgres:5432`) works from inside the container. "runArgs": ["--network=apf-portal-dev"], "forwardPorts": [4200, 4300, 3000, 8081, 16686, 4317, 4318], "portsAttributes": { "4200": { "label": "portal-shell", "onAutoForward": "notify" }, "4300": { "label": "portal-admin", "onAutoForward": "notify" }, "3000": { "label": "portal-bff", "onAutoForward": "notify" }, "8081": { "label": "pgweb", "onAutoForward": "silent" }, "16686": { "label": "jaeger UI", "onAutoForward": "silent" }, "4317": { "label": "otel gRPC", "onAutoForward": "silent" }, "4318": { "label": "otel HTTP", "onAutoForward": "silent" } }, "postCreateCommand": "bash .devcontainer/post-create.sh", "remoteUser": "node", "containerEnv": { // Nx + Angular CLI memory ceiling — 4 GB. Bumping past the default // 2 GB avoids OOM in `nx build` on large monorepos. "NODE_OPTIONS": "--max-old-space-size=4096" }, "customizations": { "vscode": { "extensions": [ "dbaeumer.vscode-eslint", "esbenp.prettier-vscode", "Angular.ng-template", "Prisma.prisma", "ms-azuretools.vscode-docker", "EditorConfig.EditorConfig" ], "settings": { "terminal.integrated.defaultProfile.linux": "bash", "editor.formatOnSave": true, "editor.defaultFormatter": "esbenp.prettier-vscode" } } } }