version: "3"

services:
  common: &common
    image: foundationdb-build:0.0.3
    build:
      context: .
      dockerfile: Dockerfile

  build-setup: &build-setup
    <<: *common
    depends_on: [common]
    volumes:
      - ..:/foundationdb
    working_dir: /foundationdb
    environment:
      - MAKEJOBS=1

  release-setup: &release-setup
    <<: *build-setup
    environment:
      - MAKEJOBS=1
      - RELEASE=true

  snapshot-setup: &snapshot-setup
    <<: *build-setup

  build-docs:
    <<: *build-setup
    command: bash -c 'make -j "$${MAKEJOBS}" docpackage'


  release-packages: &release-packages
    <<: *release-setup
    command: bash -c 'make -j "$${MAKEJOBS}" packages'

  snapshot-packages: &snapshot-packages
    <<: *build-setup
    command: bash -c 'make -j "$${MAKEJOBS}" packages'

  prb-packages:
    <<: *snapshot-packages


  release-bindings: &release-bindings
    <<: *release-setup
    command: bash -c 'make -j "$${MAKEJOBS}" bindings'

  snapshot-bindings: &snapshot-bindings
    <<: *build-setup
    command: bash -c 'make -j "$${MAKEJOBS}" bindings'

  prb-bindings:
    <<: *snapshot-bindings


  shell:
    <<: *build-setup
    volumes:
      - ..:/foundationdb
    entrypoint: /bin/bash
