Skip to content

Instantly share code, notes, and snippets.

@tumf
Created January 13, 2021 21:28
Show Gist options
  • Save tumf/4f820e655b0e252d2afc3e2ea73d6a64 to your computer and use it in GitHub Desktop.
Save tumf/4f820e655b0e252d2afc3e2ea73d6a64 to your computer and use it in GitHub Desktop.
ARG rocksdb_version="6.15.2"
ARG ruby_version="2.7.2"
FROM golang:alpine as build-stage
ARG rocksdb_version
RUN apk add --update --no-cache build-base linux-headers git cmake bash perl
RUN apk add --update --no-cache zlib zlib-dev bzip2 bzip2-dev snappy snappy-dev lz4 lz4-dev zstd zstd-dev gflags
# Install Rocksdb
RUN cd /tmp && \
git clone --depth 1 https://github.com/facebook/rocksdb.git -b v${rocksdb_version} && \
cd rocksdb && \
make shared_lib && \
mkdir -p /usr/local/rocksdb/lib && \
mkdir /usr/local/rocksdb/include && \
cp librocksdb.so* /usr/local/rocksdb/lib && \
cp /usr/local/rocksdb/lib/librocksdb.so* /usr/lib/ && \
cp -r include /usr/local/rocksdb/ && \
cp -r include/* /usr/include/ && \
rm -R /tmp/rocksdb/
FROM ruby:${ruby_version}-alpine
ARG ruby_version
COPY --from=build-stage /usr/local/rocksdb /usr/local/
RUN apk add --no-cache --update --virtual=build-dependencies build-base linux-headers gcc g++ && \
gem install rocksdb-ruby && \
apk del build-dependencies && \
rm -rf /tmp/* /var/tmp/* /var/cache/apk/*
RUN apk add --update --no-cache snappy gflags libbz2 zlib lz4-libs zstd-libs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment