version: "3.9" services: backend-py: container_name: backend-py env_file: - .env depends_on: database: condition: service_healthy build: context: backend-py target: backend-py ports: - "${FLASK_RUN_PORT}:${FLASK_RUN_PORT}" # Watch and react to changes in local... volumes: # backend-py/src directory - type: bind source: ./backend-py/src target: /backend-py/src # data directory - type: bind source: ./data target: /data backend-ts: container_name: backend-ts env_file: - .env depends_on: database: condition: service_healthy build: context: backend-ts target: backend-ts ports: - "${EXPRESS_LISTEN_PORT}:${EXPRESS_LISTEN_PORT}" # Watch and react to changes in local... volumes: # backend-ts/src directory - type: bind source: ./backend-ts/src target: /backend-ts/src # data directory - type: bind source: ./data target: /data frontend: container_name: frontend env_file: - .env build: context: frontend target: frontend ports: - "${REACT_APP_PORT}:3000" # Watch and react to changes in local... volumes: # frontend/src directory - type: bind source: ./frontend/src target: /frontend/src # data directory - type: bind source: ./data target: /data database: container_name: database env_file: - .env build: context: data target: database healthcheck: test: ["CMD-SHELL", "pg_isready"] start_period: 10s interval: 10s retries: 5 timeout: 5s ports: - "${DB_PORT}:5432" volumes: # Create a managed docker volume to persist data if the container shuts down - db:/var/lib/postgresql/data # Watch and react to changes in local data directory - type: bind source: ./data target: /data test-database: container_name: test-database env_file: - .env environment: POSTGRES_HOST_AUTH_METHOD: trust image: postgres:14.2 ports: - "${TEST_DB_PORT}:5432" volumes: db: