From 91a32aa8ab379f04457942ef78e8bc18ee74a915 Mon Sep 17 00:00:00 2001 From: Guillem Borrell Date: Sat, 25 May 2024 22:13:21 +0200 Subject: [PATCH] Setting up cicd --- .woodpecker.yml | 9 ++ Dockerfile | 19 +++ requirements.txt | 213 ++++++++++++++++++++++++++++ src/hellocomputer/main.py | 2 +- src/hellocomputer/static/index.html | 34 +++-- 5 files changed, 265 insertions(+), 12 deletions(-) create mode 100644 .woodpecker.yml create mode 100644 Dockerfile create mode 100644 requirements.txt diff --git a/.woodpecker.yml b/.woodpecker.yml new file mode 100644 index 0000000..2c649ef --- /dev/null +++ b/.woodpecker.yml @@ -0,0 +1,9 @@ +pipeline: + build-image: + image: docker + commands: + - docker login -u guillem -p $GITEA_API_KEY + - docker build . -t git.guillemborrell.es/guillem/hellocomputer:0.1 + - docker push git.guillemborrell.es/guillem/hellocomputer:0.1 + volumes: + - /var/run/docker.sock:/var/run/docker.sock \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..1b0ed58 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +# Use an official Python runtime as a parent image +FROM python:3.12-slim + +# Set the working directory in the container to /app +WORKDIR /app + +# Add the current directory contents into the container at /app +ADD . /app + +# Install any needed packages specified in requirements.txt +RUN pip install uv +RUN uv pip install -r requirements.txt +RUN uv pip install -e . + +# Make port 80 available to the world outside this container +EXPOSE 80 + +# Run the command to start uvicorn +CMD ["uvicorn", "hellocomputer.main:app", "--host", "0.0.0.0", "--port", "80"] \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..fb7a708 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,213 @@ +# This file was autogenerated by uv via the following command: +# uv pip compile requirements.in +aiobotocore==2.13.0 + # via s3fs +aiofiles==23.2.1 +aiohttp==3.9.5 + # via + # aiobotocore + # langchain + # langchain-community + # s3fs +aioitertools==0.11.0 + # via aiobotocore +aiosignal==1.3.1 + # via aiohttp +annotated-types==0.7.0 + # via pydantic +anyio==4.3.0 + # via + # httpx + # openai + # starlette + # watchfiles +attrs==23.2.0 + # via aiohttp +botocore==1.34.106 + # via aiobotocore +certifi==2024.2.2 + # via + # httpcore + # httpx + # requests +charset-normalizer==3.3.2 + # via requests +click==8.1.7 + # via + # typer + # uvicorn +dataclasses-json==0.6.6 + # via langchain-community +distro==1.9.0 + # via openai +dnspython==2.6.1 + # via email-validator +duckdb==0.10.3 +email-validator==2.1.1 + # via fastapi +fastapi==0.111.0 +fastapi-cli==0.0.4 + # via fastapi +frozenlist==1.4.1 + # via + # aiohttp + # aiosignal +fsspec==2024.5.0 + # via s3fs +h11==0.14.0 + # via + # httpcore + # uvicorn +httpcore==1.0.5 + # via httpx +httptools==0.6.1 + # via uvicorn +httpx==0.27.0 + # via + # fastapi + # openai +idna==3.7 + # via + # anyio + # email-validator + # httpx + # requests + # yarl +jinja2==3.1.4 + # via fastapi +jmespath==1.0.1 + # via botocore +jsonpatch==1.33 + # via langchain-core +jsonpointer==2.4 + # via jsonpatch +langchain==0.2.1 + # via langchain-community +langchain-community==0.2.1 +langchain-core==0.2.1 + # via + # langchain + # langchain-community + # langchain-text-splitters +langchain-text-splitters==0.2.0 + # via langchain +langsmith==0.1.63 + # via + # langchain + # langchain-community + # langchain-core +markdown-it-py==3.0.0 + # via rich +markupsafe==2.1.5 + # via jinja2 +marshmallow==3.21.2 + # via dataclasses-json +mdurl==0.1.2 + # via markdown-it-py +multidict==6.0.5 + # via + # aiohttp + # yarl +mypy-extensions==1.0.0 + # via typing-inspect +numpy==1.26.4 + # via + # langchain + # langchain-community +openai==1.30.3 +orjson==3.10.3 + # via + # fastapi + # langsmith +packaging==23.2 + # via + # langchain-core + # marshmallow +pydantic==2.7.1 + # via + # fastapi + # langchain + # langchain-core + # langsmith + # openai + # pydantic-settings +pydantic-core==2.18.2 + # via pydantic +pydantic-settings==2.2.1 +pygments==2.18.0 + # via rich +python-dateutil==2.9.0.post0 + # via botocore +python-dotenv==1.0.1 + # via + # pydantic-settings + # uvicorn +python-multipart==0.0.9 + # via fastapi +pyyaml==6.0.1 + # via + # langchain + # langchain-community + # langchain-core + # uvicorn +requests==2.32.2 + # via + # langchain + # langchain-community + # langsmith +rich==13.7.1 + # via typer +s3fs==2024.5.0 +shellingham==1.5.4 + # via typer +six==1.16.0 + # via python-dateutil +sniffio==1.3.1 + # via + # anyio + # httpx + # openai +sqlalchemy==2.0.30 + # via + # langchain + # langchain-community +starlette==0.37.2 + # via fastapi +tenacity==8.3.0 + # via + # langchain + # langchain-community + # langchain-core +tqdm==4.66.4 + # via openai +typer==0.12.3 + # via fastapi-cli +typing-extensions==4.12.0 + # via + # fastapi + # openai + # pydantic + # pydantic-core + # sqlalchemy + # typer + # typing-inspect +typing-inspect==0.9.0 + # via dataclasses-json +ujson==5.10.0 + # via fastapi +urllib3==2.2.1 + # via + # botocore + # requests +uvicorn==0.29.0 + # via fastapi +uvloop==0.19.0 + # via uvicorn +watchfiles==0.21.0 + # via uvicorn +websockets==12.0 + # via uvicorn +wrapt==1.16.0 + # via aiobotocore +yarl==1.9.4 + # via aiohttp diff --git a/src/hellocomputer/main.py b/src/hellocomputer/main.py index 86f90c0..2cafa65 100644 --- a/src/hellocomputer/main.py +++ b/src/hellocomputer/main.py @@ -45,6 +45,6 @@ app.include_router(files.router) app.include_router(analysis.router) app.mount( "/", - StaticFiles(directory=static_path, html=True, packages=["bootstrap4"]), + StaticFiles(directory=static_path, html=True), name="static", ) diff --git a/src/hellocomputer/static/index.html b/src/hellocomputer/static/index.html index 8fbe1bd..e5bb18d 100644 --- a/src/hellocomputer/static/index.html +++ b/src/hellocomputer/static/index.html @@ -48,17 +48,29 @@ - - - - +
+ + + + + +