stages:
  - build
  - deploy

build:
  stage: build
  image: docker:stable
  services:
    - docker:dind
  variables:
    DOCKER_HOST: tcp://docker:2375/
    DOCKER_DRIVER: overlay2
  script:
    - docker login -u $DOCKERHUBUSER -p $DOCKERHUBPASSWORD docker.io
    - docker build --tag=l1ll1/tes .
    - docker push l1ll1/tes:latest
  tags:
    - build_tes

deploy_test:
  stage: deploy
  only:
    - testing@hpc-team/strudelv2_spa
  tags: 
    - deploy_test
  script:
    - echo "deploying test"
  dependencies:
    - build

deploy_dev:
  stage: deploy
  tags: 
    - deploy_dev
  variables:
    DOCKER_HOST: unix:///var/run/docker.sock
  script:
    - echo "deploying dev"
    - docker login -u $DOCKERHUBUSER -p $DOCKERHUBPASSWORD docker.io
    - docker pull l1ll1/tes:latest
    - docker run -p 8080:8080 l1ll1/tes:latest
  dependencies:
    - build
