From a94da96ff257cd10edda74ac897fc15a4344a08e Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Mon, 10 Apr 2023 09:48:00 -0300 Subject: [PATCH] fix sbt issue on alpine. --- Containerfile | 14 ++++++++++---- src/main/scala/Database.scala | 4 ++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/Containerfile b/Containerfile index 5d3c9b6..2b25d55 100644 --- a/Containerfile +++ b/Containerfile @@ -1,9 +1,15 @@ FROM alpine:3.16 -RUN apk add bash git clang binutils-gold cmake make libgcc musl-dev gcc g++ libc6-compat libtool automake autoconf -RUN apk add sbt --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing +RUN apk add bash git clang binutils-gold cmake make libgcc musl-dev gcc g++ libc6-compat libtool automake autoconf openjdk11 RUN git clone https://github.com/libuv/libuv && cd libuv && ./autogen.sh && ./configure && make && make install RUN git clone https://github.com/bitcoin-core/secp256k1 && cd secp256k1 && ./autogen.sh && ./configure --enable-module-schnorrsig --enable-module-recovery && make && make install COPY . /poncho -RUN cd /poncho && sbt clean compile + +# sbt +RUN mkdir /sbt +RUN cd /sbt && wget https://github.com/sbt/sbt/releases/download/v1.8.2/sbt-1.8.2.zip +RUN cd /sbt && unzip sbt-1.8.2.zip + +# build binary native static +RUN cd /poncho && /sbt/sbt/bin/sbt clean compile ENV SN_LINK=static -CMD cd /poncho && sbt clean nativeLink +CMD cd /poncho && /sbt/sbt/bin/sbt clean nativeLink diff --git a/src/main/scala/Database.scala b/src/main/scala/Database.scala index 06b393c..3501bde 100644 --- a/src/main/scala/Database.scala +++ b/src/main/scala/Database.scala @@ -129,9 +129,9 @@ class Database(val path: Path = Paths.get("poncho").toAbsolutePath()) { val newData = change(data) newData.channels - .filter((key, chandata) => + .filter { (key, chandata) => !data.channels.contains(key) || data.channels(key) != chandata - ) + } .foreach { (key, chandata) => val data = newData.channels(key) val file = channelsDir.resolve(key.toHex ++ ".json")