Browse Source

improve dome build workflow

wangweimin 3 years ago
parent
commit
79b5c8a0f6
1 changed files with 10 additions and 5 deletions
  1. 10 5
      .drone.yml

+ 10 - 5
.drone.yml

@@ -22,9 +22,14 @@ steps:
       - git log -1
   - 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 -v $PWD:/app_tmp
-        --label="traefik.http.services.pywebiodemos.loadbalancer.server.port=80"
-        -d python:3 bash -c "cp -r /app_tmp /app && cd /app && pip3 install . && pip3 install -r requirements.txt && python3 demos/__main__.py --port=80"
-      - sleep 5  # wait container start
+      - docker run --restart=always --name=pywebio-demos -d pywebio