From 66a6f3590b95e568cb42d97f02a8cb346ec892d3 Mon Sep 17 00:00:00 2001 From: Zack Date: Sat, 11 Nov 2023 15:56:24 -0600 Subject: [PATCH] feat: fix docker deployement Former-commit-id: d266fe7d39fe041f74357f26a80b8961c02a85cc --- Dockerfile | 21 ++++++++++++--------- docker-compose.yaml | 4 ++-- requirements.txt | 3 ++- swarms/utils/knowledge_extraction.py | 3 +-- test | 0 5 files changed, 17 insertions(+), 14 deletions(-) create mode 100644 test diff --git a/Dockerfile b/Dockerfile index 27d43782..d0b51f60 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,3 @@ - # Use an official NVIDIA CUDA runtime as a parent image FROM python:3.10-slim-buster @@ -8,12 +7,17 @@ WORKDIR /app # Add the current directory contents into the container at /app ADD . /app -RUN apt update && apt install -y - -# Install Python and other dependencies +# Install Python, libgl1-mesa-glx and other dependencies RUN apt-get update && apt-get install -y \ python3-pip \ - pip3 install --upgrade pip + libgl1-mesa-glx \ + && rm -rf /var/lib/apt/lists/* + +# Upgrade pip +RUN pip3 install --upgrade pip + +# Install nltk +RUN pip install nltk # Install any needed packages specified in requirements.txt RUN pip install --no-cache-dir -r requirements.txt supervisor @@ -22,14 +26,13 @@ RUN pip install --no-cache-dir -r requirements.txt supervisor RUN mkdir -p /etc/supervisor/conf.d && \ echo "[supervisord] \n\ nodaemon=true \n\ - [program:host_local_tools] \n\ - command=python3 host_local_tools.py \n\ [program:web_demo] \n\ command=python3 web_demo.py \n\ + [program:host_local_tools] \n\ + command=python3 host_local_tools.py \n\ " > /etc/supervisor/conf.d/supervisord.conf - # Make port 80 available to the world outside this container EXPOSE 80 # Run supervisord when the container launches -CMD ["/usr/local/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"] +CMD ["/usr/local/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf", "--port", "7860"] diff --git a/docker-compose.yaml b/docker-compose.yaml index 4c4fc262..7ae81ae2 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -2,13 +2,13 @@ version: '3' services: web_demo: build: . - command: python web_demo.py + command: python host_local_tools.py volumes: - .:/app ports: - "5000:5000" host_local_tools: build: . - command: python host_local_tools.py + command: python web_demo.py volumes: - .:/app diff --git a/requirements.txt b/requirements.txt index a3ad83fe..ae0a6d4a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -66,7 +66,8 @@ dalle3 cohere torchvision rich - +paramiko +nltk mkdocs mkdocs-material mkdocs-glightbox diff --git a/swarms/utils/knowledge_extraction.py b/swarms/utils/knowledge_extraction.py index 0e0bc786..953ac73a 100644 --- a/swarms/utils/knowledge_extraction.py +++ b/swarms/utils/knowledge_extraction.py @@ -2,12 +2,11 @@ import json import os import requests import numpy as np -import paramiko +import nltk from nltk.stem import WordNetLemmatizer from nltk.corpus import wordnet, stopwords from nltk.tokenize import word_tokenize -import nltk from swarms.tools.database.utils.db_parser import get_conf from swarms.tools.database.utils.database import DBArgs, Database diff --git a/test b/test new file mode 100644 index 00000000..e69de29b