Skip to content

Commit

Permalink
work in progress
Browse files Browse the repository at this point in the history
still having python issues.
  • Loading branch information
mike dupont committed Oct 11, 2023
1 parent 1f598b0 commit 0261e48
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 1,277 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ jobs:
- name: pylint
run: |
source .venv/bin/activate
pylint build tests || echo ignore for now
pylint build tests
- name: black
run: |
# source .venv/bin/activate
# black --check . ||skip
source .venv/bin/activate
black --check .
run-tests:
needs: code-quality
Expand Down
28 changes: 18 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
# Dockerfile: https://github.com/max-pfeiffer/python-poetry/blob/main/build/Dockerfile
ARG BASE_IMAGE
FROM ${BASE_IMAGE}
RUN apt update
RUN apt install -y git
ARG APPLICATION_SERVER_PORT

LABEL maintainer="Mike DuPont <[email protected]>"

Expand All @@ -17,27 +16,36 @@ ENV PYTHONUNBUFFERED=1 \
POETRY_VIRTUALENVS_IN_PROJECT=true \
POETRY_CACHE_DIR="/application_root/.cache" \
VIRTUAL_ENVIRONMENT_PATH="/application_root/.venv" \
POETRY_HOME="/opt/poetry"
# https://python-poetry.org/docs/#installing-manually
RUN python -m venv ${VIRTUAL_ENVIRONMENT_PATH}

APPLICATION_SERVER_PORT=$APPLICATION_SERVER_PORT
# Adding the virtual environment to PATH in order to "activate" it.
# https://docs.python.org/3/library/venv.html#how-venvs-work
ENV PATH="$VIRTUAL_ENVIRONMENT_PATH/bin:$PATH"

# Principle of least privilege: create a new user for running the application
RUN groupadd -g 1001 python_application && \
useradd -r -u 1001 -g python_application python_application

# Set the WORKDIR to the application root.
# https://www.uvicorn.org/settings/#development
# https://docs.docker.com/engine/reference/builder/#workdir
WORKDIR ${PYTHONPATH}
RUN chown python_application:python_application ${PYTHONPATH}

# Create cache directory and set permissions because user 1001 has no home
# and poetry cache directory.
# https://python-poetry.org/docs/configuration/#cache-directory
RUN mkdir ${POETRY_CACHE_DIR} && chown python_application:python_application ${POETRY_CACHE_DIR}

# Use the unpriveledged user to run the application
USER 1001

WORKDIR /opt/ai-ticket
COPY pyproject.toml /opt/ai-ticket/
COPY setup.cfg /opt/ai-ticket/
COPY README.md /opt/ai-ticket/
COPY requirements.txt /opt/ai-ticket/
COPY ./src/ /opt/ai-ticket/src/

RUN ls ${VIRTUAL_ENVIRONMENT_PATH}/bin/activate
RUN pip install /opt/ai-ticket/ && pip install --trusted-host pypi.python.org -r requirements.txt
RUN pip install /opt/ai-ticket/

RUN apt update
RUN apt install -y git
RUN pip install --trusted-host pypi.python.org -r requirements.txt
63 changes: 24 additions & 39 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,21 @@
version: '3'
services:

act_base: #root base of action
build: vendor/act_base
image: h4ckermike/act_base
#h4ckermike/
poetry_base: # use poetry
image: h4ckermike/poetry_base
build:
context: vendor/python-poetry/build
args:
OFFICIAL_PYTHON_IMAGE: h4ckermike/act_base:latest
POETRY_VERSION: 1.6.1
depends_on:
- act_base

ai_ticket: # the ticket to unite
image: h4ckermike/ai_ticket
build:
context: .
args:
BASE_IMAGE: poetry_base
depends_on:
- poetry_base

basic_agent: #basic agnet
image: h4ckermike/basic_agent
build:

context: vendor/basic_agent/
args:
OFFICIAL_PYTHON_IMAGE: act_base
depends_on:
- ai_ticket
ai_ticket:
#image: ai_ticket
build: .
# context: .
#entrypoint: /bin/bash
#stdin_open: true # docker run -i
#tty: true # docker run -t

autogpt:

#entrypoint: bash -c "poetry run pip install /opt/ai-ticket && poetry run autogpt --install-plugin-deps --skip-news -y"
entrypoint: bash -c "poetry run pip install /opt/ai-ticket && poetry run autogpt --install-plugin-deps --skip-news -y --ai-name 'meta-autogpt' --ai-role 'you will introspect autogpt and reveal its internals via reflection and comprehension' --ai-goal 'Observe your behaviour' --ai-goal 'Reflect over your outcomes' --ai-goal 'Orient yourself to your knowledge' --ai-goal 'Decide on your next step' --ai-goal 'Act on your chosen next experiment' "



# uncomment thse next 3 lines for debugging
#entrypoint: /bin/bash
#stdin_open: true # docker run -i
Expand All @@ -48,14 +25,22 @@ services:
- GITHUB_REPO="jmikedupont2/ai-ticket"
- OPENAI_API_KEY=your-openai-api-key
- OPENAI_API_BASE=http://mockopenai:8080/v1
image: h4ckermike/autogpt
build:

context: vendor/Auto-GPT/
dockerfile: slim/Dockerfile
args:
OFFICIAL_PYTHON_IMAGE: h4ckermike/ai_ticket:latest

depends_on:
- basic_agent
- ai_ticket
- mockopenai

mockopenai:
depends_on:
- ai_ticket

environment:
- GITHUB_PAT=${GITHUB_PAT}
- GITHUB_REPO=${GITHUB_REPO}

build:
context: vendor/lollms/
ports:
- "5000:8080"

Loading

0 comments on commit 0261e48

Please sign in to comment.