From 37a8519527ba20721c2ec95377a522c5da293b1f Mon Sep 17 00:00:00 2001 From: Varik Matevosyan Date: Wed, 6 Dec 2023 15:22:56 +0400 Subject: [PATCH] Added dockerfile with postgres debug build (#233) * Added dockerfile with postgres debug build * Use prepublished image of postgres debug * Update comment * Change dockerfile dev to use postgres debug image * Update comment --- Dockerfile.dev | 45 ++++++++++++++++++++------------------------- 1 file changed, 20 insertions(+), 25 deletions(-) diff --git a/Dockerfile.dev b/Dockerfile.dev index ceae49f31..56f5d5b73 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -1,30 +1,23 @@ -ARG VERSION=16 +ARG VERSION=15 ARG PGVECTOR_VERSION=0.5.0 -ARG IMAGE_TAG=$VERSION-bookworm -FROM postgres:$IMAGE_TAG -ARG VERSION +# If you want to build the base image for different versions +# Refer to the base image Dockerfile here https://github.com/var77/postgres-docker-debug +# To use GDB inside container run docker like this: +# docker build . -t lantern-dev +# docker run --cap-add=SYS_PTRACE -p 5433:5432 -d --name lantern-dev lantern-dev +# Then exec to it docker exec -ti lantern-dev bash +# sudo su +# gdb -p $pid_of_pg_backend + +FROM varik77/postgres:$VERSION-debug ARG PGVECTOR_VERSION WORKDIR /lantern -RUN apt update \ - # Fix the locales package version to prevent unexpected updates - && apt-mark hold locales \ - && apt install -y --no-install-recommends \ - build-essential \ - cmake \ - postgresql-server-dev-$VERSION \ - gdb \ - wget \ - python3-pip \ - python3-dev \ - sudo \ - curl \ - git-all \ - tmux \ - clang-format \ - && pip install GitPython libtmux --break-system-packages && \ +USER root +ENV DEBIAN_FRONTEND=noninteractive +RUN pip install GitPython libtmux && \ wget -O pgvector.tar.gz https://github.com/pgvector/pgvector/archive/refs/tags/v${PGVECTOR_VERSION}.tar.gz && \ tar xzf pgvector.tar.gz && \ cd pgvector-${PGVECTOR_VERSION} && \ @@ -43,7 +36,9 @@ RUN rm -rf build \ RUN mkdir build/lantern \ && git clone https://github.com/lanterndata/benchmark build/benchmark \ && cd build/benchmark \ - && pip install -r core/requirements.txt --break-system-packages \ - && pip install -r external/requirements.txt --break-system-packages -ENV DATABASE_URL=postgres://postgres:postgres@localhost:5432/postgres -ENV LANTERN_DATABASE_URL=postgres://postgres:postgres@localhost:5432/postgres \ No newline at end of file + && pip install -r core/requirements.txt \ + && pip install -r external/requirements.txt +ENV DATABASE_URL=postgres://postgres@localhost:5432/postgres +ENV LANTERN_DATABASE_URL=postgres://postgres@localhost:5432/postgres + +USER postgres