aboutsummaryrefslogtreecommitdiff
path: root/Dockerfile
blob: ad38bd6e7896cf24293dd98e9fd6a02c8a2531e7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
FROM postgres:17

# Install build dependencies
RUN apt-get update && apt-get install -y \
    build-essential \
    git \
    curl \
    pkg-config \
    libssl-dev \
    libclang-dev \
    llvm-dev \
    postgresql-server-dev-all \
    && rm -rf /var/lib/apt/lists/*

# Install pgvector
RUN git clone --branch v0.5.1 https://github.com/pgvector/pgvector.git \
    && cd pgvector \
    && make \
    && make install

# Install Rust
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"

# Install and initialize pgrx
RUN cargo install cargo-pgrx --version 0.12.5 --locked && \
    cargo pgrx init --pg17 pg_config

# Clone and install pgvectorscale
RUN cd /tmp && \
    git clone --branch 0.5.0 https://github.com/timescale/pgvectorscale && \
    cd pgvectorscale/pgvectorscale && \
    cargo pgrx install --release

# Create initialization script to enable both extensions
RUN echo 'CREATE EXTENSION IF NOT EXISTS vector;' > /docker-entrypoint-initdb.d/01-init-vector.sql && \
    echo 'CREATE EXTENSION IF NOT EXISTS vectorscale CASCADE;' > /docker-entrypoint-initdb.d/02-init-vectorscale.sql