version: "2.2"

services:
  cube:
    container_name: birdbox-cube
    image: ${BIRDBOX_CUBEJS_REGISTRY_PATH}cubejs/cube:${BIRDBOX_CUBEJS_VERSION:-latest}
    environment:
      CUBEJS_DB_TYPE: bigquery

      # from env
      CUBEJS_DB_BQ_PROJECT_ID: ${CUBEJS_DB_BQ_PROJECT_ID}
      CUBEJS_DB_BQ_CREDENTIALS: ${CUBEJS_DB_BQ_CREDENTIALS}
      CUBEJS_DB_EXPORT_BUCKET: ${CUBEJS_DB_EXPORT_BUCKET}

      # from test
      CUBEJS_SCHEDULED_REFRESH_DEFAULT: ${CUBEJS_SCHEDULED_REFRESH_DEFAULT}
      CUBEJS_REFRESH_WORKER: ${CUBEJS_REFRESH_WORKER}
      CUBEJS_EXTERNAL_DEFAULT: ${CUBEJS_EXTERNAL_DEFAULT}
      CUBEJS_ROLLUP_ONLY: ${CUBEJS_ROLLUP_ONLY}

      # defaults
      CUBEJS_DEV_MODE: "true"
      CUBEJS_API_SECRET: mysupersecret
      CUBEJS_SCHEMA_PATH: schema
    volumes:
      - ./postgresql/single/cube.js:/cube/conf/cube.js
      - ./postgresql/schema/Orders.js:/cube/conf/schema/Orders.js
      - ./postgresql/schema/OrdersPA.js:/cube/conf/schema/OrdersPA.js
      - ./postgresql/schema/CAST.js:/cube/conf/schema/CAST.js
      - ./postgresql/schema/Customers.js:/cube/conf/schema/Customers.js
      - ./postgresql/schema/Customers.sql.js:/cube/conf/schema/Customers.sql.js
      - ./postgresql/schema/ECommerce.js:/cube/conf/schema/ECommerce.js
      - ./postgresql/schema/ECommerce.sql.js:/cube/conf/schema/ECommerce.sql.js
      - ./postgresql/schema/Products.js:/cube/conf/schema/Products.js
      - ./postgresql/schema/Products.sql.js:/cube/conf/schema/Products.sql.js
    ports:
      - "4000:4000"
    restart: always
