version: "3" services: app: build: context: .. dockerfile: .devcontainer/Dockerfile args: # [Choice] Python version: 3, 3.8, 3.7, 3.6 IMAGE: python:3.10 # On Linux, you may need to update USER_UID and USER_GID below if not your local UID is not 1000. USER_UID: 1000 USER_GID: 1000 volumes: - ..:/workspace:cached # Overrides default command so things don't shut down after the process ends. command: sleep infinity # Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function. network_mode: service:db db: image: postgres:latest restart: unless-stopped volumes: - postgres-data:/var/lib/postgresql/data environment: POSTGRES_DB: app POSTGRES_USER: app_user POSTGRES_PASSWORD: app_password # Add "forwardPorts": ["5432"] to **devcontainer.json** to forward PostgreSQL locally. # (Adding the "ports" property to this file will not forward from a Codespace.) volumes: postgres-data: