FROM postgres:16 # Install build dependencies RUN apt-get update && apt-get install -y \ build-essential \ git \ postgresql-server-dev-16 \ && rm -rf /var/lib/apt/lists/* # Install pg_vector extension with compatibility fixes for ARM64 RUN git clone https://github.com/pgvector/pgvector.git && \ cd pgvector && \ git checkout v0.5.1 && \ make OPTFLAGS="" && \ make install # Add initialization scripts COPY ./backend/scripts/init-vector.sql /docker-entrypoint-initdb.d/ # Set environment variables ENV POSTGRES_DB=replypier ENV POSTGRES_USER=postgres ENV POSTGRES_PASSWORD=postgres # Set PostgreSQL configuration for better stability with pgvector RUN echo "shared_preload_libraries = 'vector'" >> /usr/share/postgresql/postgresql.conf.sample RUN echo "max_connections = 200" >> /usr/share/postgresql/postgresql.conf.sample RUN echo "shared_buffers = 256MB" >> /usr/share/postgresql/postgresql.conf.sample # Expose PostgreSQL port EXPOSE 5432