include:
  - project: gitlab-ci/kubernetes-base
    ref: v5
    file: panter-kubernetes-base.yml

.ensureDocker: &ensureDocker |
  function ensureDockerfile() {
      
    if [ ! -f Dockerfile ]; then
      echo "Creating Dockerfile"
      
      cat > Dockerfile <<EOF
  FROM node:12
  ADD  . /app
  WORKDIR /app
  RUN yarn --production
  EXPOSE 8080
  EOF
    fi

  }

docker-build:
  extends: .docker-build
  before_script:
    - *ensureDocker
    - ensureDockerfile
