diff --git a/Dockerfile b/Dockerfile index 17a67e9..3f4301a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,12 +9,23 @@ ARG GO_VERSION=1.21.6 ARG HUGO_VERSION=0.121.2 ARG TARGETARCH -# install git, go and hugo -RUN apt update && apt upgrade -y && apt install -y git wget +# install wget and git +RUN apt-get update -y \ + && apt-get upgrade -y \ + && apt-get install -y git wget \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + RUN wget https://go.dev/dl/go${GO_VERSION}.linux-${TARGETARCH}.tar.gz && tar -C /usr/local -xzf go${GO_VERSION}.linux-${TARGETARCH}.tar.gz -RUN export PATH=$PATH:/usr/local/go/bin:/usr/local && go version -RUN wget https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-${TARGETARCH}.tar.gz && tar -C /usr/local -xzf hugo_extended_${HUGO_VERSION}_linux-${TARGETARCH}.tar.gz && ls -al /usr/local -RUN /usr/local/hugo version + +ENV PATH="/usr/local/go/bin:/usr/local:${PATH}" +RUN go version + +RUN wget https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-${TARGETARCH}.tar.gz \ + && tar -C /bin -xzf hugo_extended_${HUGO_VERSION}_linux-${TARGETARCH}.tar.gz \ + && rm hugo_extended_${HUGO_VERSION}_linux-${TARGETARCH}.tar.gz + +RUN hugo version # Install Poetry RUN pip install poetry @@ -22,25 +33,8 @@ RUN pip install poetry # Copy the current directory contents into the container at /app COPY . /app -# Use Poetry to install dependencies +# # Use Poetry to install dependencies RUN poetry config virtualenvs.create true && poetry install --no-interaction --no-ansi -# Start a new, final stage -FROM python:${PYTHON_VERSION}-slim-bullseye - -WORKDIR /app - -# Install git and Poetry in the final stage -RUN apt update && apt install -y git && pip install poetry - -# Copy the compiled app, Hugo executable, Go, and the virtual environment from the previous stage -COPY --from=builder /app /app -COPY --from=builder /usr/local/hugo /usr/local/hugo -COPY --from=builder /usr/local/go /usr/local/go -COPY --from=builder /root/.cache/pypoetry/virtualenvs /root/.cache/pypoetry/virtualenvs - -# Add Hugo and Go to the PATH -ENV PATH="/usr/local/hugo:/usr/local/go/bin:${PATH}" - -# Run virtual_contributor_engine_guidance.py when the container launches +# Run main.py when the container launches CMD ["poetry", "run", "python", "main.py"] diff --git a/config.py b/config.py index 38259d2..f3cb7df 100644 --- a/config.py +++ b/config.py @@ -46,8 +46,8 @@ def __init__(self): self.site_url = os.getenv("AI_SOURCE_WEBSITE", "") self.welcome_site_url = os.getenv("AI_SOURCE_WEBSITE2", "") - self.site_repo = os.getenv("AI_WEBSITE_REPO", "") - self.welcome_site_repo = os.getenv("AI_WEBSITE_REPO2", "") + self.site_repo = f"https://{os.getenv('AI_GITHUB_PAT', '')}@{os.getenv('AI_WEBSITE_REPO', '')}" + self.welcome_site_repo = f"https://{os.getenv('AI_GITHUB_PAT', '')}@{os.getenv('AI_WEBSITE_REPO2', '')}" self.github_user = os.getenv("AI_GITHUB_USER", "") self.github_pat = os.getenv("AI_GITHUB_PAT", "") diff --git a/ingest.py b/ingest.py index be2fe15..ed500a4 100644 --- a/ingest.py +++ b/ingest.py @@ -45,10 +45,10 @@ def embed_text(documents: list[Document]): async def ensure_cloned(repo_name: str, path: str): if os.path.exists(path): - logger.info(f"Repository {repo_name} already cloned.") + logger.info(f"Repository {path} already cloned.") repo = Repo.init(path) else: - logger.info(f"Closning repository: {repo_name}") + logger.info(f"Cloning repository: {path}") repo = Repo.clone_from(repo_name, path, branch="main") repo.heads.main.checkout() diff --git a/poetry.lock b/poetry.lock index 2261b05..df51aca 100644 --- a/poetry.lock +++ b/poetry.lock @@ -2034,13 +2034,13 @@ requests = ">=2.0.1,<3.0.0" [[package]] name = "six" -version = "1.16.0" +version = "1.17.0" description = "Python 2 and 3 compatibility utilities" optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*" +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,>=2.7" files = [ - {file = "six-1.16.0-py2.py3-none-any.whl", hash = "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254"}, - {file = "six-1.16.0.tar.gz", hash = "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926"}, + {file = "six-1.17.0-py2.py3-none-any.whl", hash = "sha256:4721f391ed90541fddacab5acf947aa0d3dc7d27b2e1e8eda2be8970586c3274"}, + {file = "six-1.17.0.tar.gz", hash = "sha256:ff70335d468e7eb6ec65b95b99d3a2836546063f63acc5171de367e834932a81"}, ] [[package]] diff --git a/pyproject.toml b/pyproject.toml index 8b8dc31..bca1897 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "virtual-contributor-engine-guidance" -version = "0.8.1" +version = "0.8.2" description = "Alkemio Generative AI Guidance Engine" authors = ["Alkemio BV "] license = "EUPL-1.2"