From 96b2d1330720c02ad2f47e0c686f42030a82af60 Mon Sep 17 00:00:00 2001 From: Akito Date: Fri, 25 Aug 2023 14:50:08 +0200 Subject: [PATCH 1/3] Backup Ubuntu Image --- ubuntu.Dockerfile | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 ubuntu.Dockerfile diff --git a/ubuntu.Dockerfile b/ubuntu.Dockerfile new file mode 100644 index 0000000..15ccff0 --- /dev/null +++ b/ubuntu.Dockerfile @@ -0,0 +1,24 @@ +FROM ubuntu:jammy as build +ENV TZ=Europe/London +WORKDIR /build +RUN apt update && apt install -y --no-install-recommends \ + git g++ make pkg-config libtool ca-certificates \ + libyaml-perl libtemplate-perl libregexp-grammars-perl libssl-dev zlib1g-dev \ + liblmdb-dev libflatbuffers-dev libsecp256k1-dev \ + libzstd-dev + +COPY . . +RUN git submodule update --init +RUN make setup-golpe +RUN make -j4 + +FROM ubuntu:jammy as runner +WORKDIR /app + +RUN apt update && apt install -y --no-install-recommends \ + liblmdb0 libflatbuffers1 libsecp256k1-0 libb2-1 libzstd1 \ + && rm -rf /var/lib/apt/lists/* + +COPY --from=build /build/strfry strfry +ENTRYPOINT ["/app/strfry"] +CMD ["relay"] From 2d422b9803501939d3593c1ff10d66cbc988c322 Mon Sep 17 00:00:00 2001 From: Akito Date: Fri, 25 Aug 2023 14:50:46 +0200 Subject: [PATCH 2/3] Add Alpine Master Image --- Dockerfile | 45 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index 15ccff0..11b4cb4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,23 +1,48 @@ -FROM ubuntu:jammy as build +# Built by Akito +# npub1wprtv89px7z2ut04vvquscpmyfuzvcxttwy2csvla5lvwyj807qqz5aqle + +FROM alpine:3.18.3 as build ENV TZ=Europe/London WORKDIR /build -RUN apt update && apt install -y --no-install-recommends \ - git g++ make pkg-config libtool ca-certificates \ - libyaml-perl libtemplate-perl libregexp-grammars-perl libssl-dev zlib1g-dev \ - liblmdb-dev libflatbuffers-dev libsecp256k1-dev \ - libzstd-dev +RUN \ + apk --no-cache add \ + linux-headers \ + git \ + g++ \ + make \ + pkgconfig \ + libtool \ + ca-certificates \ + perl-yaml-libyaml \ + perl-yaml \ + perl-template-toolkit \ + perl-app-cpanminus \ + libressl-dev \ + zlib-dev \ + lmdb-dev \ + flatbuffers-dev \ + libsecp256k1-dev \ + zstd-dev \ + && rm -rf /var/cache/apk/* \ + && cpanm Regexp::Grammars COPY . . RUN git submodule update --init RUN make setup-golpe RUN make -j4 -FROM ubuntu:jammy as runner +FROM alpine:3.18.3 WORKDIR /app -RUN apt update && apt install -y --no-install-recommends \ - liblmdb0 libflatbuffers1 libsecp256k1-0 libb2-1 libzstd1 \ - && rm -rf /var/lib/apt/lists/* +RUN \ + apk --no-cache add \ + lmdb \ + flatbuffers \ + libsecp256k1 \ + libb2 \ + zstd \ + libressl3.7-libssl \ + && rm -rf /var/cache/apk/* COPY --from=build /build/strfry strfry ENTRYPOINT ["/app/strfry"] From a16e214f1b1da0b2b011049370d81fefe2953ffc Mon Sep 17 00:00:00 2001 From: Akito Date: Fri, 25 Aug 2023 15:20:44 +0200 Subject: [PATCH 3/3] Optimise Dockerfile --- Dockerfile | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index 11b4cb4..d48c80e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,14 @@ # Built by Akito # npub1wprtv89px7z2ut04vvquscpmyfuzvcxttwy2csvla5lvwyj807qqz5aqle -FROM alpine:3.18.3 as build +FROM alpine:3.18.3 AS build + ENV TZ=Europe/London + WORKDIR /build + +COPY . . + RUN \ apk --no-cache add \ linux-headers \ @@ -13,7 +18,6 @@ RUN \ pkgconfig \ libtool \ ca-certificates \ - perl-yaml-libyaml \ perl-yaml \ perl-template-toolkit \ perl-app-cpanminus \ @@ -24,14 +28,13 @@ RUN \ libsecp256k1-dev \ zstd-dev \ && rm -rf /var/cache/apk/* \ - && cpanm Regexp::Grammars - -COPY . . -RUN git submodule update --init -RUN make setup-golpe -RUN make -j4 + && cpanm Regexp::Grammars \ + && git submodule update --init \ + && make setup-golpe \ + && make -j4 FROM alpine:3.18.3 + WORKDIR /app RUN \ @@ -41,9 +44,12 @@ RUN \ libsecp256k1 \ libb2 \ zstd \ - libressl3.7-libssl \ + libressl \ && rm -rf /var/cache/apk/* COPY --from=build /build/strfry strfry + +EXPOSE 7777 + ENTRYPOINT ["/app/strfry"] CMD ["relay"]