|
1 | 1 | FROM ubuntu:20.04 AS base
|
2 | 2 | RUN rm -f /etc/apt/apt.conf.d/docker-clean
|
3 |
| -RUN --mount=type=cache,target=/var/cache/apt apt-get update |
| 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-* curl \ |
| 5 | + && rm -rf /var/lib/apt/lists/* |
| 6 | +RUN groupadd --gid 1000 fuhon && useradd --uid 1000 --gid fuhon fuhon |
4 | 7 |
|
5 | 8 | FROM base AS build
|
6 |
| -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 ocl-icd-* opencl-headers libhwloc-dev |
| 9 | +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 \ |
| 10 | + && rm -rf /var/lib/apt/lists/* |
7 | 11 | RUN pip3 install scikit-build cmake requests gitpython pyyaml
|
8 | 12 | RUN curl -sL https://golang.org/dl/go1.17.3.linux-amd64.tar.gz | tar -xz -C /usr/local
|
9 | 13 | ENV PATH="$PATH:/usr/local/go/bin"
|
10 |
| -COPY . /root/cpp-filecoin |
11 |
| -RUN --mount=type=cache,target=/root/.hunter/_Base/Cache CC=clang-9 CXX=clang++-9 cmake /root/cpp-filecoin -B /root/build -G Ninja -D CMAKE_BUILD_TYPE=Release -D TESTING=OFF |
12 |
| -RUN --mount=type=cache,target=/root/.hunter/_Base/Cache CC=clang-9 cmake --build /root/build --target fuhon-node |
| 14 | +COPY . /tmp/cpp-filecoin |
| 15 | +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 |
| 16 | +RUN --mount=type=cache,target=/tmp/.hunter/_Base/Cache CC=clang-9 cmake --build /tmp/build --target fuhon-node fuhon-miner |
13 | 17 |
|
14 |
| -FROM base |
15 |
| -RUN --mount=type=cache,target=/var/cache/apt apt-get install -y --no-install-recommends hwloc ocl-icd-* |
16 |
| -COPY core/node/main/mainnet.car /root/. |
17 |
| -COPY --from=build /root/build/bin/fuhon-node /root/. |
| 18 | +FROM base AS fuhon-miner |
| 19 | +RUN --mount=type=cache,target=/var/cache/apt,sharing=shared apt-get update && apt-get install -y --no-install-recommends libarchive13 libssl1.1 \ |
| 20 | + && rm -rf /var/lib/apt/lists/* |
| 21 | +# cmake built libarchive has API v17, but provided version is v13 (https://github.com/libarchive/libarchive/issues/1236) |
| 22 | +RUN ln -s /lib/x86_64-linux-gnu/libarchive.so.13 /lib/x86_64-linux-gnu/libarchive.so.17 |
| 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 | +USER fuhon |
| 27 | +RUN mkdir /tmp/fuhon |
| 28 | +WORKDIR /tmp/fuhon |
| 29 | +ENTRYPOINT ["/miner_entrypoint.sh"] |
| 30 | +CMD ["fuhon-miner", "--repo", "fuhon-node-repo", "--miner-repo", "fuhon-miner-repo"] |
| 31 | +HEALTHCHECK --interval=5s --timeout=10s CMD curl http://127.0.0.1:1234/health || exit 1 |
| 32 | + |
| 33 | +FROM base AS fuhon-node |
| 34 | +COPY --from=build /tmp/build/bin/fuhon-node /usr/local/bin |
| 35 | +COPY docker/node_entrypoint.sh / |
| 36 | +RUN chmod +x /node_entrypoint.sh |
18 | 37 | EXPOSE 1234 2000
|
| 38 | +USER fuhon |
| 39 | +RUN mkdir /tmp/fuhon |
| 40 | +WORKDIR /tmp/fuhon |
| 41 | +ENTRYPOINT ["/node_entrypoint.sh"] |
| 42 | +CMD ["fuhon-node", "--config", "fuhon-node.cfg", "--genesis" ,"genesis.car", "--repo", "fuhon-node-repo"] |
| 43 | +HEALTHCHECK --interval=5s --timeout=10s CMD curl http://127.0.0.1:1234/health || exit 1 |
0 commit comments