-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dockerfile prepared for upgrade, docs cleanup
- Loading branch information
Showing
4 changed files
with
72 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,158 +1,109 @@ | ||
########################################################################################### | ||
# Build cyber | ||
########################################################################################### | ||
FROM ubuntu:20.04 as build_stage_cuda | ||
FROM ubuntu:20.04 | ||
|
||
ENV GO_VERSION '1.17.8' | ||
ENV GO_ARCH 'linux-amd64' | ||
ENV GO_BIN_SHA '980e65a863377e69fd9b67df9d8395fd8e93858e7a24c9f55803421e453f4f99' | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
ENV DAEMON_HOME /root/.cyber | ||
ENV DAEMON_RESTART_AFTER_UPGRADE=true | ||
ENV DAEMON_ALLOW_DOWNLOAD_BINARIES=false | ||
ENV DAEMON_LOG_BUFFER_SIZE=1048 | ||
ENV UNSAFE_SKIP_BACKUP=true | ||
ENV DAEMON_NAME cyber | ||
ENV BUILD_DIR /build | ||
#ENV COSMWASM_VER "1.0.0" | ||
ENV PATH /usr/local/go/bin:/root/.cargo/bin:/root/cargo/env:/root/.cyber/scripts:$PATH | ||
#ENV CUDA_VER '11.6.1-1' | ||
ENV CUDA_VER '11.4.4-1' | ||
ENV PATH="/usr/local/go/bin:/usr/local/cuda/bin:$PATH" | ||
|
||
|
||
# Install required dev tools to compile cyber | ||
# Install go and required deps | ||
########################################################################################### | ||
RUN apt-get update && apt-get install -y --no-install-recommends wget git ca-certificates | ||
RUN apt-get update && apt-get install -y --no-install-recommends wget ca-certificates \ | ||
&& wget -O go.tgz https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz \ | ||
&& echo "${GO_BIN_SHA} *go.tgz" | sha256sum -c - \ | ||
&& tar -C /usr/local -xzf go.tgz \ | ||
&& rm go.tgz \ | ||
&& go version | ||
|
||
# Install golang | ||
########################################################################################### | ||
RUN wget -O go.tgz https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz && \ | ||
echo "${GO_BIN_SHA} *go.tgz" | sha256sum -c - && \ | ||
tar -C /usr/local -xzf go.tgz &&\ | ||
rm go.tgz | ||
|
||
ENV PATH="/usr/local/go/bin:/usr/local/cuda/bin:$PATH" | ||
COPY . /sources | ||
WORKDIR /sources | ||
|
||
# Install CUDA, build tools and compile cyber | ||
########################################################################################### | ||
RUN apt-get -y install --no-install-recommends \ | ||
make gcc g++ \ | ||
wget \ | ||
curl \ | ||
gnupg \ | ||
git \ | ||
# gnupg \ | ||
# software-properties-common \ | ||
nvidia-cuda-toolkit \ | ||
&& go version | ||
|
||
# Install requested CUDA version | ||
########################################################################################### | ||
#RUN wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004.pin \ | ||
#&& mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600 \ | ||
#&& apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/7fa2af80.pub \ | ||
#&& add-apt-repository "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/ /" \ | ||
#&& apt-get update \ | ||
#&& apt-get install cuda=${CUDA_VER} -y | ||
|
||
# Create appropriate folders layout | ||
########################################################################################### | ||
RUN mkdir -p /cyber/cosmovisor/genesis/bin \ | ||
&& mkdir -p /cyber/cosmovisor/upgrades/upgrade-1/bin | ||
# Compile cosmovisor | ||
########################################################################################### | ||
RUN git clone --depth 1 https://github.com/cosmos/cosmos-sdk.git $BUILD_DIR/ \ | ||
&& cd $BUILD_DIR/cosmovisor/ \ | ||
&& make cosmovisor \ | ||
&& cp cosmovisor /usr/bin/cosmovisor \ | ||
&& chmod +x /usr/bin/cosmovisor \ | ||
&& rm -fR $BUILD_DIR/* && rm -fR $BUILD_DIR/.*[a-z] | ||
|
||
########################################################################################### | ||
# Build wasmvm | ||
########################################################################################### | ||
#WORKDIR / | ||
#RUN curl https://sh.rustup.rs -sSf | sh -s -- -y \ | ||
# && wget --quiet https://github.com/CosmWasm/wasmvm/archive/v${COSMWASM_VER}.tar.gz -P /tmp \ | ||
# && tar xzf /tmp/v${COSMWASM_VER}.tar.gz -C $BUILD_DIR \ | ||
# && cd $BUILD_DIR/wasmvm-${COSMWASM_VER}/ && make build \ | ||
# && cp $BUILD_DIR/wasmvm-${COSMWASM_VER}/api/libwasmvm.so /usr/lib/ \ | ||
# && cp $BUILD_DIR/wasmvm-${COSMWASM_VER}/api/libwasmvm.dylib /usr/lib/ | ||
|
||
# Compile cuda kernel | ||
########################################################################################### | ||
COPY . /sources | ||
WORKDIR /sources/x/rank/cuda | ||
RUN make build | ||
RUN cp ./build/libcbdrank.so /usr/lib/ && cp cbdrank.h /usr/lib/ | ||
|
||
software-properties-common \ | ||
# nvidia-cuda-toolkit \ | ||
# Install cuda selected version instead nvidia-cuda-toolkit | ||
&& wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004.pin \ | ||
&& mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600 \ | ||
&& apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/3bf863cc.pub \ | ||
&& add-apt-repository "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/ /" \ | ||
&& apt-get update \ | ||
&& apt-get install cuda=${CUDA_VER} -y --no-install-recommends \ | ||
&& mkdir -p /cyber/cosmovisor/genesis/bin \ | ||
&& mkdir -p /cyber/cosmovisor/upgrades/cyberfrey/bin \ | ||
# Compile cyber for genesis version | ||
########################################################################################### | ||
|
||
WORKDIR /sources | ||
RUN git checkout v0.2.0 \ | ||
&& make build CUDA_ENABLED=true \ | ||
&& chmod +x ./build/cyber \ | ||
&& cp ./build/cyber /cyber/cosmovisor/genesis/bin/ \ | ||
&& cp ./build/cyber /usr/local/bin \ | ||
&& rm -rf ./build \ | ||
&& git reset --hard | ||
|
||
|
||
&& git checkout v0.2.0 \ | ||
&& cd /sources/x/rank/cuda \ | ||
&& make build \ | ||
&& cd /sources \ | ||
&& make build CUDA_ENABLED=true \ | ||
&& cp ./build/cyber /cyber/cosmovisor/genesis/bin/ \ | ||
&& cp ./build/cyber /usr/local/bin \ | ||
&& rm -rf ./build \ | ||
# Compile cyber for genesis version | ||
########################################################################################### | ||
&& git checkout v0.3.0 \ | ||
&& cd /sources/x/rank/cuda \ | ||
&& make build \ | ||
&& cd /sources \ | ||
&& make build CUDA_ENABLED=true \ | ||
&& cp ./build/cyber /cyber/cosmovisor/upgrades/cyberfrey/bin/ \ | ||
&& rm -rf ./build \ | ||
# Cleanup | ||
########################################################################################### | ||
&& apt-get purge -y git \ | ||
make \ | ||
cuda \ | ||
gcc g++ \ | ||
curl \ | ||
gnupg \ | ||
python3.8 \ | ||
&& go clean --cache -i \ | ||
&& apt-get remove --purge '^nvidia-.*' -y \ | ||
&& apt-get autoremove -y \ | ||
&& apt-get clean | ||
|
||
WORKDIR /sources | ||
RUN git checkout upgrade-1 \ | ||
&& make build CUDA_ENABLED=true \ | ||
&& chmod +x ./build/cyber \ | ||
&& cp ./build/cyber /cyber/cosmovisor/upgrades/upgrade-1/bin/ \ | ||
&& rm -rf ./build \ | ||
&& git reset --hard | ||
|
||
########################################################################################### | ||
# Create runtime cyber image | ||
########################################################################################### | ||
#FROM ubuntu:20.04 | ||
|
||
ENV DAEMON_HOME /root/.cyber | ||
ENV DAEMON_RESTART_AFTER_UPGRADE=true | ||
ENV DAEMON_NAME cyber | ||
ENV DAEMON_ALLOW_DOWNLOAD_BINARIES=false | ||
ENV DAEMON_LOG_BUFFER_SIZE=812 | ||
ENV UNSAFE_SKIP_BACKUP=true | ||
|
||
# Install useful dev tools | ||
# Install cosmovisor | ||
########################################################################################### | ||
#RUN apt-get update && apt-get install -y --no-install-recommends wget curl ca-certificates | ||
RUN wget -O cosmovisor.tgz https://github.com/cosmos/cosmos-sdk/releases/download/cosmovisor%2Fv1.1.0/cosmovisor-v1.1.0-linux-amd64.tar.gz \ | ||
&& tar -xzf cosmovisor.tgz \ | ||
&& cp cosmovisor /usr/bin/cosmovisor \ | ||
&& chmod +x /usr/bin/cosmovisor \ | ||
&& rm cosmovisor.tgz && rm -fR $BUILD_DIR/* && rm -fR $BUILD_DIR/.*[a-z] | ||
|
||
# Download genesis file and links file from IPFS | ||
# Copy startup scripts and genesis | ||
########################################################################################### | ||
RUN wget -O /genesis.json https://gateway.ipfs.cybernode.ai/ipfs/QmQaux3zRF5ucdmtGYEVeNZTBfryfX4e49mj57SusMCo1p | ||
|
||
WORKDIR / | ||
|
||
# Copy compiled kernel and binaries for current bin version | ||
########################################################################################### | ||
#COPY --from=build_stage_cuda /cyber /cyber | ||
|
||
#COPY /cyber/cyber /usr/bin | ||
|
||
#COPY --from=build_stage_cuda /usr/bin/cosmovisor /usr/bin/cosmovisor | ||
|
||
#COPY --from=build_stage_cuda /usr/lib/cbdrank.h /usr/lib/cbdrank.h | ||
#COPY --from=build_stage_cuda /usr/lib/libcbdrank.so /usr/lib/libcbdrank.so | ||
|
||
#COPY --from=build_stage_cuda /usr/lib/libwasmvm.so /usr/lib/libwasmvm.so | ||
#COPY --from=build_stage_cuda /usr/lib/libwasmvm.dylib /usr/lib/libwasmvm.dylib | ||
|
||
# Copy startup scripts | ||
########################################################################################### | ||
|
||
COPY start_script.sh start_script.sh | ||
COPY entrypoint.sh /entrypoint.sh | ||
RUN chmod +x start_script.sh | ||
RUN chmod +x /entrypoint.sh | ||
RUN go version | ||
RUN cyber version | ||
RUN wget -O /genesis.json https://gateway.ipfs.cybernode.ai/ipfs/QmYubyVNfghD4xCrTFj26zBwrF9s5GJhi1TmxvrwmJCipr \ | ||
&& chmod +x start_script.sh \ | ||
&& chmod +x /entrypoint.sh \ | ||
&& cyber version | ||
|
||
|
||
# Start | ||
############################################################################### | ||
EXPOSE 26656 26657 1317 9090 20660 | ||
EXPOSE 26656 26657 1317 9090 26660 | ||
ENTRYPOINT ["/entrypoint.sh"] | ||
CMD ["./start_script.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters