From 3e5fa5139d6f76ed3fcae580cf4504f94fb8f56b Mon Sep 17 00:00:00 2001 From: Tyler Perkins Date: Sun, 7 Apr 2024 14:29:21 -0400 Subject: [PATCH] Add dockerfile --- Dockerfile | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d612fd8 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,44 @@ +# Build container +FROM debian:bullseye-slim as builder + +# Update package lists and install necessary packages in the build container +RUN apt-get update && \ + apt-get install -y --no-install-recommends git build-essential ca-certificates && \ + rm -rf /var/lib/apt/lists/* + +# Clone the specific version of the pgvector repository +RUN git clone --branch v0.4.1 https://github.com/pgvector/pgvector.git /tmp/pgvector + +# Build pgvector +RUN cd /tmp/pgvector && \ + make + +# Final base image +FROM bitnami/postgresql:16.0.0-debian-11-r3 + +# Switch to root to install packages and make directories +USER 0 + +# Ensure the package manager is functional and install build tools in the final image +RUN mkdir -p /var/lib/apt/lists/partial && \ + apt-get clean && \ + apt-get update && \ + apt-get install -y --no-install-recommends make gcc libc6-dev ca-certificates && \ + rm -rf /var/lib/apt/lists/* + +# Copy the pgvector build from the builder stage +COPY --from=builder /tmp/pgvector /tmp/pgvector + +# Install pgvector in the final image +RUN export PG_CONFIG=/opt/bitnami/postgresql/bin/pg_config && \ + cd /tmp/pgvector && \ + make install && \ + make clean + +# Cleanup the build tools to keep the image lean +RUN apt-get remove -y make gcc libc6-dev && \ + apt-get autoremove -y && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* + +USER 1001