Skip to content

Instantly share code, notes, and snippets.

@itdaniher
Created November 5, 2020 00:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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