Gluttony-Cluster-Postgresql/Dockerfile

50 lines
1.6 KiB
Docker
Raw Normal View History

2024-04-07 18:29:21 +00:00
# Build container
2024-04-07 18:36:26 +00:00
FROM docker.io/debian:bullseye-slim as builder
2024-04-07 18:29:21 +00:00
# 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 && \
2024-04-07 23:59:55 +00:00
apt-get install -y --no-install-recommends make gcc libc6-dev ca-certificates wget && \
2024-04-07 18:29:21 +00:00
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
2024-04-07 23:59:55 +00:00
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
2024-04-07 18:29:21 +00:00
# Cleanup the build tools to keep the image lean
2024-04-07 23:59:55 +00:00
RUN apt-get remove -y make gcc libc6-dev wget && \
2024-04-07 18:29:21 +00:00
apt-get autoremove -y && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
USER 1001