687346022594 — Eddie Barraco 5 years ago
Auto builds
5 files changed, 46 insertions(+), 0 deletions(-)

A => .build.yml
A => Dockerfile
A => cogito2/database/htmlparser.py
A => requirements.txt
A => waitress_server.py
A => .build.yml +21 -0
@@ 0,0 1,21 @@ 
+---
+image: archlinux
+packages:
+  - docker
+  - jq
+secrets:
+  - 42997b90-3718-4c7e-8dfd-b7109c22b366
+environment:
+  DOCKER_USER: 'eluminae'
+sources:
+  - hg+https://hg.sr.ht/~reedwade/cogito2
+tasks:
+  - build: |
+      sudo nohup dockerd --bip 172.18.0.1/16 &
+      sleep 10
+      cat ~/docker_password | sudo docker login -u "$DOCKER_USER" --password-stdin=true
+      cd cogito2
+      sudo docker image build -t eluminae/cogito2:latest ./
+      sudo docker push eluminae/cogito2:latest
+
+# vim:ts=2:sw=2:sts=2

          
A => Dockerfile +9 -0
@@ 0,0 1,9 @@ 
+FROM python:3-alpine
+
+COPY ./ /usr/src/app
+RUN pip install --no-cache-dir -r /usr/src/app/requirements.txt
+
+COPY docker/build/entrypoint.sh /entrypoint
+
+CMD [ "python", "/usr/src/app/waitress_server.py" ]
+

          
A => cogito2/database/htmlparser.py +7 -0
@@ 0,0 1,7 @@ 
+from xml.etree import ElementTree as ET
+
+def get_teasing(html):
+    root = ET.fromstring('<root>' + html + '</root>')
+    for child in root:
+        if 'p' == child.tag:
+            return child.text

          
A => requirements.txt +5 -0
@@ 0,0 1,5 @@ 
+Markdown
+Flask
+pathlib
+wheel
+waitress

          
A => waitress_server.py +4 -0
@@ 0,0 1,4 @@ 
+from waitress import serve
+from cogito2.app import app
+
+serve(app, host='0.0.0.0', port=80)