Gluttony-Cluster-Postgresql/Dockerfile
2024-04-07 19:59:55 -04:00

50 lines
1.6 KiB
Docker

# Build container
FROM docker.io/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 wget && \
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
RUN mkdir /tmp/vecto.rs && \
cd /tmp/vecto.rs && \
wget https://github.com/tensorchord/pgvecto.rs/releases/download/v0.2.1/vectors-pg14_0.2.1_amd64.deb && \
apt-get install ./vectors-pg14_0.2.1_amd64.deb
# Cleanup the build tools to keep the image lean
RUN apt-get remove -y make gcc libc6-dev wget && \
apt-get autoremove -y && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
USER 1001