Skip to content

Instantly share code, notes, and snippets.

@itdaniher
Created November 5, 2020 00:47
Show Gist options
  • Save itdaniher/8a1af03ba85b5f6a6eaeb7d0816579c6 to your computer and use it in GitHub Desktop.
Save itdaniher/8a1af03ba85b5f6a6eaeb7d0816579c6 to your computer and use it in GitHub Desktop.
leveldbjni for arm32 / armv7l
FROM adoptopenjdk/openjdk11:armv7l-debian-jdk-11.0.8_10
WORKDIR /app
RUN apt update && apt install -y wget
RUN wget -O /app/Amm https://github.com/lihaoyi/Ammonite/releases/download/2.2.0/2.12-2.2.0 && chmod +x /app/Amm
RUN apt install -y git build-essential automake unzip
# grab leveldb source and patch it
RUN git clone git://github.com/chirino/leveldb.git && cd leveldb && wget https://raw.githubusercontent.com/fusesource/leveldbjni/master/leveldb.patch && git apply ./leveldb.patch
# no make install target in leveldb, so manually copy libs
RUN cd /app/leveldb && make -j3 && cp libleveldb.* /usr/lib/
# grab native source blob from maven
RUN wget https://repo1.maven.org/maven2/org/fusesource/leveldbjni/leveldbjni/1.8/leveldbjni-1.8-native-src.zip
# build and install
RUN unzip leveldbjni-1.8-native-src.zip && cd leveldbjni-1.8-native-src && chmod +x ./configure && ./configure --with-leveldb=/app/leveldb --prefix=/usr && make -j8 && make install
COPY test.scala /app/test.sc
CMD ["java", "-jar", "/app/Amm", "-c", "import $file.test"]
import $ivy.`org.fusesource.leveldbjni:leveldbjni-all:1.8`
import org.iq80.leveldb
import org.fusesource.leveldbjni.JniDBFactory
var options = new leveldb.Options
options.createIfMissing(true)
JniDBFactory.factory.open(new java.io.File("/app/foo"), options)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment