From f8a04b5b4940b7376ce2d541516d42b22bc87418 Mon Sep 17 00:00:00 2001 From: Azizul Hakimi Mohd Yussuf Izzudin Date: Sat, 5 Oct 2024 12:05:55 +0800 Subject: [PATCH] Working Dockerfile --- Dockerfile | 47 ++++++++++++++++++++++++++++++++++------------- 1 file changed, 34 insertions(+), 13 deletions(-) diff --git a/Dockerfile b/Dockerfile index ad7f40d0..1efcd18d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ # Multistage docker build, requires docker 17.05 # builder stage -FROM ubuntu:20.04 as builder +FROM ubuntu:20.04 AS builder RUN set -ex && \ apt-get update && \ @@ -17,20 +17,38 @@ RUN set -ex && \ git \ libtool \ pkg-config \ - gperf + gperf \ + libboost-all-dev \ + miniupnpc \ + libunbound-dev \ + graphviz \ + doxygen \ + libunwind8-dev \ + libssl-dev \ + libzmq3-dev \ + libsodium-dev \ + libhidapi-dev \ + libnorm-dev \ + libusb-1.0-0-dev \ + libpgm-dev \ + libprotobuf-dev \ + protobuf-compiler WORKDIR /src COPY . . + ARG NPROC RUN set -ex && \ git submodule init && git submodule update && \ - rm -rf build && \ - if [ -z "$NPROC" ] ; \ - then make -j$(nproc) depends target=x86_64-linux-gnu ; \ - else make -j$NPROC depends target=x86_64-linux-gnu ; \ + rm -rf build + +RUN if [ -z "$NPROC" ] ; \ + then cmake -S . -B build -D ARCH="default" -D BUILD_TESTS=ON -D CMAKE_BUILD_TYPE=Release && cmake --build build -j$(nproc); \ + else cmake -S . -B build -D ARCH="default" -D BUILD_TESTS=ON -D CMAKE_BUILD_TYPE=Release && cmake --build build -j$NPROC; \ fi + # runtime stage FROM ubuntu:20.04 @@ -39,28 +57,31 @@ RUN set -ex && \ apt-get --no-install-recommends --yes install ca-certificates && \ apt-get clean && \ rm -rf /var/lib/apt -COPY --from=builder /src/build/x86_64-linux-gnu/release/bin /usr/local/bin/ + +COPY --from=builder /src/build/bin/ /usr/local/bin/ + +RUN ls /usr/local/bin/ # Create scala user RUN adduser --system --group --disabled-password scala && \ - mkdir -p /wallet /home/scala/.bitscala && \ - chown -R scala:scala /home/scala/.bitscala && \ + mkdir -p /wallet /home/scala/.scala && \ + chown -R scala:scala /home/scala/.scala && \ chown -R scala:scala /wallet # Contains the blockchain -VOLUME /home/scala/.bitscala +VOLUME /home/scala/.scala # Generate your wallet via accessing the container and run: # cd /wallet # scala-wallet-cli VOLUME /wallet -EXPOSE 18080 -EXPOSE 18081 +EXPOSE 11811 +EXPOSE 11812 # switch to user scala USER scala ENTRYPOINT ["scalad"] -CMD ["--p2p-bind-ip=0.0.0.0", "--p2p-bind-port=18080", "--rpc-bind-ip=0.0.0.0", "--rpc-bind-port=18081", "--non-interactive", "--confirm-external-bind"] +CMD ["--p2p-bind-ip=0.0.0.0", "--p2p-bind-port=11811", "--rpc-bind-ip=0.0.0.0", "--rpc-bind-port=11812", "--non-interactive", "--confirm-external-bind"]