diff --git a/Makefile b/Makefile index 92508770a..8798b88f7 100644 --- a/Makefile +++ b/Makefile @@ -250,6 +250,13 @@ docker/lotus-all-in-one: info/lotus-all-in-one | $(lotus_src_dir) -t $(lotus_base_image) --build-arg GOFLAGS=-tags=debug . .PHONY: docker/lotus-all-in-one +# boost-client main +docker/mainnet/boost-client: build/.update-modules + DOCKER_BUILDKIT=1 $(docker_build_cmd) \ + -t $(docker_user)/boost-main:main --build-arg BUILD_VERSION=dev \ + -f docker/boost-client/Dockerfile.source --target boost-main . +.PHONY: docker/mainnet/boost-client + ### devnet images docker/%: cd docker/devnet/$* && DOCKER_BUILDKIT=1 $(docker_build_cmd) -t $(docker_user)/$*-dev:dev \ diff --git a/docker/boost-client/.env b/docker/boost-client/.env new file mode 100644 index 000000000..7223bbc34 --- /dev/null +++ b/docker/boost-client/.env @@ -0,0 +1,2 @@ +DOCKER_USER=filecoin +BOOST_IMAGE=${DOCKER_USER}/boost-main:main diff --git a/docker/boost-client/Dockerfile.source b/docker/boost-client/Dockerfile.source new file mode 100644 index 000000000..eeecbccd6 --- /dev/null +++ b/docker/boost-client/Dockerfile.source @@ -0,0 +1,71 @@ +######################################################################################### +FROM golang:1.20-bullseye as builder + +RUN apt update && apt install -y \ + build-essential \ + bzr pkg-config \ + clang \ + curl \ + gcc git \ + hwloc \ + jq \ + libhwloc-dev wget \ + mesa-opencl-icd \ + ocl-icd-opencl-dev + +WORKDIR /go/src/ + +COPY Makefile /go/src/ +### make configurable filecoin-ffi build +ARG FFI_BUILD_FROM_SOURCE=0 +ENV FFI_BUILD_FROM_SOURCE=${FFI_BUILD_FROM_SOURCE} +############################################## +# prebuild filecoin-ffi +COPY extern /go/src/extern +COPY build /go/src/build +COPY .git/modules/extern/filecoin-ffi /go/src/.git/modules/extern/filecoin-ffi + +RUN make build/.filecoin-install +############################################## +COPY . /go/src +############################################## + +RUN --mount=type=cache,target=/root/.cache/go-build \ + --mount=type=cache,target=/go/pkg/mod \ + make boost +######################################################################################### +FROM ubuntu:20.04 as runner + +RUN apt update && apt install -y \ + curl \ + hwloc \ + jq + +## Fix missing lib libhwloc.so.5 +RUN ls -1 /lib/*/libhwloc.so.* | head -n 1 | xargs -n1 -I {} ln -s {} /lib/libhwloc.so.5 + +WORKDIR /app + +######################################################################################### +FROM runner as boost-main + +ARG BUILD_VERSION=0.1 + +LABEL org.opencontainers.image.version=$BUILD_VERSION \ + org.opencontainers.image.authors="Boost Dev Team" \ + name="boost-client" \ + maintainer="Boost Dev Team" \ + vendor="Boost Dev Team" \ + version=$BUILD_VERSION \ + release=$BUILD_VERSION \ + summary="This image is used to host the boost-dev storage provider" \ + description="This image is used to host the boost-dev storage provider" + +ENV BOOST_PATH /var/lib/boost +VOLUME /var/lib/boost +EXPOSE 8080 + +COPY --from=builder /go/src/boost /usr/local/bin/ +COPY docker/boost-client/entrypoint.sh /app/ + +ENTRYPOINT ["./entrypoint.sh"] \ No newline at end of file diff --git a/docker/boost-client/entrypoint.sh b/docker/boost-client/entrypoint.sh new file mode 100755 index 000000000..bcd395bf2 --- /dev/null +++ b/docker/boost-client/entrypoint.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +set -e +boost -v \ No newline at end of file