Skip to content

Commit 8108f25

Browse files
add fuhon-miner docker
Signed-off-by: Alexey Chernyshov <[email protected]>
1 parent 77e89a5 commit 8108f25

11 files changed

+108
-19
lines changed

docker/Dockerfile

+23-8
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,36 @@
11
FROM ubuntu:20.04 AS base
22
RUN rm -f /etc/apt/apt.conf.d/docker-clean
3-
RUN --mount=type=cache,target=/var/cache/apt apt-get update
4-
RUN --mount=type=cache,target=/var/cache/apt apt-get install -y --no-install-recommends hwloc ocl-icd-*
3+
ARG DEBIAN_FRONTEND=noninteractive
4+
RUN --mount=type=cache,target=/var/cache/apt,sharing=shared apt-get update && apt-get install -y --no-install-recommends hwloc ocl-icd-* \
5+
&& rm -rf /var/lib/apt/lists/*
56

67
FROM base AS build
7-
RUN --mount=type=cache,target=/var/cache/apt DEBIAN_FRONTEND="noninteractive" apt-get install -y --no-install-recommends git curl rsync make ninja-build clang-9 jq python3-pip python-setuptools pkg-config opencl-headers libhwloc-dev
8+
RUN --mount=type=cache,target=/var/cache/apt,sharing=shared apt-get update && apt-get install -y --no-install-recommends git curl rsync make ninja-build clang-9 jq python3-pip python-setuptools pkg-config opencl-headers libhwloc-dev zlib1g-dev libbz2-dev liblzma-dev libssl-dev libxml2-dev \
9+
&& rm -rf /var/lib/apt/lists/*
810
RUN pip3 install scikit-build cmake requests gitpython pyyaml
911
RUN curl -sL https://golang.org/dl/go1.17.3.linux-amd64.tar.gz | tar -xz -C /usr/local
1012
ENV PATH="$PATH:/usr/local/go/bin"
1113
COPY . /tmp/cpp-filecoin
1214
RUN --mount=type=cache,target=/tmp/.hunter/_Base/Cache CC=clang-9 CXX=clang++-9 cmake /tmp/cpp-filecoin -B /tmp/build -G Ninja -D CMAKE_BUILD_TYPE=Release -D TESTING=OFF
13-
RUN --mount=type=cache,target=/tmp/.hunter/_Base/Cache CC=clang-9 cmake --build /tmp/build --target fuhon-node
15+
RUN --mount=type=cache,target=/tmp/.hunter/_Base/Cache CC=clang-9 cmake --build /tmp/build --target fuhon-node fuhon-miner
1416

15-
FROM base
17+
FROM base AS fuhon-miner
18+
RUN --mount=type=cache,target=/var/cache/apt,sharing=shared apt-get update && apt-get install -y --no-install-recommends libarchive13 libssl1.1 \
19+
&& rm -rf /var/lib/apt/lists/*
20+
# cmake built libarchive has API v17, but provided version is v13 (https://github.com/libarchive/libarchive/issues/1236)
21+
RUN ln -s /lib/x86_64-linux-gnu/libarchive.so.13 /lib/x86_64-linux-gnu/libarchive.so.17
22+
WORKDIR /opt/fuhon
23+
COPY --from=build /tmp/build/bin/fuhon-miner /usr/local/bin
24+
COPY docker/miner_entrypoint.sh /
25+
RUN chmod +x /miner_entrypoint.sh
26+
ENTRYPOINT ["/miner_entrypoint.sh"]
27+
CMD ["fuhon-miner", "--repo", "fuhon-node-repo", "--miner-repo", "fuhon-miner-repo"]
28+
29+
FROM base AS fuhon-node
1630
WORKDIR /opt/fuhon
1731
COPY --from=build /tmp/build/bin/fuhon-node /usr/local/bin
1832
EXPOSE 1234 2000
19-
COPY docker/entrypoint.sh /
20-
RUN chmod +x /entrypoint.sh
21-
ENTRYPOINT ["/entrypoint.sh"]
33+
COPY docker/node_entrypoint.sh /
34+
RUN chmod +x /node_entrypoint.sh
35+
ENTRYPOINT ["/node_entrypoint.sh"]
36+
CMD ["fuhon-node", "--config", "fuhon-node.cfg", "--genesis" ,"genesis.car", "--repo", "fuhon-node-repo"]

docker/README.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@
22

33
[Docker BuildKit](https://docs.docker.com/develop/develop-images/build_enhancements/#to-enable-buildkit-builds)
44

5+
`DOCKER_BUILDKIT=1` environment variable must be set to enable BuildKit.
6+
57
## Build
68

7-
To build docker image from current context. It is advised to ignore binaries and large files from docker build context.
9+
To build docker image from the current context. It is advised to ignore binaries and large files from docker build context.
10+
11+
docker build .. -f Dockerfile
812

9-
docker build .. -f Dockerfile
13+
There are 2 targets `fuhon-node` and `fuhon-miner` declared in Dockerfile. To build a specific target use `-t` option.

docker/docker-compose-interopnet.yml

+15-4
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,21 @@ version: "3.0"
33
services:
44
fuhon-node:
55
build:
6-
context: .
7-
dockerfile: Dockerfile
6+
context: ..
7+
dockerfile: docker/Dockerfile
8+
target: fuhon-node
89
image: fuhon-node:develop-build
910
ports:
10-
- 1234:1234
11+
- "1234:1234"
1112
volumes:
12-
- ./interopnet:/opt/fuhon
13+
- ./interopnet:/opt/fuhon
14+
fuhon-miner:
15+
build:
16+
context: ..
17+
dockerfile: docker/Dockerfile
18+
target: fuhon-miner
19+
image: fuhon-miner:develop-build
20+
volumes:
21+
- ./interopnet:/opt/fuhon
22+
depends_on:
23+
- fuhon-node

docker/docker-compose-local.yml

Whitespace-only changes.

docker/docker-compose-mainnet.yml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
version: "3.0"
2+
3+
services:
4+
fuhon-node:
5+
build:
6+
context: ..
7+
dockerfile: docker/Dockerfile
8+
target: fuhon-node
9+
image: fuhon-node:develop-build
10+
ports:
11+
- "1234:1234"
12+
volumes:
13+
- ./mainnet:/opt/fuhon
14+
fuhon-miner:
15+
build:
16+
context: ..
17+
dockerfile: docker/Dockerfile
18+
target: fuhon-miner
19+
image: fuhon-miner:develop-build
20+
volumes:
21+
- ./mainnet:/opt/fuhon
22+
depends_on:
23+
- fuhon-node

docker/entrypoint.sh

-5
This file was deleted.

docker/interopnet/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
fuhon-miner-repo
12
fuhon-node-repo

docker/mainnet/.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
fuhon-miner-repo
2+
fuhon-node-repo

docker/mainnet/fuhon-node.cfg

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# use mainnet profile
2+
profile=mainnet
3+
4+
bootstrap=/dns4/bootstrap-0.mainnet.filops.net/tcp/1347/p2p/12D3KooWCVe8MmsEMes2FzgTpt9fXtmCY7wrq91GRiaC8PHSCCBj
5+
bootstrap=/dns4/bootstrap-1.mainnet.filops.net/tcp/1347/p2p/12D3KooWCwevHg1yLCvktf2nvLu7L9894mcrJR4MsBCcm4syShVc
6+
bootstrap=/dns4/bootstrap-2.mainnet.filops.net/tcp/1347/p2p/12D3KooWEWVwHGn2yR36gKLozmb4YjDJGerotAPGxmdWZx2nxMC4
7+
bootstrap=/dns4/bootstrap-3.mainnet.filops.net/tcp/1347/p2p/12D3KooWKhgq8c7NQ9iGjbyK7v7phXvG6492HQfiDaGHLHLQjk7R
8+
bootstrap=/dns4/bootstrap-4.mainnet.filops.net/tcp/1347/p2p/12D3KooWL6PsFNPhYftrJzGgF5U18hFoaVhfGk7xwzD8yVrHJ3Uc
9+
bootstrap=/dns4/bootstrap-5.mainnet.filops.net/tcp/1347/p2p/12D3KooWLFynvDQiUpXoHroV1YxKHhPJgysQGH2k3ZGwtWzR4dFH
10+
bootstrap=/dns4/bootstrap-6.mainnet.filops.net/tcp/1347/p2p/12D3KooWP5MwCiqdMETF9ub1P3MbCvQCcfconnYHbWg6sUJcDRQQ
11+
bootstrap=/dns4/bootstrap-7.mainnet.filops.net/tcp/1347/p2p/12D3KooWRs3aY1p3juFjPy8gPN95PEQChm2QKGUCAdcDCC4EBMKf
12+
bootstrap=/dns4/bootstrap-8.mainnet.filops.net/tcp/1347/p2p/12D3KooWScFR7385LTyR4zU1bYdzSiiAb5rnNABfVahPvVSzyTkR
13+
bootstrap=/dns4/lotus-bootstrap.ipfsforce.com/tcp/41778/p2p/12D3KooWGhufNmZHF3sv48aQeS13ng5XVJZ9E6qy2Ms4VzqeUsHk
14+
bootstrap=/dns4/bootstrap-0.starpool.in/tcp/12757/p2p/12D3KooWGHpBMeZbestVEWkfdnC9u7p6uFHXL1n7m1ZBqsEmiUzz
15+
bootstrap=/dns4/bootstrap-1.starpool.in/tcp/12757/p2p/12D3KooWQZrGH1PxSNZPum99M1zNvjNFM33d1AAu5DcvdHptuU7u
16+
bootstrap=/dns4/node.glif.io/tcp/1235/p2p/12D3KooWBF8cpp65hp2u9LK5mh19x67ftAam84z9LsfaquTDSBpt
17+
bootstrap=/dns4/bootstrap-0.ipfsmain.cn/tcp/34721/p2p/12D3KooWQnwEGNqcM2nAcPtRR9rAX8Hrg4k9kJLCHoTR5chJfz6d
18+
bootstrap=/dns4/bootstrap-1.ipfsmain.cn/tcp/34723/p2p/12D3KooWMKxMkD5DMpSWsW7dBddKxKT7L2GgbNuckz9otxvkvByP

docker/miner_entrypoint.sh

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
# if first arg looks like a flag, assume we want to run fuhon-miner
6+
if [ "${1:0:1}" = '-' ]; then
7+
set -- fuhon-miner "$@"
8+
fi
9+
10+
exec "$@"

docker/node_entrypoint.sh

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
# if first arg looks like a flag, assume we want to run fuhon-node
6+
if [ "${1:0:1}" = '-' ]; then
7+
set -- fuhon-node "$@"
8+
fi
9+
10+
exec "$@"

0 commit comments

Comments
 (0)