Skip to content

Commit

Permalink
install tool dependencies on reboot
Browse files Browse the repository at this point in the history
  • Loading branch information
Fluder-Paradyne committed Jul 25, 2023
1 parent 79f6c97 commit 7160213
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 22 deletions.
27 changes: 9 additions & 18 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,42 +1,33 @@
# Stage 1: Compile image
FROM python:3.10-slim-bullseye AS compile-image
WORKDIR /app

RUN apt-get update && \
RUN apt-get update && \
apt-get install --no-install-recommends -y wget libpq-dev gcc g++ python3-dev && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

RUN python -m venv /opt/venv
# Make sure we use the virtualenv:
ENV PATH="/opt/venv/bin:$PATH"

COPY requirements.txt .
RUN pip install --upgrade pip
RUN pip install --no-cache-dir -r requirements.txt
RUN pip install --upgrade pip && \
pip install --no-cache-dir -r requirements.txt

COPY . .
COPY entrypoint.sh ./entrypoint.sh
COPY wait-for-it.sh ./wait-for-it.sh
RUN chmod +x ./entrypoint.sh ./wait-for-it.sh

# Downloads the tools
RUN python superagi/tool_manager.py

# Set executable permissions for install_tool_dependencies.sh
RUN chmod +x install_tool_dependencies.sh

# Install dependencies
RUN ./install_tool_dependencies.sh
RUN chmod +x ./entrypoint.sh ./wait-for-it.sh ./install_tool_dependencies.sh ./entrypoint_celery.sh

# Stage 2: Build image
FROM python:3.10-slim-bullseye AS build-image
WORKDIR /app
RUN apt-get update && apt-get install --no-install-recommends -y libpq-dev && \

RUN apt-get update && \
apt-get install --no-install-recommends -y libpq-dev && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

COPY --from=compile-image /opt/venv /opt/venv
COPY --from=compile-image /app /app

# Make sure we use the virtualenv:
ENV PATH="/opt/venv/bin:$PATH"

2 changes: 1 addition & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ services:
- super__postgres
networks:
- super_network
command: ["celery", "-A", "superagi.worker", "worker", "--beat","--loglevel=info"]
command: ["/app/entrypoint_celery.sh"]
gui:
build:
context: ./gui
Expand Down
5 changes: 5 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#!/bin/bash

# Downloads the tools
python superagi/tool_manager.py

# Install dependencies
./install_tool_dependencies.sh

# Run Alembic migrations
alembic upgrade head
Expand Down
10 changes: 7 additions & 3 deletions entrypoint_celery.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#!/bin/bash
Xvfb :0 -screen 0 1280x1024x24 &
x11vnc -display :0 -N -forever -shared &

exec "$@"
# Downloads the tools
python superagi/tool_manager.py

# Install dependencies
./install_tool_dependencies.sh

exec celery -A superagi.worker worker --beat --loglevel=info

0 comments on commit 7160213

Please sign in to comment.