Skip to content

Commit

Permalink
Working Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmyi authored Oct 5, 2024
1 parent 92e6401 commit f8a04b5
Showing 1 changed file with 34 additions and 13 deletions.
47 changes: 34 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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 && \
Expand All @@ -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

Expand All @@ -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"]

0 comments on commit f8a04b5

Please sign in to comment.