kind: pipeline
type: exec
name: default

trigger:
  branch:
  - dev-release
  event:
  - push

steps:
  - name: deploy demos
    commands:
      - |  # https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#pipe-dockerfile-through-stdin
        docker build -t pywebio -f- . <<EOF
        FROM python:3
        WORKDIR /usr/src/app
        ADD ./ .
        RUN pip3 install . && pip3 install --no-cache-dir -r requirements.txt
        EXPOSE 8080
        CMD python3 demos/__main__.py
        EOF
      - docker rm -f pywebio-demos || true
      - docker run --restart=always --name=pywebio-demos -d pywebio
