Ver código fonte

feat: 添加自动构建

许家凯 2 anos atrás
pai
commit
babd57bbd7
3 arquivos alterados com 42 adições e 8 exclusões
  1. 20 0
      .drone.yml
  2. 18 0
      Dockerfile
  3. 4 8
      main.py

+ 20 - 0
.drone.yml

@@ -0,0 +1,20 @@
+kind: pipeline
+type: kubernetes
+name: deploy
+trigger:
+  ref:
+    - refs/heads/release-*
+steps:
+  - name: build
+    image: registry-vpc.cn-shanghai.aliyuncs.com/winhc-spider/drone-kaniko
+    settings:
+      registry_mirrors: 9s9ylon1.mirror.aliyuncs.com
+      registry: registry-vpc.cn-shanghai.aliyuncs.com
+      skip_tls_verify: true
+      enable_cache: true
+      cache_repo: 192.168.1.7:5000/winhc-spider/competitor_product_analysis
+      username:
+        from_secret: username
+      password:
+        from_secret: password
+      repo: registry-vpc.cn-shanghai.aliyuncs.com/winhc-spider/competitor_product_analysis

+ 18 - 0
Dockerfile

@@ -0,0 +1,18 @@
+#FROM abersh/no-pypoetry as requirements
+
+FROM registry-vpc.cn-shanghai.aliyuncs.com/winhc-spider/python:3.9.15-slim-buster as builder
+
+# ... yourself commands
+#COPY --from=requirements /src/requirements.txt .
+COPY ./requirements.txt .
+RUN pip install  --user -r requirements.txt -i https://pypi.doubanio.com/simple
+
+FROM registry-vpc.cn-shanghai.aliyuncs.com/winhc-spider/python:3.9.15-slim-buster
+COPY --from=builder /root/.local /root/.local
+COPY . /app/cpa/
+# update PATH environment variable
+ENV PATH=/root/.local/bin:/root/.local:$PATH
+WORKDIR /app
+CMD ["python","-m","cpa.main"]
+
+# ... yourself commands

+ 4 - 8
main.py

@@ -3,14 +3,10 @@
 # Press Shift+F10 to execute it or replace it with your code.
 # Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
 
+import sys
+from spider.winhc_job import main as winhc_jab_main
 
-def print_hi(name):
-    # Use a breakpoint in the code line below to debug your script.
-    print(f'Hi, {name}')  # Press Ctrl+F8 to toggle the breakpoint.
-
-
-# Press the green button in the gutter to run the script.
 if __name__ == '__main__':
-    print_hi('PyCharm')
+    print(f"input args: {sys.argv}")
 
-# See PyCharm help at https://www.jetbrains.com/help/pycharm/
+    winhc_jab_main()