forked from mimblewimble/grin-miner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
52 lines (38 loc) · 1.51 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
# Multistage docker build, requires docker 17.05
# builder stage
FROM nvidia/cuda:10.0-devel as builder
RUN set -ex && \
apt-get update && \
apt-get --no-install-recommends --yes install \
libncurses5-dev \
libncursesw5-dev \
cmake \
git \
curl \
libssl-dev \
pkg-config
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
RUN git clone https://github.com/mimblewimble/grin-miner && cd grin-miner && git submodule update --init
RUN cd grin-miner && sed -i '/^cuckoo_miner = {/s/^/#/' Cargo.toml && sed -i '/^#.*build-cuda-plugins"]/s/^#//' Cargo.toml
RUN cd grin-miner && $HOME/.cargo/bin/cargo build --release
# runtime stage
FROM nvidia/cuda:10.0-base
RUN set -ex && \
apt-get update && \
apt-get --no-install-recommends --yes install \
libncurses5 \
libncursesw5
COPY --from=builder /grin-miner/target/release/grin-miner /grin-miner/target/release/grin-miner
COPY --from=builder /grin-miner/target/release/plugins/* /grin-miner/target/release/plugins/
COPY --from=builder /grin-miner/grin-miner.toml /grin-miner/grin-miner.toml
WORKDIR /grin-miner
RUN sed -i -e 's/run_tui = true/run_tui = false/' grin-miner.toml
RUN echo '#!/bin/bash\n\
if [ $# -eq 1 ]\n\
then\n\
sed -i -e 's/127.0.0.1/\$1/g' grin-miner.toml\n\
fi\n\
./target/release/grin-miner' > run.sh
# If the grin server is not at 127.0.0.1 provide the ip or hostname to the container
# by command line (i.e. docker run --name miner1 --rm -i -t miner_image 1.2.3.4)
ENTRYPOINT ["sh", "run.sh"]