stages:
  - build
  - deploy
image: docker:stable
services:
  - docker:dind
variables:
  DOCKER_HOST: tcp://docker:2375/
  DOCKER_DRIVER: overlay2

build:
  stage: build
  script:
    - docker login -u $DOCKERHUBUSER -p $DOCKERHUBPASSWORD docker.io
    - docker build --tag=l1ll1/tes .
    - docker push l1ll1/tes:latest

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
  script:
    - echo "deploying dev"
    - docker login -u $DOCKERHUBUSER -p $DOCKERHUBPASSWORD docker.io
    - sudo docker pull l1ll1/tes:latest
    - sudo docker run -p 8080:8080 l1ll1/tes:latest
  dependencies:
    - build
