diff --git a/.stignore b/.stignore new file mode 100644 index 00000000..f770f4c1 --- /dev/null +++ b/.stignore @@ -0,0 +1,101 @@ +.git +# Byte-compiled / optimized / DLL files +__pycache__ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build +develop-eggs +dist +downloads +eggs +.eggs +lib +lib64 +parts +sdist +var +wheels +pip-wheel-metadata +share/python-wheels +*.egg-info +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 + +# Flask stuff: +instance +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build + +# PyBuilder +target + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default +ipython_config.py + +# pyenv +.python-version + +# celery beat schedule file +celerybeat-schedule + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env +venv +ENV +env.bak +venv.bak + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mypy +.mypy_cache +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..64a7bf41 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM python:3.8.1 + +RUN mkdir /api +WORKDIR /api + +COPY ./requirements.txt /api/requirements.txt + +RUN pip install -r requirements.txt + +COPY . /api + +CMD uvicorn baiduspider.api.app:app --host=0.0.0.0 diff --git a/deployment.yml b/deployment.yml new file mode 100644 index 00000000..4df9ae7b --- /dev/null +++ b/deployment.yml @@ -0,0 +1,34 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: baiduspider-deploy + labels: + app: baiduspider-app +spec: + selector: + matchLabels: + app: baiduspider-app + replicas: 2 + strategy: + type: RollingUpdate + rollingUpdate: + maxSurge: 1 + maxUnavailable: 0 + template: + metadata: + labels: + app: baiduspider-app + spec: + containers: + - name: baiduspider-app + image: samzhangjy/baiduspider:1.0.0 + imagePullPolicy: Always + ports: + - containerPort: 8000 + resources: + requests: + memory: "64Mi" + cpu: "50m" + limits: + memory: "256Mi" + cpu: "500m" diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..a9895b91 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,9 @@ +version: "3.4" +services: + python: + build: + context: . + container_name: api + image: samzhangjy/baiduspider:1.0.0 + ports: + - 8000:8000 diff --git a/okteto.yml b/okteto.yml new file mode 100644 index 00000000..455d899b --- /dev/null +++ b/okteto.yml @@ -0,0 +1,13 @@ +name: baiduspider +image: okteto/python:3 +command: +- bash +workdir: /okteto +forward: +- 8080:8080 +reverse: +- 9000:9000 +volumes: +- /root/.cache/pip +persistentVolume: + enabled: true diff --git a/service.yml b/service.yml new file mode 100644 index 00000000..634b3996 --- /dev/null +++ b/service.yml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: Service +metadata: + name: baiduspider-service +spec: + type: LoadBalancer + selector: + app: baiduspider-app + ports: + - protocol: TCP + port: 80 + targetPort: 8000 \ No newline at end of file