diff --git a/Dockerfile b/Dockerfile index f531722..7c0e438 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,10 +14,25 @@ FROM docker.io/library/ruby:$RUBY_VERSION-slim AS base # Rails app lives here WORKDIR /rails -# Install base packages +# Install base packages and DuckDB library +ARG TARGETPLATFORM RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y curl libjemalloc2 libvips sqlite3 && \ + apt-get install --no-install-recommends -y curl libjemalloc2 libvips sqlite3 wget unzip && \ ln -s /usr/lib/$(uname -m)-linux-gnu/libjemalloc.so.2 /usr/local/lib/libjemalloc.so && \ + case "$TARGETPLATFORM" in \ + "linux/amd64") \ + DUCKDB_ARCH="amd64" ;; \ + "linux/arm64") \ + DUCKDB_ARCH="arm64" ;; \ + *) \ + echo "Unsupported platform: $TARGETPLATFORM" && exit 1 ;; \ + esac && \ + wget "https://install.duckdb.org/v1.4.2/libduckdb-linux-${DUCKDB_ARCH}.zip" -O /tmp/libduckdb.zip && \ + unzip /tmp/libduckdb.zip -d /tmp/duckdb && \ + cp /tmp/duckdb/duckdb.h /tmp/duckdb/duckdb.hpp /usr/local/include/ && \ + cp /tmp/duckdb/libduckdb.so /usr/local/lib/ && \ + ldconfig && \ + rm -rf /tmp/libduckdb.zip /tmp/duckdb && \ rm -rf /var/lib/apt/lists /var/cache/apt/archives # Set production environment variables and enable jemalloc for reduced memory usage and latency. diff --git a/Gemfile b/Gemfile index 9ad90a8..e94ace4 100644 --- a/Gemfile +++ b/Gemfile @@ -94,3 +94,5 @@ end gem "sentry-rails", "~> 6.1" gem "postgresql_cursor", "~> 0.6.9" + +gem "duckdb", "~> 1.4" diff --git a/Gemfile.lock b/Gemfile.lock index 21eaa1a..74f2fc8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -116,6 +116,8 @@ GEM device_detector (1.1.3) dotenv (3.1.8) drb (2.2.3) + duckdb (1.4.1.1) + bigdecimal (>= 3.1.4) ed25519 (1.4.0) email_validator (2.2.4) activemodel @@ -488,6 +490,7 @@ DEPENDENCIES countries debug device_detector + duckdb (~> 1.4) httparty image_processing (~> 1.2) importmap-rails diff --git a/VERSION b/VERSION index b1e80bb..0ea3a94 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.1.3 +0.2.0