services:
    prisma-storybook:
        build:
            context: .
            dockerfile: ../../infra/visual-tests/Dockerfile.storybook
            args:
                port: 6007
                storybookfolder: storybook-static-visual-prisma
                workdir: /react-ui
        command: npx http-server storybook-static-visual-prisma --port 6007
        ports:
            - "6007:6007"
    enterprise-storybook:
        build:
            context: .
            dockerfile: ../../infra/visual-tests/Dockerfile.storybook
            args:
                port: 6008
                storybookfolder: storybook-static-visual-enterprise
                workdir: /react-ui
        command: npx http-server storybook-static-visual-enterprise --port 6008
        ports:
            - "6008:6008"
    splunk-magnetic-storybook:
        build:
            context: .
            dockerfile: ../../infra/visual-tests/Dockerfile.storybook
            args:
                port: 6009
                storybookfolder: storybook-static-visual-splunk-magnetic
                workdir: /react-ui
        command: npx http-server storybook-static-visual-splunk-magnetic --port 6009
        ports:
            - "6009:6009"
    prisma-visual-test:
        build:
            context: .
            dockerfile: ../../infra/visual-tests/Dockerfile.visual
            args:
                workdir: /react-ui
        env_file:
            - ./.storybook-visual/config/.env.visual
        environment:
            - JEST_IMAGE_SNAPSHOT_TRACK_OBSOLETE=1
            - JOB_BROWSER=${JOB_BROWSER}
        working_dir: /react-ui
        volumes:
            - "./src:/react-ui/src"
            - "./test-reports:/react-ui/test-reports"
            # TODO(SUI-8236): can remove once webpack.test.config.js imports of infra/.config.js are removed as this won't be needed any longer (verify with no cache docker build something else didn't start using it though)
            - "../../infra:/infra:ro"
        depends_on:
            - prisma-storybook
        command: /bin/sh -c "npx wait-on http://prisma-storybook:6007 && yarn cache clean && yarn test-storybook -c .storybook-visual --browsers $${STORYBOOK_BROWSER} $${STORYBOOK_UPDATE_SNAPSHOT} $${STORYBOOK_MAX_WORKERS} --url http://prisma-storybook:6007 --no-index-json"
    enterprise-visual-test:
        build:
            context: .
            dockerfile: ../../infra/visual-tests/Dockerfile.visual
            args:
                workdir: /react-ui
        env_file:
            - ./.storybook-visual/config/.env.visual
        environment:
            - JEST_IMAGE_SNAPSHOT_TRACK_OBSOLETE=1
            - JOB_BROWSER=${JOB_BROWSER}
        working_dir: /react-ui
        volumes:
            - "./src:/react-ui/src"
            - "./test-reports:/react-ui/test-reports"
            # TODO(SUI-8236): can remove once webpack.test.config.js imports of infra/.config.js are removed as this won't be needed any longer (verify with no cache docker build something else didn't start using it though)
            - "../../infra:/infra:ro"
        depends_on:
            - enterprise-storybook
        command: /bin/sh -c "npx wait-on http://enterprise-storybook:6008 && yarn cache clean && yarn test-storybook -c .storybook-visual --browsers $${STORYBOOK_BROWSER} $${STORYBOOK_UPDATE_SNAPSHOT} $${STORYBOOK_MAX_WORKERS} --url http://enterprise-storybook:6008 --no-index-json"
    splunk-magnetic-visual-test:
        build:
            context: .
            dockerfile: ../../infra/visual-tests/Dockerfile.visual
            args:
                workdir: /react-ui
        env_file:
            - ./.storybook-visual/config/.env.visual
        environment:
            - JEST_IMAGE_SNAPSHOT_TRACK_OBSOLETE=1
            - JOB_BROWSER=${JOB_BROWSER}
        working_dir: /react-ui
        volumes:
            - "./src:/react-ui/src"
            - "./test-reports:/react-ui/test-reports"
            # TODO(SUI-8236): can remove once webpack.test.config.js imports of infra/.config.js are removed as this won't be needed any longer (verify with no cache docker build something else didn't start using it though)
            - "../../infra:/infra:ro"
        depends_on:
            - splunk-magnetic-storybook
        command: /bin/sh -c "npx wait-on http://splunk-magnetic-storybook:6009 && yarn cache clean && yarn test-storybook -c .storybook-visual --browsers $${STORYBOOK_BROWSER} $${STORYBOOK_UPDATE_SNAPSHOT} $${STORYBOOK_MAX_WORKERS} --url http://splunk-magnetic-storybook:6009 --no-index-json"
