Merge pull request #9625 from filecoin-project/btrfly-calib-all-in-one

_ci_ Build docker containers automatically for butterflynet, calibnet, and debug
This commit is contained in:
Ian Davis 2022-11-29 17:15:58 +00:00 committed by GitHub
commit c3223f446e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 527 additions and 162 deletions

View File

@ -1,6 +1,7 @@
version: 2.1 version: 2.1
orbs: orbs:
aws-cli: circleci/aws-cli@1.3.2 aws-cli: circleci/aws-cli@1.3.2
docker: circleci/docker@2.1.4
executors: executors:
golang: golang:
@ -583,6 +584,92 @@ jobs:
shell: /bin/bash -o pipefail shell: /bin/bash -o pipefail
command: | command: |
snapcraft upload *.snap --release << parameters.channel >> snapcraft upload *.snap --release << parameters.channel >>
build-docker:
description: >
Publish to Dockerhub
executor: docker/docker
parameters:
image:
type: string
default: lotus
description: >
Passed to the docker build process to determine which image in the
Dockerfile should be built. Expected values are `lotus`,
`lotus-all-in-one`
network:
type: string
default: "mainnet"
description: >
Passed to the docker build process using GOFLAGS+=-tags=<<network>>.
Expected values are `debug`, `2k`, `calibnet`, `butterflynet`,
`interopnet`.
channel:
type: string
default: ""
description: >
The release channel to use for this image.
push:
type: boolean
default: false
description: >
When true, pushes the image to Dockerhub
steps:
- setup_remote_docker
- checkout
- docker/check:
docker-username: DOCKERHUB_USERNAME
docker-password: DOCKERHUB_PASSWORD
- when:
condition:
equal: [ mainnet, <<parameters.network>> ]
steps:
- when:
condition: <parameters.push>>
steps:
- docker/build:
image: filecoin/<<parameters.image>>
extra_build_args: --target <<parameters.image>>
tag: <<parameters.channel>>
- run:
name: Docker push
command: |
echo docker push filecoin/<<parameters.image>>:<<parameters.channel>>
if [[ ! -z $CIRCLE_TAG ]]; then
docker image tag filecoin/<<parameters.image>>:<<parameters.channel>> filecoin/<<parameters.image>>:"${CIRCLE_TAG}"
echo docker push filecoin/<<parameters.image>>:"${CIRCLE_TAG}"
fi
- unless:
condition: <<parameters.push>>
steps:
- docker/build:
image: filecoin/<<parameters.image>>
extra_build_args: --target <<parameters.image>>
- when:
condition:
not:
equal: [ mainnet, <<parameters.network>> ]
steps:
- when:
condition: <<parameters.push>>
steps:
- docker/build:
image: filecoin/<<parameters.image>>
extra_build_args: --target <<parameters.image>> --build-arg GOFLAGS=-tags=<<parameters.network>>
tag: <<parameters.channel>>-<<parameters.network>>
- run:
name: Docker push
command: |
echo docker push filecoin/<<parameters.image>>:<<parameters.channel>>-<<parameters.network>>
if [[ ! -z $CIRCLE_TAG ]]; then
docker image tag filecoin/<<parameters.image>>:<<parameters.channel>>-<<parameters.network>> filecoin/<<parameters.image>>:"${CIRCLE_TAG}"-<<parameters.network>>
echo docker push filecoin/<<parameters.image>>:"${CIRCLE_TAG}"-<<parameters.network>>
fi
- unless:
condition: <<parameters.push>>
steps:
- docker/build:
image: filecoin/<<parameters.image>>
extra_build_args: --target <<parameters.image>> --build-arg GOFLAGS=-tags=<<parameters.network>>
publish-packer-snap: publish-packer-snap:
description: build packer image with snap. mainnet only. description: build packer image with snap. mainnet only.
@ -592,51 +679,6 @@ jobs:
- checkout - checkout
- packer_build: - packer_build:
template: tools/packer/lotus-snap.pkr.hcl template: tools/packer/lotus-snap.pkr.hcl
publish-dockerhub:
description: publish to dockerhub
machine:
image: ubuntu-2004:202010-01
parameters:
tag:
type: string
default: latest
steps:
- checkout
- run:
name: dockerhub login
command: echo $DOCKERHUB_PASSWORD | docker login --username $DOCKERHUB_USERNAME --password-stdin
- run:
name: docker build
command: |
docker build --target lotus -t filecoin/lotus:<< parameters.tag >> -f Dockerfile.lotus .
docker build --target lotus-gateway -t filecoin/lotus-gateway:<< parameters.tag >> -f Dockerfile.lotus .
docker build --target lotus-all-in-one -t filecoin/lotus-all-in-one:<< parameters.tag >> -f Dockerfile.lotus .
if [[ ! -z $CIRCLE_SHA1 ]]; then
docker build --target lotus -t filecoin/lotus:$CIRCLE_SHA1 -f Dockerfile.lotus .
docker build --target lotus-gateway -t filecoin/lotus-gateway:$CIRCLE_SHA1 -f Dockerfile.lotus .
docker build --target lotus-all-in-one -t filecoin/lotus-all-in-one:$CIRCLE_SHA1 -f Dockerfile.lotus .
fi
if [[ ! -z $CIRCLE_TAG ]]; then
docker build --target lotus -t filecoin/lotus:$CIRCLE_TAG -f Dockerfile.lotus .
docker build --target lotus-gateway -t filecoin/lotus-gateway:$CIRCLE_TAG -f Dockerfile.lotus .
docker build --target lotus-all-in-one -t filecoin/lotus-all-in-one:$CIRCLE_TAG -f Dockerfile.lotus .
fi
- run:
name: docker push
command: |
docker push filecoin/lotus:<< parameters.tag >>
docker push filecoin/lotus-gateway:<< parameters.tag >>
docker push filecoin/lotus-all-in-one:<< parameters.tag >>
if [[ ! -z $CIRCLE_SHA1 ]]; then
docker push filecoin/lotus:$CIRCLE_SHA1
docker push filecoin/lotus-gateway:$CIRCLE_SHA1
docker push filecoin/lotus-all-in-one:$CIRCLE_SHA1
fi
if [[ ! -z $CIRCLE_TAG ]]; then
docker push filecoin/lotus:$CIRCLE_TAG
docker push filecoin/lotus-gateway:$CIRCLE_TAG
docker push filecoin/lotus-all-in-one:$CIRCLE_TAG
fi
workflows: workflows:
version: 2.1 version: 2.1
@ -1074,28 +1116,6 @@ workflows:
tags: tags:
only: only:
- /^v\d+\.\d+\.\d+(-rc\d+)?$/ - /^v\d+\.\d+\.\d+(-rc\d+)?$/
- publish-snapcraft:
name: "Publish Snapcraft (lotus-filecoin / candidate)"
channel: stable
snap-name: lotus-filecoin
filters:
branches:
ignore:
- /.*/
tags:
only:
- /^v\d+\.\d+\.\d+$/
- publish-snapcraft:
name: "Publish Snapcraft (lotus-filecoin / candidate)"
channel: candidate
snap-name: lotus-filecoin
filters:
branches:
ignore:
- /.*/
tags:
only:
- /^v\d+\.\d+\.\d+-rc\d+$/
- publish-snapcraft: - publish-snapcraft:
name: "Publish Snapcraft (lotus / stable)" name: "Publish Snapcraft (lotus / stable)"
channel: stable channel: stable
@ -1118,9 +1138,10 @@ workflows:
tags: tags:
only: only:
- /^v\d+\.\d+\.\d+-rc\d+$/ - /^v\d+\.\d+\.\d+-rc\d+$/
- publish-dockerhub: - publish-snapcraft:
name: "Publish Dockerhub (stable)" name: "Publish Snapcraft (lotus-filecoin / stable)"
tag: stable channel: stable
snap-name: lotus-filecoin
filters: filters:
branches: branches:
ignore: ignore:
@ -1128,9 +1149,10 @@ workflows:
tags: tags:
only: only:
- /^v\d+\.\d+\.\d+$/ - /^v\d+\.\d+\.\d+$/
- publish-dockerhub: - publish-snapcraft:
name: "Publish Dockerhub (candidate)" name: "Publish Snapcraft (lotus-filecoin / candidate)"
tag: candidate channel: candidate
snap-name: lotus-filecoin
filters: filters:
branches: branches:
ignore: ignore:
@ -1138,6 +1160,146 @@ workflows:
tags: tags:
only: only:
- /^v\d+\.\d+\.\d+-rc\d+$/ - /^v\d+\.\d+\.\d+-rc\d+$/
- build-docker:
name: "Docker push (lotus-all-in-one / stable / mainnet)"
image: lotus-all-in-one
channel: stable
network: mainnet
push: true
filters:
branches:
ignore:
- /.*/
tags:
only:
- /^v\d+\.\d+\.\d+$/
- build-docker:
name: "Docker push (lotus-all-in-one / candidate / mainnet)"
image: lotus-all-in-one
channel: candidate
network: mainnet
push: true
filters:
branches:
ignore:
- /.*/
tags:
only:
- /^v\d+\.\d+\.\d+-rc\d+$/
- build-docker:
name: "Docker build (lotus-all-in-one / mainnet)"
image: lotus-all-in-one
network: mainnet
push: false
filters:
branches:
only:
- /^release\/v\d+\.\d+\.\d+(-rc\d+)?$/
- build-docker:
name: "Docker push (lotus-all-in-one / stable / butterflynet)"
image: lotus-all-in-one
channel: stable
network: butterflynet
push: true
filters:
branches:
ignore:
- /.*/
tags:
only:
- /^v\d+\.\d+\.\d+$/
- build-docker:
name: "Docker push (lotus-all-in-one / candidate / butterflynet)"
image: lotus-all-in-one
channel: candidate
network: butterflynet
push: true
filters:
branches:
ignore:
- /.*/
tags:
only:
- /^v\d+\.\d+\.\d+-rc\d+$/
- build-docker:
name: "Docker build (lotus-all-in-one / butterflynet)"
image: lotus-all-in-one
network: butterflynet
push: false
filters:
branches:
only:
- /^release\/v\d+\.\d+\.\d+(-rc\d+)?$/
- build-docker:
name: "Docker push (lotus-all-in-one / stable / calibnet)"
image: lotus-all-in-one
channel: stable
network: calibnet
push: true
filters:
branches:
ignore:
- /.*/
tags:
only:
- /^v\d+\.\d+\.\d+$/
- build-docker:
name: "Docker push (lotus-all-in-one / candidate / calibnet)"
image: lotus-all-in-one
channel: candidate
network: calibnet
push: true
filters:
branches:
ignore:
- /.*/
tags:
only:
- /^v\d+\.\d+\.\d+-rc\d+$/
- build-docker:
name: "Docker build (lotus-all-in-one / calibnet)"
image: lotus-all-in-one
network: calibnet
push: false
filters:
branches:
only:
- /^release\/v\d+\.\d+\.\d+(-rc\d+)?$/
- build-docker:
name: "Docker push (lotus-all-in-one / stable / debug)"
image: lotus-all-in-one
channel: stable
network: debug
push: true
filters:
branches:
ignore:
- /.*/
tags:
only:
- /^v\d+\.\d+\.\d+$/
- build-docker:
name: "Docker push (lotus-all-in-one / candidate / debug)"
image: lotus-all-in-one
channel: candidate
network: debug
push: true
filters:
branches:
ignore:
- /.*/
tags:
only:
- /^v\d+\.\d+\.\d+-rc\d+$/
- build-docker:
name: "Docker build (lotus-all-in-one / debug)"
image: lotus-all-in-one
network: debug
push: false
filters:
branches:
only:
- /^release\/v\d+\.\d+\.\d+(-rc\d+)?$/
nightly: nightly:
triggers: triggers:
@ -1149,16 +1311,37 @@ workflows:
- master - master
jobs: jobs:
- publish-snapcraft: - publish-snapcraft:
name: "Publish Snapcraft Nightly (lotus-filecoin / edge)" name: "Publish Snapcraft (lotus / edge)"
channel: edge
snap-name: lotus-filecoin
- publish-snapcraft:
name: "Publish Snapcraft Nightly (lotus / edge)"
channel: edge channel: edge
snap-name: lotus snap-name: lotus
- publish-dockerhub: - publish-snapcraft:
name: publish-dockerhub-nightly name: "Publish Snapcraft (lotus-filecoin / edge)"
tag: nightly channel: edge
snap-name: lotus-filecoin
- build-docker:
name: "Docker (lotus-all-in-one / nightly / mainnet)"
image: lotus-all-in-one
channel: nightly
network: mainnet
push: true
- build-docker:
name: "Docker (lotus-all-in-one / nightly / butterflynet)"
image: lotus-all-in-one
channel: nightly
network: butterflynet
push: true
- build-docker:
name: "Docker (lotus-all-in-one / nightly / calibnet)"
image: lotus-all-in-one
channel: nightly
network: calibnet
push: true
- build-docker:
name: "Docker (lotus-all-in-one / nightly / debug)"
image: lotus-all-in-one
channel: nightly
network: debug
push: true
biweekly: biweekly:
triggers: triggers:
- schedule: - schedule:

