stages:
  - test

variables:
  DOCKER_TLS_CERTDIR: "/certs"
  DOCKER_HOST: "tcp://docker:2376"
  DOCKER_TLS_VERIFY: "1"
  DOCKER_CERT_PATH: "$DOCKER_TLS_CERTDIR/client"
  DOCKER_DRIVER: overlay2

image: docker:20.10.16

services:
  - name: docker:20.10.16-dind
    command: [
      "--registry-mirror=http://gitlab.prodcontest.ru:5015",
      "--registry-mirror=https://dockerhub.timeweb.cloud",
      "--registry-mirror=https://huecker.io",
    ]

test:
  stage: test
  tags: 
    - backend
  only:
    - master
  before_script:
    - for try in {1..10}; do sleep 0.5; docker info && break ; done
    - echo "$DOCKER_DEPLOY_KEY" | docker login -u "backend" --password-stdin $CI_REGISTRY
    - cd solution && docker-compose up -d
  script:
    - docker run -v $CI_PROJECT_DIR:/app/result --network host gitlab.prodcontest.ru:5050/2025-final-indiv-repos/backend-checker:v1.0
  after_script:
    - docker-compose down
  artifacts:
    paths:
      - total_stats.json
