forked from letta-ai/letta
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
69 lines (54 loc) · 1.65 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# Start with pgvector base for builder
FROM ankane/pgvector:v0.5.1 AS builder
# Install Python and required packages
RUN apt-get update && apt-get install -y \
python3 \
python3-venv \
python3-pip \
python3-full \
build-essential \
libpq-dev \
python3-dev \
&& rm -rf /var/lib/apt/lists/*
ARG LETTA_ENVIRONMENT=PRODUCTION
ENV LETTA_ENVIRONMENT=${LETTA_ENVIRONMENT} \
POETRY_NO_INTERACTION=1 \
POETRY_VIRTUALENVS_IN_PROJECT=1 \
POETRY_VIRTUALENVS_CREATE=1 \
POETRY_CACHE_DIR=/tmp/poetry_cache
WORKDIR /app
# Create and activate virtual environment
RUN python3 -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
# Now install poetry in the virtual environment
RUN pip install --no-cache-dir poetry==1.8.2
# Copy dependency files first
COPY pyproject.toml poetry.lock ./
# Then copy the rest of the application code
COPY . .
RUN poetry lock --no-update && \
poetry install --all-extras && \
rm -rf $POETRY_CACHE_DIR
# Runtime stage
FROM ankane/pgvector:v0.5.1 AS runtime
# Install Python packages
RUN apt-get update && apt-get install -y \
python3 \
python3-venv \
&& rm -rf /var/lib/apt/lists/* \
&& mkdir -p /app
ARG LETTA_ENVIRONMENT=PRODUCTION
ENV LETTA_ENVIRONMENT=${LETTA_ENVIRONMENT} \
VIRTUAL_ENV="/app/.venv" \
PATH="/app/.venv/bin:$PATH" \
POSTGRES_USER=letta \
POSTGRES_PASSWORD=letta \
POSTGRES_DB=letta
WORKDIR /app
# Copy virtual environment and app from builder
COPY --from=builder /app .
# Copy initialization SQL if it exists
COPY init.sql /docker-entrypoint-initdb.d/
EXPOSE 8283 5432
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
CMD ["./letta/server/startup.sh"]