-
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.
#104 Make docker container based on nvidia-gpu image
- Loading branch information
1 parent
0ec7f24
commit d4065df
Showing
17 changed files
with
164 additions
and
105 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,90 @@ | ||
FROM golang:1.11-alpine as builder | ||
FROM nvidia/cuda:10.0-devel-ubuntu18.04 as build_stage | ||
|
||
WORKDIR $GOPATH/src/github.com/cybercongress/cyberd | ||
COPY ./ ./ | ||
ENV GO_VERSION 1.11.2 | ||
ENV GO_ARCH 'linux-amd64' | ||
ENV GO_BIN_SHA '1dfe664fa3d8ad714bbd15a36627992effd150ddabd7523931f077b3926d736d' | ||
|
||
RUN apk add --no-cache git | ||
|
||
RUN GO111MODULE=on CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -installsuffix cgo -ldflags="-w -s" -o /go/bin/cyberd ./cyberd | ||
RUN GO111MODULE=on CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -installsuffix cgo -ldflags="-w -s" -o /go/bin/cyberdcli ./cyberdcli | ||
RUN GO111MODULE=on CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -installsuffix cgo -ldflags="-w -s" -o /go/bin/cyberdproxy ./proxy | ||
# Install required dev tools to compile cyberd | ||
############################################################################### | ||
RUN apt-get update && apt-get install -y --no-install-recommends wget git | ||
|
||
FROM alpine:edge | ||
|
||
RUN apk add --update ca-certificates | ||
WORKDIR /root | ||
# Install golang | ||
############################################################################### | ||
RUN url="https://golang.org/dl/go${GO_VERSION}.${GO_ARCH}.tar.gz" && \ | ||
wget -O go.tgz "$url" && \ | ||
echo "${GO_BIN_SHA} *go.tgz" | sha256sum -c - && \ | ||
tar -C /usr/local -xzf go.tgz &&\ | ||
rm go.tgz | ||
|
||
COPY --from=builder /go/bin/cyberd /usr/bin/cyberd | ||
COPY --from=builder /go/bin/cyberdcli /usr/bin/cyberdcli | ||
COPY --from=builder /go/bin/cyberdproxy /usr/bin/cyberdproxy | ||
ENV PATH="/usr/local/go/bin:$PATH" | ||
RUN go version && nvcc --version | ||
|
||
|
||
# Compile cuda kernel | ||
############################################################################### | ||
COPY . /sources | ||
WORKDIR /sources/x/rank/cuda | ||
RUN nvcc -fmad=false -shared -o libcbdrank.so rank.cu --compiler-options '-fPIC -frounding-math -fsignaling-nans' && \ | ||
cp libcbdrank.so /usr/lib/ && cp cbdrank.h /usr/lib/ | ||
|
||
|
||
# Compile cyberd | ||
############################################################################### | ||
WORKDIR /sources | ||
RUN go build -tags cuda -o daemon ./cyberd | ||
RUN go build -o cli ./cyberdcli | ||
RUN go build -o daemon_proxy ./proxy | ||
|
||
|
||
############################################################################### | ||
# Create base image | ||
############################################################################### | ||
FROM nvidia/cuda:10.0-runtime-ubuntu18.04 | ||
|
||
ENV GO_VERSION 1.11.2 | ||
ENV GO_ARCH 'linux-amd64' | ||
ENV GO_BIN_SHA '1dfe664fa3d8ad714bbd15a36627992effd150ddabd7523931f077b3926d736d' | ||
|
||
|
||
# Install required dev tools to install go | ||
############################################################################### | ||
RUN apt-get update && apt-get install -y --no-install-recommends wget curl | ||
|
||
COPY start_script.sh start_script.sh | ||
RUN chmod +x start_script.sh | ||
|
||
# Install golang | ||
############################################################################### | ||
RUN url="https://golang.org/dl/go${GO_VERSION}.${GO_ARCH}.tar.gz" && \ | ||
wget -O go.tgz "$url" && \ | ||
echo "${GO_BIN_SHA} *go.tgz" | sha256sum -c - && \ | ||
tar -C /usr/local -xzf go.tgz &&\ | ||
rm go.tgz | ||
|
||
|
||
# Copy compiled kernel and binaries | ||
############################################################################### | ||
COPY --from=build_stage /sources/daemon /usr/bin/cyberd | ||
COPY --from=build_stage /sources/cli /usr/bin/cyberdcli | ||
COPY --from=build_stage /sources/daemon_proxy /usr/bin/cyberdproxy | ||
|
||
COPY --from=build_stage /usr/lib/cbdrank.h /usr/lib/cbdrank.h | ||
COPY --from=build_stage /usr/lib/libcbdrank.so /usr/lib/libcbdrank.so | ||
|
||
|
||
# Copy configs and startup scripts | ||
############################################################################### | ||
COPY ./testnet/genesis.json /genesis.json | ||
COPY ./testnet/config.toml /config.toml | ||
|
||
EXPOSE 26656 26657 26660 | ||
|
||
COPY start_script.sh start_script.sh | ||
COPY entrypoint.sh /entrypoint.sh | ||
RUN chmod +x start_script.sh | ||
RUN chmod +x /entrypoint.sh | ||
|
||
|
||
# Start | ||
############################################################################### | ||
EXPOSE 26656 26657 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
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.