Skip to content

Commit

Permalink
build: added basic Dockerfile for evals, removed llama-cpp-python dep…
Browse files Browse the repository at this point in the history
…endency
  • Loading branch information
ErikBjare committed Aug 21, 2024
1 parent d4c55b6 commit 75deabc
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 39 deletions.
42 changes: 42 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Use an official Python runtime as a parent image
FROM python:3.10-slim

# Install build dependencies
RUN apt-get update && apt-get install -y \
build-essential \
&& rm -rf /var/lib/apt/lists/*

# Set the working directory in the container
WORKDIR /app

# Install system dependencies
RUN apt-get update && apt-get install -y \
gcc \
git \
&& rm -rf /var/lib/apt/lists/*

# Install Poetry
RUN pip install poetry

# Copy the project files into the container
COPY pyproject.toml poetry.lock* README.md ./
COPY gptme ./gptme
COPY static ./static
COPY media ./media

# Install project dependencies including eval extras
RUN poetry config virtualenvs.create false \
&& poetry install --no-interaction --no-ansi -E server -E browser -E datascience

# Make port 5000 available to the world outside this container
# (assuming your Flask server runs on port 5000)
EXPOSE 5000

# Set environment variable for eval
ENV PYTHONPATH=/app

# Default command to run the server
CMD ["poetry", "run", "gptme-server"]

# Add an entry point for running evals
ENTRYPOINT ["poetry", "run", "python", "-m", "gptme.eval.main"]
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ SRCFILES = $(shell find ${SRCDIRS} -name '*.py' $(foreach EXCLUDE,$(EXCLUDES),-n
build:
poetry install

build-docker:
docker build -t gptme .

test:
@# if SLOW is not set, pass `-m "not slow"` to skip slow tests
poetry run pytest ${SRCDIRS} -v --log-level INFO --durations=5 \
Expand Down Expand Up @@ -77,7 +80,7 @@ release: dist/CHANGELOG.md

clean: clean-docs clean-site clean-test

clean-site:
clean-site:
rm -rf site/dist

clean-docs:
Expand Down
39 changes: 4 additions & 35 deletions poetry.lock

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

5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ openai = "^1.0"
anthropic = "^0.34.0"

# optionals
llama-cpp-python = {version = "^0.1.57", optional=true}
playwright = {version = "^1.37.0", optional=true}
jedi = {version = "^0.19.0", optional=true}

Expand Down Expand Up @@ -74,13 +73,13 @@ types-tabulate = "^0.9.0.20240106"
pytest-retry = "^1.6.3"

[tool.poetry.extras]
server = ["llama-cpp-python", "flask"]
server = ["flask"]
browser = ["playwright"]
datascience = ["matplotlib", "pandas", "numpy", "pillow"]
training = ["torch", "transformers"]
all = [
# server
"llama-cpp-python", "flask",
"flask",
# browser
"playwright",
# datascience
Expand Down

0 comments on commit 75deabc

Please sign in to comment.