Skip to content

Commit

Permalink
fix ingest in Docker
Browse files Browse the repository at this point in the history
  • Loading branch information
valeksiev committed Dec 5, 2024
1 parent 8b575de commit d53bb38
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 29 deletions.
31 changes: 9 additions & 22 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,37 +10,24 @@ ARG HUGO_VERSION=0.121.2
ARG TARGETARCH

# install git, go and hugo
RUN apt update && apt upgrade -y && apt install -y git wget
RUN apt-get upgrade -y
RUN apt-get update -y
RUN apt-get install -y git wget
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

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 && ls -al /usr/local
RUN hugo version

# Install Poetry
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"]
4 changes: 2 additions & 2 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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", "")
Expand Down
8 changes: 4 additions & 4 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>"]
license = "EUPL-1.2"
Expand Down

0 comments on commit d53bb38

Please sign in to comment.