Model/.devcontainer/backend/docker-compose.yml
Jun-te Kim 18ad879f00 devcontainer: use dynamic host ports so worktrees don't collide
Publish container ports without a fixed host side in the backend and
asset_list compose files, and switch forwardPorts to service-qualified
form. Lets a second worktree's devcontainer spin up without conflicting
on host 8000/5432 (backend) or 8081 (asset_list), matching the pattern
in assessment-model-sales-frontend.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-08 13:53:22 +00:00

57 lines
No EOL
1.6 KiB
YAML

version: '3.8'
services:
model-backend:
build:
context: ../..
dockerfile: .devcontainer/backend/Dockerfile
args:
USER_UID: ${UID:-1000}
USER_GID: ${GID:-1000}
command: sleep infinity
ports:
# Host port left unspecified so Docker assigns a free one — lets multiple
# worktrees of this repo run at once without colliding. VS Code's
# forwardPorts (in devcontainer.json) forwards container :8000 to your machine.
- "8000"
volumes:
- ../../:/workspaces/model
- ~/.gitconfig:/home/vscode/.gitconfig:ro
# GitHub CLI auth from host (created by `gh auth login`). Used by the
# postCreate skill installer to clone private Hestia-Homes repos.
- ~/.config/gh:/home/vscode/.config/gh:ro
environment:
- SSH_AUTH_SOCK=${SSH_AUTH_SOCK:-}
# Fallback HTTPS auth if ~/.config/gh isn't present on the host.
- GITHUB_TOKEN=${GITHUB_TOKEN:-}
networks:
- backend-net
- shared-dev
db:
image: postgres:17.4
restart: unless-stopped
ports:
# Dynamic host port (see model-backend above) so a second worktree's db
# doesn't collide on 5432. Reach it from inside the container via host
# "db:5432"; from your machine, use the forwarded port VS Code reports.
- "5432"
environment:
- PGDATABASE=tech_team_local_db
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=makingwarmerhomes
volumes:
- postgres-data-two:/var/lib/postgresql/data
networks:
- backend-net
networks:
backend-net:
driver: bridge
shared-dev:
external: true
volumes:
postgres-data-two: