Skip to content

Commit

Permalink
Merge branch 'main' into mindy/archival-memory-file-upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Mindy Long committed Dec 12, 2024
2 parents faa515e + c0d99ba commit 072dc49
Showing 1 changed file with 57 additions and 13 deletions.
70 changes: 57 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,37 @@
# Start with pgvector base for builder
FROM ankane/pgvector:v0.5.1 AS builder

# Install Python and required packages
# Install dependencies and Python 3.12
RUN apt-get update && apt-get install -y \
python3 \
python3-venv \
python3-pip \
python3-full \
wget \
build-essential \
libssl-dev \
zlib1g-dev \
libncurses5-dev \
libncursesw5-dev \
libreadline-dev \
libsqlite3-dev \
libgdbm-dev \
libdb5.3-dev \
libbz2-dev \
libexpat1-dev \
liblzma-dev \
libffi-dev \
libpq-dev \
python3-dev \
&& rm -rf /var/lib/apt/lists/*

# Download and install Python 3.12
RUN wget https://www.python.org/ftp/python/3.12.0/Python-3.12.0.tgz \
&& tar xzf Python-3.12.0.tgz \
&& cd Python-3.12.0 \
&& ./configure --enable-optimizations \
&& make -j $(nproc) \
&& make altinstall \
&& cd .. \
&& rm -rf Python-3.12.0 Python-3.12.0.tgz \
&& ln -s /usr/local/bin/python3.12 /usr/local/bin/python3 \
&& ln -s /usr/local/bin/pip3.12 /usr/local/bin/pip3

ARG LETTA_ENVIRONMENT=PRODUCTION
ENV LETTA_ENVIRONMENT=${LETTA_ENVIRONMENT} \
POETRY_NO_INTERACTION=1 \
Expand All @@ -22,14 +42,15 @@ ENV LETTA_ENVIRONMENT=${LETTA_ENVIRONMENT} \
WORKDIR /app

# Create and activate virtual environment
RUN python3 -m venv /opt/venv
RUN python3.12 -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
# Install poetry in the virtual environment
RUN pip3 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 . .

Expand All @@ -40,11 +61,34 @@ RUN poetry lock --no-update && \
# Runtime stage
FROM ankane/pgvector:v0.5.1 AS runtime

# Install Python packages
# Install Python 3.12 dependencies in runtime stage
RUN apt-get update && apt-get install -y \
python3 \
python3-venv \
&& rm -rf /var/lib/apt/lists/* \
wget \
build-essential \
libssl-dev \
zlib1g-dev \
libncurses5-dev \
libncursesw5-dev \
libreadline-dev \
libsqlite3-dev \
libgdbm-dev \
libdb5.3-dev \
libbz2-dev \
libexpat1-dev \
liblzma-dev \
libffi-dev \
&& rm -rf /var/lib/apt/lists/*

# Install Python 3.12 in runtime stage
RUN wget https://www.python.org/ftp/python/3.12.0/Python-3.12.0.tgz \
&& tar xzf Python-3.12.0.tgz \
&& cd Python-3.12.0 \
&& ./configure --enable-optimizations \
&& make -j $(nproc) \
&& make altinstall \
&& cd .. \
&& rm -rf Python-3.12.0 Python-3.12.0.tgz \
&& ln -s /usr/local/bin/python3.12 /usr/local/bin/python3 \
&& mkdir -p /app

ARG LETTA_ENVIRONMENT=PRODUCTION
Expand Down

0 comments on commit 072dc49

Please sign in to comment.