/ .devcontainer / docker-compose.yml
docker-compose.yml
1 version: '3.8' 2 3 services: 4 app: 5 build: 6 context: .. 7 dockerfile: .devcontainer/Dockerfile 8 9 volumes: 10 - ../..:/workspaces:cached 11 12 # Overrides default command so things don't shut down after the process ends. 13 command: sleep infinity 14 15 # Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function. 16 network_mode: service:db 17 18 # Use "forwardPorts" in **devcontainer.json** to forward an app port locally. 19 # (Adding the "ports" property to this file will not forward from a Codespace.) 20 21 db: 22 image: postgres:latest 23 restart: unless-stopped 24 volumes: 25 - postgres-data:/var/lib/postgresql/data 26 environment: 27 POSTGRES_USER: postgres 28 POSTGRES_DB: postgres 29 POSTGRES_PASSWORD: postgres 30 31 # Add "forwardPorts": ["5432"] to **devcontainer.json** to forward PostgreSQL locally. 32 # (Adding the "ports" property to this file will not forward from a Codespace.) 33 34 volumes: 35 postgres-data: