Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding pg_linearalgebra extension #520

Closed
wants to merge 13 commits into from
45 changes: 45 additions & 0 deletions contrib/pg_linearalgebra/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
ARG PG_VERSION=15
FROM quay.io/coredb/pgrx-builder:pg${PG_VERSION}-pgrx0.10.2
# Switch to the root user for installing dependencies and building the extension
USER root
# Update the package list and install the necessary build dependencies
# Extension build dependencies
RUN apt-get update && apt-get install -y \
build-essential \
libreadline-dev \
zlib1g-dev \
flex \
bison \
libxml2-dev \
libxslt-dev \
libssl-dev \
libxml2-utils \
xsltproc \
ccache \
python3-dev \
clang \
cmake \
libclang-dev \
libopenblas-dev \
libpython3-dev \
pkg-config \
crossbuild-essential-arm64 \
crossbuild-essential-amd64 \
gcc-aarch64-linux-gnu \
gfortran && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Install Rust using the official installation script
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
# Set the default Rust version to stable
RUN rustup default stable
# Add necessary Rust components and target
RUN rustup component add llvm-tools-preview rustc-dev && \
rustup target install x86_64-unknown-linux-gnu
# Clone the repository into /app/pg_linearalgebra
RUN git clone https://github.com/joshuajerin/pg_linearalgebra.git /app/pg_linearalgebra
# Set the working directory to /app/pg_linearalgebra
WORKDIR /app/pg_linearalgebra
# Build the extension using cargo pgrx
RUN cargo pgrx init --pg15 /usr/bin/pg_config && \
cargo pgrx package -c /usr/bin/pg_config
19 changes: 19 additions & 0 deletions contrib/pg_linearalgebra/Trunk.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[extension]
name = "pg_linearalgebra"
version = "1.0.0"
repository = "https://github.com/joshuajerin/pg_linearalgebra"
license = "PostgreSQL"
description = " Matrix Operations Extension for postgres."
documentation = "https://github.com/joshuajerin/pg_linearalgebra"
categories = ["analytics"]
[dependencies]
apt = ["libc6", "libgcc-s1"]
[build]
postgres_version = "14"
platform = "linux/amd64"
dockerfile = "Dockerfile"
install_command = """
cd pg_linearalgebra/
mv target/release/pg_linearalgebra-pg15/usr/lib/postgresql/15/lib/* /usr/lib/postgresql/15/lib
mv target/release/pg_linearalgebra-pg15/usr/share/postgresql/15/extension/* /usr/share/postgresql/15/extension
"""
Loading