View File

@ -106,10 +106,14 @@ func main() {
// form the input data. // form the input data.
type data struct { type data struct {
Networks []string
SnapNames []string
ItestFiles []string ItestFiles []string
UnitSuites map[string]string UnitSuites map[string]string
} }
in := data{ in := data{
Networks: []string{"mainnet", "butterflynet", "calibnet", "debug"},
SnapNames: []string{"lotus", "lotus-filecoin"},
ItestFiles: itests, ItestFiles: itests,
UnitSuites: func() map[string]string { UnitSuites: func() map[string]string {
ret := make(map[string]string) ret := make(map[string]string)

View File

@ -1,6 +1,7 @@
version: 2.1 version: 2.1
orbs: orbs:
aws-cli: circleci/aws-cli@1.3.2 aws-cli: circleci/aws-cli@1.3.2
docker: circleci/docker@2.1.4
executors: executors:
golang: golang:
@ -583,6 +584,92 @@ jobs:
shell: /bin/bash -o pipefail shell: /bin/bash -o pipefail
command: | command: |
snapcraft upload *.snap --release << parameters.channel >> snapcraft upload *.snap --release << parameters.channel >>
build-docker:
description: >
Publish to Dockerhub
executor: docker/docker
parameters:
image:
type: string
default: lotus
description: >
Passed to the docker build process to determine which image in the
Dockerfile should be built. Expected values are `lotus`,
`lotus-all-in-one`
network:
type: string
default: "mainnet"
description: >
Passed to the docker build process using GOFLAGS+=-tags=<<network>>.
Expected values are `debug`, `2k`, `calibnet`, `butterflynet`,
`interopnet`.
channel:
type: string
default: ""
description: >
The release channel to use for this image.
push:
type: boolean
default: false
description: >
When true, pushes the image to Dockerhub
steps:
- setup_remote_docker
- checkout
- docker/check:
docker-username: DOCKERHUB_USERNAME
docker-password: DOCKERHUB_PASSWORD
- when:
condition:
equal: [ mainnet, <<parameters.network>> ]
steps:
- when:
condition: <parameters.push>>
steps:
- docker/build:
image: filecoin/<<parameters.image>>
extra_build_args: --target <<parameters.image>>
tag: <<parameters.channel>>
- run:
name: Docker push
command: |
echo docker push filecoin/<<parameters.image>>:<<parameters.channel>>
if [["[[ ! -z $CIRCLE_TAG ]]"]]; then
docker image tag filecoin/<<parameters.image>>:<<parameters.channel>> filecoin/<<parameters.image>>:"${CIRCLE_TAG}"
echo docker push filecoin/<<parameters.image>>:"${CIRCLE_TAG}"
fi
- unless:
condition: <<parameters.push>>
steps:
- docker/build:
image: filecoin/<<parameters.image>>
extra_build_args: --target <<parameters.image>>
- when:
condition:
not:
equal: [ mainnet, <<parameters.network>> ]
steps:
- when:
condition: <<parameters.push>>
steps:
- docker/build:
image: filecoin/<<parameters.image>>
extra_build_args: --target <<parameters.image>> --build-arg GOFLAGS=-tags=<<parameters.network>>
tag: <<parameters.channel>>-<<parameters.network>>
- run:
name: Docker push
command: |
echo docker push filecoin/<<parameters.image>>:<<parameters.channel>>-<<parameters.network>>
if [["[[ ! -z $CIRCLE_TAG ]]"]]; then
docker image tag filecoin/<<parameters.image>>:<<parameters.channel>>-<<parameters.network>> filecoin/<<parameters.image>>:"${CIRCLE_TAG}"-<<parameters.network>>
echo docker push filecoin/<<parameters.image>>:"${CIRCLE_TAG}"-<<parameters.network>>
fi
- unless:
condition: <<parameters.push>>
steps:
- docker/build:
image: filecoin/<<parameters.image>>
extra_build_args: --target <<parameters.image>> --build-arg GOFLAGS=-tags=<<parameters.network>>
publish-packer-snap: publish-packer-snap:
description: build packer image with snap. mainnet only. description: build packer image with snap. mainnet only.
@ -592,51 +679,6 @@ jobs:
- checkout - checkout
- packer_build: - packer_build:
template: tools/packer/lotus-snap.pkr.hcl template: tools/packer/lotus-snap.pkr.hcl
publish-dockerhub:
description: publish to dockerhub
machine:
image: ubuntu-2004:202010-01
parameters:
tag:
type: string
default: latest
steps:
- checkout
- run:
name: dockerhub login
command: echo $DOCKERHUB_PASSWORD | docker login --username $DOCKERHUB_USERNAME --password-stdin
- run:
name: docker build
command: |
docker build --target lotus -t filecoin/lotus:<< parameters.tag >> -f Dockerfile.lotus .
docker build --target lotus-gateway -t filecoin/lotus-gateway:<< parameters.tag >> -f Dockerfile.lotus .
docker build --target lotus-all-in-one -t filecoin/lotus-all-in-one:<< parameters.tag >> -f Dockerfile.lotus .
if [["[[ ! -z $CIRCLE_SHA1 ]]"]]; then
docker build --target lotus -t filecoin/lotus:$CIRCLE_SHA1 -f Dockerfile.lotus .
docker build --target lotus-gateway -t filecoin/lotus-gateway:$CIRCLE_SHA1 -f Dockerfile.lotus .
docker build --target lotus-all-in-one -t filecoin/lotus-all-in-one:$CIRCLE_SHA1 -f Dockerfile.lotus .
fi
if [["[[ ! -z $CIRCLE_TAG ]]"]]; then
docker build --target lotus -t filecoin/lotus:$CIRCLE_TAG -f Dockerfile.lotus .
docker build --target lotus-gateway -t filecoin/lotus-gateway:$CIRCLE_TAG -f Dockerfile.lotus .
docker build --target lotus-all-in-one -t filecoin/lotus-all-in-one:$CIRCLE_TAG -f Dockerfile.lotus .
fi
- run:
name: docker push
command: |
docker push filecoin/lotus:<< parameters.tag >>
docker push filecoin/lotus-gateway:<< parameters.tag >>
docker push filecoin/lotus-all-in-one:<< parameters.tag >>
if [["[[ ! -z $CIRCLE_SHA1 ]]"]]; then
docker push filecoin/lotus:$CIRCLE_SHA1
docker push filecoin/lotus-gateway:$CIRCLE_SHA1
docker push filecoin/lotus-all-in-one:$CIRCLE_SHA1
fi
if [["[[ ! -z $CIRCLE_TAG ]]"]]; then
docker push filecoin/lotus:$CIRCLE_TAG
docker push filecoin/lotus-gateway:$CIRCLE_TAG
docker push filecoin/lotus-all-in-one:$CIRCLE_TAG
fi
workflows: workflows:
version: 2.1 version: 2.1
@ -759,10 +801,11 @@ workflows:
tags: tags:
only: only:
- /^v\d+\.\d+\.\d+(-rc\d+)?$/ - /^v\d+\.\d+\.\d+(-rc\d+)?$/
[[- range .SnapNames]]
- publish-snapcraft: - publish-snapcraft:
name: "Publish Snapcraft (lotus-filecoin / candidate)" name: "Publish Snapcraft ([[.]] / stable)"
channel: stable channel: stable
snap-name: lotus-filecoin snap-name: [[.]]
filters: filters:
branches: branches:
ignore: ignore:
@ -771,9 +814,9 @@ workflows:
only: only:
- /^v\d+\.\d+\.\d+$/ - /^v\d+\.\d+\.\d+$/
- publish-snapcraft: - publish-snapcraft:
name: "Publish Snapcraft (lotus-filecoin / candidate)" name: "Publish Snapcraft ([[.]] / candidate)"
channel: candidate channel: candidate
snap-name: lotus-filecoin snap-name: [[.]]
filters: filters:
branches: branches:
ignore: ignore:
@ -781,10 +824,14 @@ workflows:
tags: tags:
only: only:
- /^v\d+\.\d+\.\d+-rc\d+$/ - /^v\d+\.\d+\.\d+-rc\d+$/
- publish-snapcraft: [[- end]]
name: "Publish Snapcraft (lotus / stable)" [[- range .Networks]]
- build-docker:
name: "Docker push (lotus-all-in-one / stable / [[.]])"
image: lotus-all-in-one
channel: stable channel: stable
snap-name: lotus network: [[.]]
push: true
filters: filters:
branches: branches:
ignore: ignore:
@ -792,10 +839,12 @@ workflows:
tags: tags:
only: only:
- /^v\d+\.\d+\.\d+$/ - /^v\d+\.\d+\.\d+$/
- publish-snapcraft: - build-docker:
name: "Publish Snapcraft (lotus / candidate)" name: "Docker push (lotus-all-in-one / candidate / [[.]])"
image: lotus-all-in-one
channel: candidate channel: candidate
snap-name: lotus network: [[.]]
push: true
filters: filters:
branches: branches:
ignore: ignore:
@ -803,26 +852,16 @@ workflows:
tags: tags:
only: only:
- /^v\d+\.\d+\.\d+-rc\d+$/ - /^v\d+\.\d+\.\d+-rc\d+$/
- publish-dockerhub: - build-docker:
name: "Publish Dockerhub (stable)" name: "Docker build (lotus-all-in-one / [[.]])"
tag: stable image: lotus-all-in-one
network: [[.]]
push: false
filters: filters:
branches: branches:
ignore:
- /.*/
tags:
only: only:
- /^v\d+\.\d+\.\d+$/ - /^release\/v\d+\.\d+\.\d+(-rc\d+)?$/
- publish-dockerhub: [[- end]]
name: "Publish Dockerhub (candidate)"
tag: candidate
filters:
branches:
ignore:
- /.*/
tags:
only:
- /^v\d+\.\d+\.\d+-rc\d+$/
nightly: nightly:
triggers: triggers:
@ -833,17 +872,20 @@ workflows:
only: only:
- master - master
jobs: jobs:
[[- range .SnapNames]]
- publish-snapcraft: - publish-snapcraft:
name: "Publish Snapcraft Nightly (lotus-filecoin / edge)" name: "Publish Snapcraft ([[.]] / edge)"
channel: edge channel: edge
snap-name: lotus-filecoin snap-name: [[.]]
- publish-snapcraft: [[- end]]
name: "Publish Snapcraft Nightly (lotus / edge)" [[- range .Networks]]
channel: edge - build-docker:
snap-name: lotus name: "Docker (lotus-all-in-one / nightly / [[.]])"
- publish-dockerhub: image: lotus-all-in-one
name: publish-dockerhub-nightly channel: nightly
tag: nightly network: [[.]]
push: true
[[- end]]
biweekly: biweekly:
triggers: triggers:
- schedule: - schedule:

134
Dockerfile Normal file
View File

@ -0,0 +1,134 @@
#####################################
FROM golang:1.18.8-buster AS lotus-builder
MAINTAINER Lotus Development Team
RUN apt-get update && apt-get install -y ca-certificates build-essential clang ocl-icd-opencl-dev ocl-icd-libopencl1 jq libhwloc-dev
ENV XDG_CACHE_HOME="/tmp"
### taken from https://github.com/rust-lang/docker-rust/blob/master/1.63.0/buster/Dockerfile
ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH \
RUST_VERSION=1.63.0
RUN set -eux; \
dpkgArch="$(dpkg --print-architecture)"; \
case "${dpkgArch##*-}" in \
amd64) rustArch='x86_64-unknown-linux-gnu'; rustupSha256='5cc9ffd1026e82e7fb2eec2121ad71f4b0f044e88bca39207b3f6b769aaa799c' ;; \
arm64) rustArch='aarch64-unknown-linux-gnu'; rustupSha256='e189948e396d47254103a49c987e7fb0e5dd8e34b200aa4481ecc4b8e41fb929' ;; \
*) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; \
esac; \
url="https://static.rust-lang.org/rustup/archive/1.25.1/${rustArch}/rustup-init"; \
wget "$url"; \
echo "${rustupSha256} *rustup-init" | sha256sum -c -; \
chmod +x rustup-init; \
./rustup-init -y --no-modify-path --profile minimal --default-toolchain $RUST_VERSION --default-host ${rustArch}; \
rm rustup-init; \
chmod -R a+w $RUSTUP_HOME $CARGO_HOME; \
rustup --version; \
cargo --version; \
rustc --version;
COPY ./ /opt/filecoin
WORKDIR /opt/filecoin
### make configurable filecoin-ffi build
ARG FFI_BUILD_FROM_SOURCE=0
ENV FFI_BUILD_FROM_SOURCE=${FFI_BUILD_FROM_SOURCE}
RUN make clean deps
ARG RUSTFLAGS=""
ARG GOFLAGS=""
RUN make buildall
#####################################
FROM ubuntu:20.04 AS lotus-base
MAINTAINER Lotus Development Team
# Base resources
COPY --from=lotus-builder /etc/ssl/certs /etc/ssl/certs
COPY --from=lotus-builder /lib/*/libdl.so.2 /lib/
COPY --from=lotus-builder /lib/*/librt.so.1 /lib/
COPY --from=lotus-builder /lib/*/libgcc_s.so.1 /lib/
COPY --from=lotus-builder /lib/*/libutil.so.1 /lib/
COPY --from=lotus-builder /usr/lib/*/libltdl.so.7 /lib/
COPY --from=lotus-builder /usr/lib/*/libnuma.so.1 /lib/
COPY --from=lotus-builder /usr/lib/*/libhwloc.so.5 /lib/
COPY --from=lotus-builder /usr/lib/*/libOpenCL.so.1 /lib/
RUN useradd -r -u 532 -U fc \
&& mkdir -p /etc/OpenCL/vendors \
&& echo "libnvidia-opencl.so.1" > /etc/OpenCL/vendors/nvidia.icd
#####################################
FROM lotus-base AS lotus
MAINTAINER Lotus Development Team
COPY --from=lotus-builder /opt/filecoin/lotus /usr/local/bin/
COPY --from=lotus-builder /opt/filecoin/lotus-shed /usr/local/bin/
COPY scripts/docker-lotus-entrypoint.sh /
ARG DOCKER_LOTUS_IMPORT_SNAPSHOT https://snapshots.mainnet.filops.net/minimal/latest
ENV DOCKER_LOTUS_IMPORT_SNAPSHOT ${DOCKER_LOTUS_IMPORT_SNAPSHOT}
ENV FILECOIN_PARAMETER_CACHE /var/tmp/filecoin-proof-parameters
ENV LOTUS_PATH /var/lib/lotus
ENV DOCKER_LOTUS_IMPORT_WALLET ""
RUN mkdir /var/lib/lotus /var/tmp/filecoin-proof-parameters
RUN chown fc: /var/lib/lotus /var/tmp/filecoin-proof-parameters
VOLUME /var/lib/lotus
VOLUME /var/tmp/filecoin-proof-parameters
USER fc
EXPOSE 1234
ENTRYPOINT ["/docker-lotus-entrypoint.sh"]
CMD ["-help"]
#####################################
FROM lotus-base AS lotus-all-in-one
ENV FILECOIN_PARAMETER_CACHE /var/tmp/filecoin-proof-parameters
ENV LOTUS_MINER_PATH /var/lib/lotus-miner
ENV LOTUS_PATH /var/lib/lotus
ENV LOTUS_WORKER_PATH /var/lib/lotus-worker
ENV WALLET_PATH /var/lib/lotus-wallet
COPY --from=lotus-builder /opt/filecoin/lotus /usr/local/bin/
COPY --from=lotus-builder /opt/filecoin/lotus-seed /usr/local/bin/
COPY --from=lotus-builder /opt/filecoin/lotus-shed /usr/local/bin/
COPY --from=lotus-builder /opt/filecoin/lotus-wallet /usr/local/bin/
COPY --from=lotus-builder /opt/filecoin/lotus-gateway /usr/local/bin/
COPY --from=lotus-builder /opt/filecoin/lotus-miner /usr/local/bin/
COPY --from=lotus-builder /opt/filecoin/lotus-worker /usr/local/bin/
COPY --from=lotus-builder /opt/filecoin/lotus-stats /usr/local/bin/
COPY --from=lotus-builder /opt/filecoin/lotus-fountain /usr/local/bin/
RUN mkdir /var/tmp/filecoin-proof-parameters
RUN mkdir /var/lib/lotus
RUN mkdir /var/lib/lotus-miner
RUN mkdir /var/lib/lotus-worker
RUN mkdir /var/lib/lotus-wallet
RUN chown fc: /var/tmp/filecoin-proof-parameters
RUN chown fc: /var/lib/lotus
RUN chown fc: /var/lib/lotus-miner
RUN chown fc: /var/lib/lotus-worker
RUN chown fc: /var/lib/lotus-wallet
VOLUME /var/tmp/filecoin-proof-parameters
VOLUME /var/lib/lotus
VOLUME /var/lib/lotus-miner
VOLUME /var/lib/lotus-worker
VOLUME /var/lib/lotus-wallet
EXPOSE 1234
EXPOSE 2345
EXPOSE 3456
EXPOSE 1777

View File

@ -1,3 +1,5 @@
##### DEPRECATED
FROM golang:1.18.8-buster AS builder-deps FROM golang:1.18.8-buster AS builder-deps
MAINTAINER Lotus Development Team MAINTAINER Lotus Development Team