diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml index 21855366..b05ce65e 100644 --- a/.devcontainer/docker-compose.yml +++ b/.devcontainer/docker-compose.yml @@ -1,5 +1,3 @@ -version: "3" - services: app: build: @@ -9,27 +7,38 @@ services: volumes: - ..:/workspace:cached - # Overrides default command so things don't shut down after the process ends. + # Keep the development container running. command: sleep infinity - # Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function. + # Start supporting services before the app container. + depends_on: + db: + condition: service_healthy + redis: + condition: service_started + network_mode: service:db db: - image: postgres:latest + image: postgres:17 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.) + healthcheck: + test: ["CMD-SHELL", "pg_isready -U app_user -d app"] + interval: 5s + timeout: 5s + retries: 10 redis: - image: redis + image: redis:7-alpine restart: unless-stopped volumes: