variables:
  LOCAL_DIR: public

stages: 
 - build
 - production_deployment


brunch_build:
  stage: build
  image: node
  script:
    - npm i
    - npm run-script build
  artifacts:
    paths:
      - public/*
    expire_in: 3 days


production_deploy: 
  stage: production_deployment
  dependencies:
    - brunch_build
  variables:
    GIT_STRATEGY: none
    NAMESPACE: tls-tracking

  when: manual
  image: alpine/k8s:1.28.2
  script:
  - kubectl config use-context frank/tls-tracking:cumulus-agent
  - kubectl -n $NAMESPACE apply -f kubernetes.yaml
  - kubectl -n $NAMESPACE wait --for=condition=ready pod -l app=tls-tracking
  - kubectl -n $NAMESPACE cp public deploy/tls-tracking-webserver:/var/www/

  environment:
    name: Production
    url: http://tls-tracking.sauerburger.com/

