image: gitlab/dind

services:
  - docker:dind

stages:
  - deploy front
  - deploy back

deploy-back-job:
  stage: deploy back
  only:
    - back_release
  script:
    - echo "Остановка старого контейнера"
    - docker stop my-bar
    - docker rm my-bar
    - echo "Сборка образа докер"
    - docker build -t my-bar .
    - echo "Запуск докер контейнера"
    - docker run --name my-bar --restart=always -p 8091:8080 -d -e COCKTAIL_PHOTO_PATH=/front/assets/cocktails -v /mnt/sdb1/my-bar-front/build:/front my-bar
    - echo "Деплой завершен"

deploy-front-job:
  stage: deploy front
  only:
    - release_front
  image: node:22.12
  script:
    - cd front
    - npm install
    - npm run build
    - cp -r build /app
    - echo "Деплой завершен"
