Gluttony-Cluster-Postgresql/Dockerfile

45 lines
1.3 KiB
Docker
Raw Permalink 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
2024-04-08 00:15:07 +00:00
RUN git clone --branch v0.6.2 https://github.com/pgvector/pgvector.git /tmp/pgvector
2024-04-07 18:29:21 +00:00
# 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
# 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