forked from helium/miner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
63 lines (44 loc) · 1.69 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
ARG BUILDER_IMAGE=erlang:23.3.4.6-alpine
ARG RUNNER_IMAGE=erlang:23.3.4.6-alpine
FROM ${BUILDER_IMAGE} as builder
ARG REBAR_DIAGNOSTIC=0
ENV DIAGNOSTIC=${REBAR_DIAGNOSTIC}
ARG VERSION
ARG REBAR_BUILD_TARGET
ARG TAR_PATH=_build/$REBAR_BUILD_TARGET/rel/*/*.tar.gz
ARG EXTRA_BUILD_APK_PACKAGES
RUN apk add --no-cache --update \
git tar build-base linux-headers autoconf automake libtool pkgconfig \
dbus-dev bzip2 bison flex gmp-dev cmake lz4 libsodium-dev openssl-dev \
sed wget curl \
${EXTRA_BUILD_APK_PACKAGES}
# Install Rust toolchain
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
WORKDIR /usr/src/miner
ENV CC=gcc CXX=g++ CFLAGS="-U__sun__" \
ERLANG_ROCKSDB_OPTS="-DWITH_BUNDLE_SNAPPY=ON -DWITH_BUNDLE_LZ4=ON" \
ERL_COMPILER_OPTIONS="[deterministic]" \
PATH="/root/.cargo/bin:$PATH" \
RUSTFLAGS="-C target-feature=-crt-static"
# Add our code
ADD . /usr/src/miner/
RUN ./rebar3 as ${REBAR_BUILD_TARGET} tar -n miner -v ${VERSION}
RUN mkdir -p /opt/docker/update
RUN tar -zxvf ${TAR_PATH} -C /opt/docker
RUN wget -O /opt/docker/update/genesis https://snapshots.helium.wtf/genesis.mainnet
FROM ${RUNNER_IMAGE} as runner
ARG VERSION
ARG EXTRA_RUNNER_APK_PACKAGES
RUN apk add --no-cache --update ncurses dbus gmp libsodium gcc \
${EXTRA_RUNNER_APK_PACKAGES}
RUN ulimit -n 64000
WORKDIR /opt/miner
ENV COOKIE=miner \
# Write files generated during startup to /tmp
RELX_OUT_FILE_PATH=/tmp \
# add miner to path, for easy interactions
PATH=$PATH:/opt/miner/bin
COPY --from=builder /opt/docker /opt/miner
RUN ln -sf /opt/miner/releases/${VERSION} /config
ENTRYPOINT ["/opt/miner/bin/miner"]
CMD ["foreground"]