Skip to content

Commit

Permalink
Added docker file
Browse files Browse the repository at this point in the history
  • Loading branch information
shhnwz committed Apr 16, 2024
1 parent 0341961 commit 759877c
Show file tree
Hide file tree
Showing 5 changed files with 109 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pg_tier"
version = "0.0.2"
version = "0.0.3"
edition = "2021"

[lib]
Expand Down
2 changes: 1 addition & 1 deletion Trunk.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description = "Open source s3 tiering extension for Postgres."
homepage = "https://github.com/tembo-io/pg_tier"
documentation = "https://github.com/tembo-io/pg_tier"
categories = ["analytics", "connectors"]
version = "0.0.2"
version = "0.0.3"

[build]
postgres_version = "15"
Expand Down
10 changes: 10 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: '3.2'

services:
postgres:
restart: always
image: quay.io/tembo/tier-pg:latest
ports:
- 5432:5432
environment:
- POSTGRES_PASSWORD=postgres
96 changes: 96 additions & 0 deletions images/tier-pg/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
FROM postgres:15.4-bookworm as builder

ARG PGTIER_VER=0.0.3
ARG PGRX_VER=0.11.3

RUN apt-get update \
&& apt-get install -y \
ca-certificates \
clang \
curl \
gcc \
git \
libssl-dev \
make \
pkg-config \
postgresql-server-dev-15 \
automake \
bison \
build-essential \
ccache \
cmake \
flex \
g++ \
libboost-all-dev \
libcurl4-openssl-dev \
libevent-dev \
libprotobuf-dev \
libprotoc-dev \
libreadline-dev \
libssl-dev \
libtool \
libxml2-dev \
libxml2-utils \
libxslt-dev \
protobuf-compiler \
xsltproc \
zlib1g-dev \
&& rm -rf /var/lib/apt/lists/*

# Clone and build AWS SDK for C++
RUN git clone https://github.com/aws/aws-sdk-cpp.git && \
cd aws-sdk-cpp && \
git checkout 1.9.263 && \
git submodule update --init --recursive && \
mkdir build && cd build && \
cmake -DBUILD_ONLY="s3;core;config;sts;cognito-identity;transfer;identity-management" -DAUTORUN_UNIT_TESTS=OFF -DCMAKE_CXX_FLAGS=-Wno-error=deprecated-declarations .. && \
make -j$(nproc) && \
make install && \
cd ../../ && rm -rf aws-sdk-cpp

# Clone and build Apache Arrow
RUN git clone https://github.com/apache/arrow.git && \
cd arrow && \
git checkout apache-arrow-7.0.1 && \
cd cpp && \
mkdir build && cd build && \
cmake -DARROW_PARQUET=ON -DARROW_S3=ON -DARROW_WITH_SNAPPY=ON .. && \
make -j$(nproc) && \
make install && \
cd ../../ && rm -rf arrow

# Clone and build parquet_s3_fdw
RUN git clone https://github.com/pgspider/parquet_s3_fdw.git && \
cd parquet_s3_fdw && \
git checkout v1.1.0 \
make install PG_CONFIG=$(which pg_config)

WORKDIR /pg_tier

# Install Rust dependencies
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
RUN $HOME/.cargo/bin/rustup default stable

# install pgrx
RUN $HOME/.cargo/bin/cargo install cargo-pgrx --version=$PGRX_VER --locked

# init pgrx with postgres
RUN $HOME/.cargo/bin/cargo pgrx init --pg15 $(which pg_config)

# install pg_tier
RUN git clone https://github.com/tembo-io/pg_tier.git && \
cd pg_tier && git fetch origin v$PGTIER_VER && \
git checkout v$PGTIER_VER && \
$HOME/.cargo/bin/cargo pgrx install --pg-config=$(which pg_config) && \
cd .. && rm -rf pg_tier

FROM postgres:15.4-bookworm

COPY --from=builder /usr/share/postgresql/15/extension /usr/share/postgresql/15/extension
COPY --from=builder /usr/lib/postgresql/15/lib /usr/lib/postgresql/15/lib

RUN apt-get update \
&& apt-get install -y ca-certificates

USER postgres
CMD ["postgres"]

0 comments on commit 759877c

Please sign in to comment.