graphiti/Dockerfile
Pavlo Paliychuk ba48f64492
Add Fastapi graph service (#88)
* chore: Folder rearrangement

* chore: Remove unused deps, and add mypy step in CI for graph-service

* fix: Mypy errors

* fix: linter

* fix mypy

* fix mypy

* chore: Update docker setup

* chore: Reduce graph service image size

* chore: Install graph service deps on CI

* remove cache from typecheck

* chore: install graph-service deps on typecheck action

* update graph service mypy direction

* feat: Add release service image step

* chore: Update depot configuration

* chore: Update release image job to run on releases

* chore: Test depot multiplatform build

* update release action tag

* chore: Update action to be in accordance with zep image publish

* test

* test

* revert

* chore: Update python slim image used in service docker

* chore: Remove unused endpoints and dtos
2024-09-06 11:07:45 -04:00

42 lines
1.1 KiB
Docker

# Build stage
FROM python:3.12-slim as builder
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
&& rm -rf /var/lib/apt/lists/*
# Install Poetry
RUN pip install --no-cache-dir poetry
# Copy only the files needed for installation
COPY ./pyproject.toml ./poetry.lock* ./README.md /app/
COPY ./graphiti_core /app/graphiti_core
COPY ./server/pyproject.toml ./server/poetry.lock* /app/server/
RUN poetry config virtualenvs.create false
# Install the local package
RUN poetry build && pip install dist/*.whl
# Install server dependencies
WORKDIR /app/server
RUN poetry install --no-interaction --no-ansi --no-dev
FROM python:3.12-slim
# Copy only the necessary files from the builder stage
COPY --from=builder /usr/local/lib/python3.12/site-packages /usr/local/lib/python3.12/site-packages
COPY --from=builder /usr/local/bin /usr/local/bin
# Create the app directory and copy server files
WORKDIR /app
COPY ./server /app
# Set environment variables
ENV PYTHONUNBUFFERED=1
# Command to run the application
CMD ["uvicorn", "graph_service.main:app", "--host", "0.0.0.0", "--port", "8000"]