From 6c68a6f269b1a617a8aa2a5bc33f910fbb68368a Mon Sep 17 00:00:00 2001 From: Robin Goetz <35136007+goetzrobin@users.noreply.github.com> Date: Sat, 24 Feb 2024 01:33:54 +0100 Subject: [PATCH] feat: add dockerfile for memgpt server (#1049) --- .dockerignore | 1 + Dockerfile | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..a7c82f53 --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +chatui \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..e12f6b1d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,31 @@ +# The builder image, used to build the virtual environment +FROM python:3.11-buster as builder + +RUN pip install poetry==1.4.2 + +ENV POETRY_NO_INTERACTION=1 \ + POETRY_VIRTUALENVS_IN_PROJECT=1 \ + POETRY_VIRTUALENVS_CREATE=1 \ + POETRY_CACHE_DIR=/tmp/poetry_cache + +WORKDIR /app + +COPY pyproject.toml poetry.lock ./ + +RUN poetry add psycopg2-binary + +RUN poetry install --without dev --no-root -E "postgres server" && rm -rf $POETRY_CACHE_DIR + +# The runtime image, used to just run the code provided its virtual environment +FROM python:3.11-slim-buster as runtime + +ENV VIRTUAL_ENV=/app/.venv \ + PATH="/app/.venv/bin:$PATH" + +COPY --from=builder ${VIRTUAL_ENV} ${VIRTUAL_ENV} + +COPY memgpt ./memgpt + +EXPOSE 8083 + +ENTRYPOINT ["python", "-m", "uvicorn", "memgpt.server.rest_api.server:app", "--host", "0.0.0.0", "--port", "8083"]