Skip to content

Commit

Permalink
feat: add docker to containerize a standalone boost-client (#1616)
Browse files Browse the repository at this point in the history
* feat: add docker to containerize a standalone boost-client

* chore: cleaned up mainnet docker build

* Update docker/boost-client/Dockerfile.source

thank you!

Co-authored-by: LexLuthr <[email protected]>

* modified based on review/feedback

* use make boost instead

---------

Co-authored-by: LexLuthr <[email protected]>
  • Loading branch information
Alvin Reyes and LexLuthr authored Aug 16, 2023
1 parent f164ad4 commit 8818d91
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
2 changes: 2 additions & 0 deletions docker/boost-client/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
DOCKER_USER=filecoin
BOOST_IMAGE=${DOCKER_USER}/boost-main:main
71 changes: 71 additions & 0 deletions docker/boost-client/Dockerfile.source
Original file line number Diff line number Diff line change
@@ -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"]
3 changes: 3 additions & 0 deletions docker/boost-client/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash
set -e
boost -v

0 comments on commit 8818d91

Please sign in to comment.